Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,25 @@ jobs:
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked --target $TARGET
- name: cargo fetch --locked
run: cargo fetch --locked --target $TARGET
- if: ${{ matrix.integration == 'cargo-gpu' }}
name: template build
run: cargo build --workspace --exclude xtask
- if: ${{ matrix.integration == 'cargo-gpu' }}
name: template test
run: cargo nextest run --workspace --exclude xtask --no-tests warn
- name: xtask build
run: cd xtask && cargo build
run: cargo build -p xtask
- name: xtask generate
# generate all variants, since `--clean` deletes `generated/`, not generating all of them will cause changes
# generate all variants
# If this fails, the files committed don't match what should have been generated.
# Since `--clean` deletes `generated/`, any additional files in git are marked as removed.
run: cargo xtask generate --clean
- name: check generated files are up-to-date
run: |
git add .
git diff --cached
# if this fails, the files committed don't match what should have been generated
git diff --quiet && git diff --cached --quiet
# no --locked, templates need to generate their lockfile
- name: cargo fetch
Expand All @@ -75,18 +82,18 @@ jobs:
# to update the branch protection rules when the test matrix changes
test_success:
runs-on: ubuntu-24.04
needs: [test, xtask-test, lint]
needs: [test, template-test, lint]
# Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
if: ${{ always() }}
steps:
# Another hack is to actually check the status of the dependencies or else it'll fall through
- run: |
echo "Checking statuses..."
[[ "${{ needs.test.result }}" == "success" ]] || exit 1
[[ "${{ needs.xtask-test.result }}" == "success" ]] || exit 1
[[ "${{ needs.template-test.result }}" == "success" ]] || exit 1
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1

xtask-test:
template-test:
name: xtask test & lint
runs-on: ubuntu-24.04
steps:
Expand All @@ -104,16 +111,17 @@ jobs:
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked --target $TARGET
- name: xtask build
run: cd xtask && cargo build
# no --target since lint needs all targets
- name: cargo fetch --locked
run: cargo fetch --locked
- name: xtask test
run: cd xtask && cargo nextest run
- name: xtask fmt
run: cd xtask && cargo fmt --all -- --check
run: cargo nextest run -p xtask
- name: fmt
run: cargo fmt --all -- --check
- name: xtask clippy
run: cd xtask && cargo clippy --all-targets -- -D warnings
run: cargo clippy -p xtask --all-targets -- -D warnings
- name: template clippy
run: cargo clippy --workspace --exclude xtask --all-targets -- -D warnings

lint:
name: lint
Expand All @@ -133,18 +141,19 @@ jobs:
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked
# no --target since lint needs all targets
- name: cargo fetch --locked
run: cargo fetch --locked
- name: xtask build
run: cd xtask && cargo build
run: cargo build -p xtask
- name: xtask generate
run: cargo xtask generate ${{ matrix.integration }}
# no --locked, templates need to generate their lockfile
- name: cargo fetch
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fetch"
- name: fmt
- name: cargo fmt
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fmt --all -- --check"
- name: clippy
- name: cargo clippy
run: cargo xtask generate ${{ matrix.integration }} -x "cargo clippy --all-targets -- -D warnings"

defaults:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ wgpu = { version = "27.0.1", default-features = false, features = ["std", "parki
pollster = "0.4.0"

# rust-gpu
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bf24eb6060e0c7b0013eceddd23b5d7cee68f4cc" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bb74342b90066ce8b7d50ba8e058df356a54acf4" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }

# other
glam = { version = "0.30.9", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/ash/cargo-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ash = "0.38"
ash-window = "0.13"

# rust-gpu
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bf24eb6060e0c7b0013eceddd23b5d7cee68f4cc" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bb74342b90066ce8b7d50ba8e058df356a54acf4" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }

# other
glam = { version = "0.30.9", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ edition = "2024"
[lints]
workspace = true

[lib]
crate-type = ["lib", "dylib"]

[dependencies]
spirv-std.workspace = true
glam.workspace = true
Expand Down
8 changes: 3 additions & 5 deletions generated/graphics/ash/cargo-gpu/mygraphics/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cargo_gpu::Install;
use cargo_gpu::spirv_builder::{MetadataPrintout, ShaderPanicStrategy};
use cargo_gpu::spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvMetadata};
use std::path::PathBuf;

pub fn main() -> anyhow::Result<()> {
Expand All @@ -12,10 +12,8 @@ pub fn main() -> anyhow::Result<()> {
let install = Install::from_shader_crate(crate_path.clone()).run()?;
let mut builder = install.to_spirv_builder(crate_path, "spirv-unknown-vulkan1.3");
builder.print_metadata = MetadataPrintout::DependencyOnly;
builder.shader_panic_strategy = ShaderPanicStrategy::DebugPrintfThenExit {
print_inputs: true,
print_backtrace: true,
};
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/ash/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ash-window = "0.13"

# rust-gpu
# The version of the dependencies `spirv-builder` and `spirv-std` must match exactly!
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }

# other
glam = { version = "0.30.9", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ edition = "2024"
[lints]
workspace = true

[lib]
crate-type = ["lib", "dylib"]

[dependencies]
spirv-std.workspace = true
glam.workspace = true
Expand Down
8 changes: 3 additions & 5 deletions generated/graphics/ash/spirv-builder/mygraphics/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvBuilder};
use spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvBuilder, SpirvMetadata};
use std::path::PathBuf;

pub fn main() -> anyhow::Result<()> {
Expand All @@ -10,10 +10,8 @@ pub fn main() -> anyhow::Result<()> {

let mut builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.3");
builder.print_metadata = MetadataPrintout::DependencyOnly;
builder.shader_panic_strategy = ShaderPanicStrategy::DebugPrintfThenExit {
print_inputs: true,
print_backtrace: true,
};
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/wgpu/cargo-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ wgpu = { version = "27.0.1", default-features = false, features = ["std", "parki
pollster = "0.4.0"

# rust-gpu
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bf24eb6060e0c7b0013eceddd23b5d7cee68f4cc" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
cargo-gpu = { git = "https://github.com/Rust-GPU/cargo-gpu", rev = "bb74342b90066ce8b7d50ba8e058df356a54acf4" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }

# other
glam = { version = "0.30.9", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ edition = "2024"
[lints]
workspace = true

[lib]
crate-type = ["lib", "dylib"]

[dependencies]
spirv-std.workspace = true
glam.workspace = true
Expand Down
8 changes: 3 additions & 5 deletions generated/graphics/wgpu/cargo-gpu/mygraphics/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cargo_gpu::Install;
use cargo_gpu::spirv_builder::{MetadataPrintout, ShaderPanicStrategy};
use cargo_gpu::spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvMetadata};
use std::path::PathBuf;

pub fn main() -> anyhow::Result<()> {
Expand All @@ -12,10 +12,8 @@ pub fn main() -> anyhow::Result<()> {
let install = Install::from_shader_crate(crate_path.clone()).run()?;
let mut builder = install.to_spirv_builder(crate_path, "spirv-unknown-vulkan1.3");
builder.print_metadata = MetadataPrintout::DependencyOnly;
builder.shader_panic_strategy = ShaderPanicStrategy::DebugPrintfThenExit {
print_inputs: true,
print_backtrace: true,
};
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ pub async fn main_inner() -> anyhow::Result<()> {
let adapter =
wgpu::util::initialize_adapter_from_env_or_default(&instance, Some(&surface)).await?;

let required_features =
wgpu::Features::PUSH_CONSTANTS | wgpu::Features::EXPERIMENTAL_PASSTHROUGH_SHADERS;
let required_features = wgpu::Features::PUSH_CONSTANTS;
let required_limits = wgpu::Limits {
max_push_constant_size: 128,
..Default::default()
Expand All @@ -47,7 +46,7 @@ pub async fn main_inner() -> anyhow::Result<()> {
label: None,
required_features,
required_limits,
experimental_features: unsafe { wgpu::ExperimentalFeatures::enabled() },
experimental_features: wgpu::ExperimentalFeatures::disabled(),
memory_hints: wgpu::MemoryHints::Performance,
trace: Default::default(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use mygraphics_shaders::ShaderConstants;
use wgpu::{
ColorTargetState, ColorWrites, Device, FragmentState, FrontFace, MultisampleState,
PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, PushConstantRange,
RenderPass, RenderPipeline, RenderPipelineDescriptor, ShaderModuleDescriptorPassthrough,
ShaderRuntimeChecks, ShaderStages, TextureFormat, VertexState,
RenderPass, RenderPipeline, RenderPipelineDescriptor, ShaderStages, TextureFormat, VertexState,
include_spirv,
};

pub struct MyRenderPipeline {
Expand All @@ -12,27 +12,7 @@ pub struct MyRenderPipeline {

impl MyRenderPipeline {
pub fn new(device: &Device, out_format: TextureFormat) -> anyhow::Result<Self> {
// Workaround in wgpu 27.0.1 where the macro expansion of `include_spirv_raw!` doesn't compile
// see https://github.com/gfx-rs/wgpu/pull/8250
// let module = unsafe {
// device.create_shader_module_passthrough(include_spirv_raw!(env!("SHADER_SPV_PATH")))
// };
let module = unsafe {
device.create_shader_module_passthrough(ShaderModuleDescriptorPassthrough {
label: Some(env!("SHADER_SPV_PATH")),
entry_point: "".to_owned(),
num_workgroups: (0, 0, 0),
runtime_checks: ShaderRuntimeChecks::unchecked(),
spirv: Some(wgpu::util::make_spirv_raw(include_bytes!(env!(
"SHADER_SPV_PATH"
)))),
dxil: None,
msl: None,
hlsl: None,
glsl: None,
wgsl: None,
})
};
let module = device.create_shader_module(include_spirv!(env!("SHADER_SPV_PATH")));

let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: Some("MyRenderPipeline layout"),
Expand Down
4 changes: 2 additions & 2 deletions generated/graphics/wgpu/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pollster = "0.4.0"

# rust-gpu
# The version of the dependencies `spirv-builder` and `spirv-std` must match exactly!
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "6fb875068d0d35b1a81ae89b73cf7a464f8c60f7" }
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "96fcc9dbe475921997050c25c02a62c7a12d48e0" }

# other
glam = { version = "0.30.9", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ edition = "2024"
[lints]
workspace = true

[lib]
crate-type = ["lib", "dylib"]

[dependencies]
spirv-std.workspace = true
glam.workspace = true
Expand Down
8 changes: 3 additions & 5 deletions generated/graphics/wgpu/spirv-builder/mygraphics/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvBuilder};
use spirv_builder::{MetadataPrintout, ShaderPanicStrategy, SpirvBuilder, SpirvMetadata};
use std::path::PathBuf;

pub fn main() -> anyhow::Result<()> {
Expand All @@ -10,10 +10,8 @@ pub fn main() -> anyhow::Result<()> {

let mut builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.3");
builder.print_metadata = MetadataPrintout::DependencyOnly;
builder.shader_panic_strategy = ShaderPanicStrategy::DebugPrintfThenExit {
print_inputs: true,
print_backtrace: true,
};
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
builder.spirv_metadata = SpirvMetadata::Full;

let compile_result = builder.build()?;
let spv_path = compile_result.module.unwrap_single();
Expand Down
Loading