From 5b5840307d6bac4b880d850f6504621cd352df6f Mon Sep 17 00:00:00 2001 From: Erin Power Date: Mon, 29 Mar 2021 08:21:35 +0200 Subject: [PATCH] updates from code review --- crates/spirv-builder/src/test/basic.rs | 23 ----------------------- tests/src/main.rs | 10 ++++------ tests/ui/storage_class/push_constant.rs | 7 ++----- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/crates/spirv-builder/src/test/basic.rs b/crates/spirv-builder/src/test/basic.rs index ff3863e61c..d6f4d519be 100644 --- a/crates/spirv-builder/src/test/basic.rs +++ b/crates/spirv-builder/src/test/basic.rs @@ -200,29 +200,6 @@ OpDecorate %4 Binding 0 ); } -// NOTE(eddyb) we specifically run Vulkan validation here, as the default -// validation rules are more lax and don't require a `Block` decoration -// (`#[spirv(block)]` here) on `struct ShaderConstants`. -#[test] -fn push_constant_vulkan() { - val_vulkan( - r#" -#[derive(Copy, Clone)] -#[spirv(block)] -pub struct ShaderConstants { - pub width: u32, - pub height: u32, - pub time: f32, -} - -#[spirv(fragment)] -pub fn main(#[spirv(push_constant)] constants: &ShaderConstants) { - let _constants = *constants; -} -"#, - ); -} - #[test] fn unroll_loops() { dis_fn( diff --git a/tests/src/main.rs b/tests/src/main.rs index 794138f0a5..59f1d6c3f2 100644 --- a/tests/src/main.rs +++ b/tests/src/main.rs @@ -17,13 +17,13 @@ struct Opt { #[structopt(long)] bless: bool, - /// Only run tests that match these filters - #[structopt(name = "FILTER")] - filters: Vec, - /// The environment to compile to the SPIR-V tests. #[structopt(long)] target_env: Option, + + /// Only run tests that match these filters + #[structopt(name = "FILTER")] + filters: Vec, } impl Opt { @@ -83,8 +83,6 @@ fn main() { runner.run_mode("ui"); } -// FIXME(eddyb) a bunch of these functions could be nicer if they were methods. - struct Runner { opt: Opt, tests_dir: PathBuf, diff --git a/tests/ui/storage_class/push_constant.rs b/tests/ui/storage_class/push_constant.rs index 2e64a66bde..fc54d30414 100644 --- a/tests/ui/storage_class/push_constant.rs +++ b/tests/ui/storage_class/push_constant.rs @@ -1,13 +1,10 @@ // Test that using push constants work. -// NOTE(eddyb) this won't pass Vulkan validation (see `push_constant_vulkan`), -// but should still pass the baseline SPIR-V validation. - // build-pass - use spirv_std as _; #[derive(Copy, Clone)] -#[spirv(block)] +// `Block` decoration is required for push constants when compiling for Vulkan. +#[cfg_attr(target_env = "vulkan1.1", spirv(block))] pub struct ShaderConstants { pub width: u32, pub height: u32,