Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/features/src/ray_cube_compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};
2 changes: 1 addition & 1 deletion examples/features/src/ray_cube_fragment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};
2 changes: 1 addition & 1 deletion examples/features/src/ray_scene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};
2 changes: 1 addition & 1 deletion examples/features/src/ray_shadows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};
2 changes: 1 addition & 1 deletion examples/features/src/ray_traced_triangle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};
8 changes: 7 additions & 1 deletion tests/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions tests/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
}
}
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/wgpu-gpu/ray_tracing/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion wgpu-types/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,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
}
}
Expand Down
Loading