Description
The SPIR-V backend does not enforce system-value semantic index limits, so -spirv silently accepts semantics that the DXIL path rejects. It's just a missing diagnostic rather than bad codegen; the index is discarded and the emitted module becomes the legal index-0 spelling.
Steps to Reproduce
// repro.hlsl
[shader("vertex")]
float4 main(uint vid : SV_VertexID) : SV_Position1 {
return float4((float)vid, 0.0, 0.0, 1.0);
}
dxc -T vs_6_8 -E main repro.hlsl -Fo repro.dxo # rejected
dxc -T vs_6_8 -E main -spirv repro.hlsl -Fo repro.spv # accepted
Actual Behavior
DXIL path errors as expected:
error: SV_Position semantic index exceeds maximum (0).
Validation failed.
SPIR-V path exits 0 with no diagnostic and emits the index-0 builtin, so the
1 is silently dropped:
OpDecorate %gl_Position BuiltIn Position
Other SVs behave the same way (SV_VertexID1, SV_Depth1, SV_DispatchThreadID1, SV_PrimitiveID1, ...). The once exception is SV_Target, since its bound is checked in the frontend rather than backend.
Description
The SPIR-V backend does not enforce system-value semantic index limits, so
-spirvsilently accepts semantics that the DXIL path rejects. It's just a missing diagnostic rather than bad codegen; the index is discarded and the emitted module becomes the legal index-0 spelling.Steps to Reproduce
Actual Behavior
DXIL path errors as expected:
SPIR-V path exits 0 with no diagnostic and emits the index-0 builtin, so the
1is silently dropped:Other SVs behave the same way (
SV_VertexID1,SV_Depth1,SV_DispatchThreadID1,SV_PrimitiveID1, ...). The once exception isSV_Target, since its bound is checked in the frontend rather than backend.