mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-30 10:03:58 +01:00
Enable ray tracing example tests on metal (#9324)
This commit is contained in:
1 parent
948b1a6c66
commit
daced7acb9
9 files changed
+29
-8
No files matched your search
@@ -471,7 +471,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
|
||||
optional_features: wgpu::Features::default(),
|
||||
base_test_parameters: wgpu_test::TestParameters::default()
|
||||
// https://github.com/gfx-rs/wgpu/issues/9100
|
||||
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
|
||||
.disable_mtl_shader_validation(),
|
||||
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
|
||||
_phantom: std::marker::PhantomData::<Example>,
|
||||
};
|
||||
@@ -357,7 +357,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
|
||||
optional_features: wgpu::Features::default(),
|
||||
base_test_parameters: wgpu_test::TestParameters::default()
|
||||
// https://github.com/gfx-rs/wgpu/issues/9100
|
||||
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
|
||||
.disable_mtl_shader_validation(),
|
||||
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
|
||||
_phantom: std::marker::PhantomData::<Example>,
|
||||
};
|
||||
@@ -537,7 +537,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
|
||||
optional_features: wgpu::Features::default(),
|
||||
base_test_parameters: wgpu_test::TestParameters::default()
|
||||
// https://github.com/gfx-rs/wgpu/issues/9100
|
||||
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
|
||||
.disable_mtl_shader_validation(),
|
||||
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
|
||||
_phantom: std::marker::PhantomData::<Example>,
|
||||
};
|
||||
@@ -354,7 +354,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
|
||||
optional_features: wgpu::Features::default(),
|
||||
base_test_parameters: wgpu_test::TestParameters::default()
|
||||
// https://github.com/gfx-rs/wgpu/issues/9100
|
||||
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
|
||||
.disable_mtl_shader_validation(),
|
||||
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
|
||||
_phantom: std::marker::PhantomData::<Example>,
|
||||
};
|
||||
@@ -440,7 +440,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
|
||||
optional_features: wgpu::Features::default(),
|
||||
base_test_parameters: wgpu_test::TestParameters::default()
|
||||
// https://github.com/gfx-rs/wgpu/issues/9100
|
||||
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
|
||||
.disable_mtl_shader_validation(),
|
||||
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
|
||||
_phantom: std::marker::PhantomData::<Example>,
|
||||
};
|
||||
+7
-1
@@ -62,9 +62,15 @@ impl NativeTest {
|
||||
|
||||
let env_value = if metal_validation { "1" } else { "0" };
|
||||
std::env::set_var("MTL_DEBUG_LAYER", env_value);
|
||||
if std::env::var("GITHUB_ACTIONS").as_deref() != Ok("true") {
|
||||
if std::env::var("GITHUB_ACTIONS").as_deref() != Ok("true")
|
||||
&& !config.params.disable_mtl_shader_validation
|
||||
{
|
||||
// Metal Shader Validation is entirely broken in the paravirtualized CI environment.
|
||||
std::env::set_var("MTL_SHADER_VALIDATION", env_value);
|
||||
} else if config.params.disable_mtl_shader_validation {
|
||||
// For ray tracing, where MTL_SHADER_VALIDATION causes acceleration structure ids to be
|
||||
// completely incorrect.
|
||||
std::env::set_var("MTL_SHADER_VALIDATION", "0");
|
||||
}
|
||||
|
||||
execute_test(Some(&adapter_report), config, Some(test_info)).await;
|
||||
|
||||
@@ -31,6 +31,10 @@ pub struct TestParameters {
|
||||
|
||||
/// Conditions under which this test should be run, but is expected to fail.
|
||||
pub failures: Vec<FailureCase>,
|
||||
|
||||
/// For certain features (ray tracing), metal shader validation is completely
|
||||
/// broken
|
||||
pub disable_mtl_shader_validation: bool,
|
||||
}
|
||||
|
||||
impl Default for TestParameters {
|
||||
@@ -45,6 +49,7 @@ impl Default for TestParameters {
|
||||
// parameters ask us to remove it.
|
||||
skips: vec![FailureCase::backend(wgpu::Backends::NOOP)],
|
||||
failures: Vec::new(),
|
||||
disable_mtl_shader_validation: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,6 +111,15 @@ impl TestParameters {
|
||||
.retain(|case| *case != FailureCase::backend(wgpu::Backends::NOOP));
|
||||
self
|
||||
}
|
||||
|
||||
/// Disable metal shader validation.
|
||||
///
|
||||
/// Metal shader validation can cause features (ray tracing specifically)
|
||||
/// to break. This disables it so it can be tested.
|
||||
pub fn disable_mtl_shader_validation(mut self) -> Self {
|
||||
self.disable_mtl_shader_validation = true;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about a test, including if if it should be skipped.
|
||||
|
||||
@@ -115,7 +115,7 @@ static PREVENT_INVALID_RAY_QUERY_CALLS: GpuTestConfiguration = GpuTestConfigurat
|
||||
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
|
||||
// Otherwise, mistakes in the generated code won't be caught.
|
||||
.instance_flags(InstanceFlags::GPU_BASED_VALIDATION)
|
||||
// not yet implemented in directx12
|
||||
// not yet implemented in metal
|
||||
.skip(FailureCase::backend(Backends::METAL)),
|
||||
)
|
||||
.run_sync(prevent_invalid_ray_query_calls);
|
||||
|
||||
@@ -725,7 +725,8 @@ impl Limits {
|
||||
max_blas_geometry_count: (1 << 24) - 1, // 2^24 - 1: Vulkan's minimum
|
||||
max_tlas_instance_count: (1 << 24) - 1, // 2^24 - 1: Vulkan's minimum
|
||||
max_blas_primitive_count: 1 << 28, // 2^28: Metal's minimum
|
||||
max_acceleration_structures_per_shader_stage: 16, // Vulkan's minimum
|
||||
// On metal acceleration structures are limited because they share buffer slots
|
||||
max_acceleration_structures_per_shader_stage: 1,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user