mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
refactor: extract did_fill_error_scope test helper from did_fail
This commit is contained in:
parent
964c5bbf4c
commit
43eee99b29
@ -90,9 +90,12 @@ pub fn fail_if<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the provided callback fails validation.
|
fn did_fill_error_scope<T>(
|
||||||
pub fn did_fail<T>(device: &wgpu::Device, callback: impl FnOnce() -> T) -> (bool, T) {
|
device: &wgpu::Device,
|
||||||
device.push_error_scope(wgpu::ErrorFilter::Validation);
|
callback: impl FnOnce() -> T,
|
||||||
|
filter: wgpu::ErrorFilter,
|
||||||
|
) -> (bool, T) {
|
||||||
|
device.push_error_scope(filter);
|
||||||
let result = callback();
|
let result = callback();
|
||||||
let validation_error = pollster::block_on(device.pop_error_scope());
|
let validation_error = pollster::block_on(device.pop_error_scope());
|
||||||
let failed = validation_error.is_some();
|
let failed = validation_error.is_some();
|
||||||
@ -100,6 +103,11 @@ pub fn did_fail<T>(device: &wgpu::Device, callback: impl FnOnce() -> T) -> (bool
|
|||||||
(failed, result)
|
(failed, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the provided callback fails validation.
|
||||||
|
pub fn did_fail<T>(device: &wgpu::Device, callback: impl FnOnce() -> T) -> (bool, T) {
|
||||||
|
did_fill_error_scope(device, callback, wgpu::ErrorFilter::Validation)
|
||||||
|
}
|
||||||
|
|
||||||
/// Adds the necessary main function for our gpu test harness.
|
/// Adds the necessary main function for our gpu test harness.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! gpu_test_main {
|
macro_rules! gpu_test_main {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user