summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-diagnostic-defs.h6
-rw-r--r--source/slang/slang-ir-metal-legalize.cpp3
-rw-r--r--tests/diagnostics/metal-mesh-shader-output-ref.slang22
3 files changed, 30 insertions, 1 deletions
diff --git a/source/slang/slang-diagnostic-defs.h b/source/slang/slang-diagnostic-defs.h
index 1f2fdd693..08e852547 100644
--- a/source/slang/slang-diagnostic-defs.h
+++ b/source/slang/slang-diagnostic-defs.h
@@ -2960,12 +2960,16 @@ DIAGNOSTIC(
Error,
divisionByMatrixNotSupported,
"division by matrix is not supported for Metal and WGSL targets.")
-
DIAGNOSTIC(
56103,
Error,
int16NotSupportedInWGSL,
"16-bit integer type '$0' is not supported by the WGSL backend.")
+DIAGNOSTIC(
+ 56104,
+ Error,
+ assignToRefNotSupported,
+ "whole struct must be assiged to mesh output at once for Metal target.")
DIAGNOSTIC(57001, Warning, spirvOptFailed, "spirv-opt failed. $0")
DIAGNOSTIC(57002, Error, unknownPatchConstantParameter, "unknown patch constant parameter '$0'.")
diff --git a/source/slang/slang-ir-metal-legalize.cpp b/source/slang/slang-ir-metal-legalize.cpp
index 116feeab4..fd950b91a 100644
--- a/source/slang/slang-ir-metal-legalize.cpp
+++ b/source/slang/slang-ir-metal-legalize.cpp
@@ -214,6 +214,9 @@ static void processInst(IRInst* inst, DiagnosticSink* sink)
case kIROp_Leq:
legalizeBinaryOp(inst, sink, CodeGenTarget::Metal);
break;
+ case kIROp_MeshOutputRef:
+ sink->diagnose(getDiagnosticPos(inst), Diagnostics::assignToRefNotSupported);
+ break;
case kIROp_MetalCastToDepthTexture:
{
// If the operand is already a depth texture, don't do anything.
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);
+}