DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
[DXIL] Decorating CS float argument with SV_DispatchThreadID semantic crashes the compiler (float2, float3 and float4 works)
Title
[DXIL] Decorating CS float argument with SV_DispatchThreadID semantic crashes the compiler (float2, float3 and float4 works)
Functional impact
Compiler crashes
Minimal repro steps
- Compile the following shader with
dxc.exe -T cs_6_0 -E CSMain issue_shader.txt
:
RWStructuredBuffer<float4> rwTexture;
[numthreads(1, 1, 1)]
void CSMain(float id : SV_DispatchThreadID)
{
rwTexture[3] = id.xxxx;
}
Expected result
Shader compiles correctly, as it does for vector float arguments: float2
, float3
, float4
Actual result
Compiler crashes
Further technical details
Ran test on shader playground with DXC from 2020 12 16 The SPIR-V backend produces validation errors (reported here https://github.com/microsoft/DirectXShaderCompiler/issues/3443 )
@Dredhog Thanks for reporting this crash. The compiler was lacking in the area of checking for unsupported types for SV semantics that lead to random crashes reported here or in #2954. We expect to soon deploy a change #3043 which would start reporting compilation error for unsupported types.
Reverted change resurfaced this bug
https://godbolt.org/z/r4e3jW1Y1
With current DXC this crashes the compiler with:
error: cast<X>() argument of incompatible type!
For float, float2, float3 and float4.