[DirectX] Invalid DXIL when writing to a RWTexture2DArray
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The following shader fails validation when compiled under `clang-dxc -T cs_6_0 -Fo test.o`
```hlsl
[[vk::binding(0, 0)]] RWTexture2DArray Out : register(u0);
[numthreads(5, 3, 2)]
void main(uint3 TID : SV_DispatchThreadID) {
Out[TID] = TID.z * 100.0 + TID.y * 10.0 + TID.x;
}
```
```
❯ bin/clang-dxc -T cs_6_8 test.hlsl -Fo test.o
test.hlsl:5:45: warning: implicit conversion from 'uint' (aka 'unsigned int') to 'float' may lose precision [-Wimplicit-int-float-conversion]
5 | Out[TID] = TID.z * 100.0 + TID.y * 10.0 + TID.x;
| ~ ^~~~~
test.hlsl:5:30: warning: implicit conversion from 'uint' (aka 'unsigned int') to 'float' may lose precision [-Wimplicit-int-float-conversion]
5 | Out[TID] = TID.z * 100.0 + TID.y * 10.0 + TID.x;
| ^~~~~ ~
test.hlsl:5:14: warning: implicit conversion from 'uint' (aka 'unsigned int') to 'float' may lose precision [-Wimplicit-int-float-conversion]
5 | Out[TID] = TID.z * 100.0 + TID.y * 10.0 + TID.x;
| ^~~~~ ~
3 warnings generated.
Function: main: error: Instructions must be of an allowed type.
note: at '%.upto035 = insertelement <3 x i32> undef, i32 %2, i32 0' in block 'entry' of function 'main'.
Function: main: error: Instructions must be of an allowed type.
note: at '%.upto146 = insertelement <3 x i32> %.upto035, i32 %3, i32 1' in block 'entry' of function 'main'.
Function: main: error: Instructions must be of an allowed type.
note: at '%5 = insertelement <3 x i32> %.upto146, i32 %4, i32 2' in block 'entry' of function 'main'.
Function: main: error: Instructions must be of an allowed type.
note: at '%7 = extractelement <3 x i32> %5, i64 0' in block 'entry' of function 'main'.
Function: main: error: Instructions must be of an allowed type.
note: at '%8 = extractelement <3 x i32> %5, i64 1' in block 'entry' of function 'main'.
Function: main: error: Instructions must be of an allowed type.
note: at '%9 = extractelement <3 x i32> %5, i64 2' in block 'entry' of function 'main'.
Validation failed.
clang-dxc: error: dxv command failed with exit code 1 (use -v to see invocation)
```
Contributor guide
Assessment
This issue has not been assessed yet.