From ddabca8b7aa0ccdf9b01df61118ca3dffe9e6d95 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Mon, 18 Sep 2023 18:43:49 -0700 Subject: [PATCH] [shaders][msl] Enable `zero_initialize_workgroup_memory` setting Zero-initializing workgroup memory works around a Metal driver bug that can cause the tile_alloc and coarse stages to freeze up the system when running natively on Metal due to their use of `workgroupUniformLoad`. See gfx-rs/naga#2482 for more details about this bug. Zero-initializing workgroup memory also makes the native Metal shaders match the behavior of the current wgpu runner and the invariants of the original WGSL that the shaders were authored in. --- crates/shaders/src/compile/msl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/shaders/src/compile/msl.rs b/crates/shaders/src/compile/msl.rs index e02486ecf..4c7d2ccdd 100644 --- a/crates/shaders/src/compile/msl.rs +++ b/crates/shaders/src/compile/msl.rs @@ -43,7 +43,7 @@ pub fn translate(shader: &ShaderInfo) -> Result { spirv_cross_compatibility: false, fake_missing_bindings: false, bounds_check_policies: naga::proc::BoundsCheckPolicies::default(), - zero_initialize_workgroup_memory: false, + zero_initialize_workgroup_memory: true, }; let (source, _) = naga_msl::write_string( &shader.module,