Skip to content

Commit

Permalink
Sampler Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald committed Jan 2, 2025
1 parent b17ea86 commit d740d53
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ webgl = ["wgpu/webgl"]
[dependencies]
anyhow.workspace = true
arrayvec.workspace = true
approx.workspace = true
bitflags.workspace = true
bytemuck.workspace = true
cfg-if.workspace = true
Expand Down
10 changes: 10 additions & 0 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ pub fn fail_if<T>(
}
}

/// Returns true if the provided callback fails validation.
pub fn did_fail<T>(device: &wgpu::Device, callback: impl FnOnce() -> T) -> (bool, T) {
device.push_error_scope(wgpu::ErrorFilter::Validation);
let result = callback();
let validation_error = pollster::block_on(device.pop_error_scope());
let failed = validation_error.is_some();

(failed, result)
}

/// Adds the necissary main function for our gpu test harness.
#[macro_export]
macro_rules! gpu_test_main {
Expand Down
1 change: 1 addition & 0 deletions tests/tests/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ mod ray_tracing;
mod render_pass_ownership;
mod resource_descriptor_accessor;
mod resource_error;
mod samplers;
mod scissor_tests;
mod shader;
mod shader_primitive_index;
Expand Down
Loading

0 comments on commit d740d53

Please sign in to comment.