summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorJames Helferty (NVIDIA) <jhelferty@nvidia.com>2025-09-17 10:51:36 -0700
committerGitHub <noreply@github.com>2025-09-17 17:51:36 +0000
commit8d67365b36ea43d339911eba5ee1693d75ae58e2 (patch)
tree4007b3634618b1f64a0d9473394f4cc20fef24ab /tests/diagnostics
parent570277137a2baa658ccad78487858205873398da (diff)
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
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/metal-mesh-shader-output-ref.slang22
1 files changed, 22 insertions, 0 deletions
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);
+}