Skip to content

Commit

Permalink
updates from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Mar 29, 2021
1 parent 3a619bf commit 5b58403
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
23 changes: 0 additions & 23 deletions crates/spirv-builder/src/test/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 4 additions & 6 deletions tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ struct Opt {
#[structopt(long)]
bless: bool,

/// Only run tests that match these filters
#[structopt(name = "FILTER")]
filters: Vec<String>,

/// The environment to compile to the SPIR-V tests.
#[structopt(long)]
target_env: Option<String>,

/// Only run tests that match these filters
#[structopt(name = "FILTER")]
filters: Vec<String>,
}

impl Opt {
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions tests/ui/storage_class/push_constant.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 5b58403

Please sign in to comment.