mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 00:41:07 +01:00
refactor: extract did_fill_error_scope test helper from did_fail
This commit is contained in:
1 parent
964c5bbf4c
commit
43eee99b29
1 file changed
+11
-3
+11
-3
@@ -90,9 +90,12 @@ 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);
|
||||
fn did_fill_error_scope<T>(
|
||||
device: &wgpu::Device,
|
||||
callback: impl FnOnce() -> T,
|
||||
filter: wgpu::ErrorFilter,
|
||||
) -> (bool, T) {
|
||||
device.push_error_scope(filter);
|
||||
let result = callback();
|
||||
let validation_error = pollster::block_on(device.pop_error_scope());
|
||||
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)
|
||||
}
|
||||
|
||||
/// 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.
|
||||
#[macro_export]
|
||||
macro_rules! gpu_test_main {
|
||||
|
||||
Reference in new issue
Block a user