From 8d67365b36ea43d339911eba5ee1693d75ae58e2 Mon Sep 17 00:00:00 2001 From: "James Helferty (NVIDIA)" Date: Wed, 17 Sep 2025 10:51:36 -0700 Subject: Diagnostic for metal ref mesh output assignment (#8365) When slang detects assignment to a mesh output reference on metal, generate a diagnostic message. (Metal mesh shader outputs must be assigned via 'set' instead of 'ref'.) Fixes #7498 --- .../diagnostics/metal-mesh-shader-output-ref.slang | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/diagnostics/metal-mesh-shader-output-ref.slang (limited to 'tests') diff --git a/tests/diagnostics/metal-mesh-shader-output-ref.slang b/tests/diagnostics/metal-mesh-shader-output-ref.slang new file mode 100644 index 000000000..45926b1f8 --- /dev/null +++ b/tests/diagnostics/metal-mesh-shader-output-ref.slang @@ -0,0 +1,22 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-target metal -entry meshMain + +struct VsOutput { + float4 pos : SV_Position; +}; + +[shader("mesh")] +[numthreads(1, 1, 1)] +[outputtopology("triangle")] +void meshMain(out vertices VsOutput verts[3], out indices uint3 tris[1]) +{ + SetMeshOutputCounts(3, 1); + + // Output vertices + for (uint i = 0; i < 3; i++) { +//CHECK: ([[# @LINE+1]]): error 56104 + verts[i].pos = float4(0.0); + } + + // Output indices + tris[0] = uint3(0, 1, 2); +} -- cgit v1.2.3