DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[DXIL] Decorating CS float argument with SV_DispatchThreadID semantic crashes the compiler (float2, float3 and float4 works)

Open Dredhog opened this issue 4 years ago • 2 comments

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

  1. 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 avatar Feb 10 '21 12:02 Dredhog

@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.

vcsharma avatar Feb 26 '21 00:02 vcsharma

Reverted change resurfaced this bug

https://godbolt.org/z/r4e3jW1Y1

pow2clk avatar Sep 26 '23 15:09 pow2clk

With current DXC this crashes the compiler with:

error: cast<X>() argument of incompatible type!

For float, float2, float3 and float4.

damyanp avatar Jul 10 '24 17:07 damyanp