diff options
| author | James Helferty (NVIDIA) <jhelferty@nvidia.com> | 2025-09-17 10:51:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-17 17:51:36 +0000 |
| commit | 8d67365b36ea43d339911eba5ee1693d75ae58e2 (patch) | |
| tree | 4007b3634618b1f64a0d9473394f4cc20fef24ab /source/slang | |
| parent | 570277137a2baa658ccad78487858205873398da (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 'source/slang')
| -rw-r--r-- | source/slang/slang-diagnostic-defs.h | 6 | ||||
| -rw-r--r-- | source/slang/slang-ir-metal-legalize.cpp | 3 |
2 files changed, 8 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. |
