Skip to content

Commit

Permalink
[shaders][msl] Enable zero_initialize_workgroup_memory setting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
armansito committed Sep 22, 2023
1 parent 24e8cdc commit ddabca8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/shaders/src/compile/msl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn translate(shader: &ShaderInfo) -> Result<String, naga_msl::Error> {
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,
Expand Down

0 comments on commit ddabca8

Please sign in to comment.