diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index 7976a024a..39479f734 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -279,6 +279,7 @@ impl Writer { let mut needs_dual_source_blending = false; let mut needs_clip_distances = false; let mut needs_mesh_shaders = false; + let mut needs_cooperative_matrix = false; // Determine which `enable` declarations are needed for (_, ty) in module.types.iter() { @@ -322,6 +323,9 @@ impl Writer { } } } + TypeInner::CooperativeMatrix { .. } => { + needs_cooperative_matrix = true; + } _ => {} } } @@ -360,6 +364,10 @@ impl Writer { writeln!(self.out, "enable wgpu_mesh_shader;")?; any_written = true; } + if needs_cooperative_matrix { + writeln!(self.out, "enable wgpu_cooperative_matrix;")?; + any_written = true; + } if any_written { // Empty line for readability writeln!(self.out)?; diff --git a/naga/tests/out/wgsl/wgsl-cooperative-matrix.wgsl b/naga/tests/out/wgsl/wgsl-cooperative-matrix.wgsl index 183dc84ad..2311861ee 100644 --- a/naga/tests/out/wgsl/wgsl-cooperative-matrix.wgsl +++ b/naga/tests/out/wgsl/wgsl-cooperative-matrix.wgsl @@ -1,3 +1,5 @@ +enable wgpu_cooperative_matrix; + var a: coop_mat8x8; var b: coop_mat8x8; @group(0) @binding(0)