<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/150673>150673</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL][DirectX] Validation error seen when compiling code using D3DCOLORtoUBYTE4
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
spall
</td>
</tr>
</table>
<pre>
Seeing validation error when compiling this code:
```
StructuredBuffer<float4> In0 : register(t0);
RWStructuredBuffer<uint4> Out0 : register(u1);
[numthreads(1,1,1)]
void main() {
Out0[0] = D3DCOLORtoUBYTE4(In0[0]);
Out0[1] = D3DCOLORtoUBYTE4(float4(0, 11.11, -50.5, 100));
}
```
https://godbolt.org/z/oEsfTrTMr
```
Function: main: error: Assignment of undefined values to UAV.
# | note: at 'call void @dx.op.rawBufferStore.i32(i32 140, %dx.types.Handle %1, i32 1, i32 0, i32 undef, i32 2833, i32 0, i32 25500, i8 15, i32 4)' in block 'entry' of function 'main'.
# | Validation failed.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U8Fu4zYQ_ZrxhYhADUVLOugg2zF2gRQBNtm0PVLSyGZLkwZJJZt-fUFZ3g2cooAMj4Z8o5k376kQ9MESNSA3IHcrNcWj8004K2NWnRveG-DtE5G2B_aqjB5U1M4y8t559nYky3p3OmuTzuNRB9a7gUC0wFtY8-Xh7VP0Ux8nT8NmGkfyILajcSoWIO7ZV8sZiJZ5OugQyQNWkQPWIDapDG-__f4f-EnbC_xxip_wU_4Rnx65sdMpHj2pIQBWOeB2-dUgd8DbV6cHdlLaAlaANYNyQaf6IDcc5I6B2LGd2G0fHx6_Rfd98-fzfQFYfbXXGz8_u6Dy_0EtDGDFAbcsz7M8dcTuJM_knOEzCz8HKXc3rB5jPIdENu4B9wc3dM7EzPkD4P4fwL27D-Ozf_7NLxx8gO4n26dNJt7moUV7WWoK2lkUJ7KRuZFNdqBRWxqSACYKLDr2vX3JUkUUDMotsy6mpTMVGWDZK2PYTCcUfPiRuXPm1dtlcU_Recq0QMBKC2R5MQ8PKIcfWXw_U8i-KDsYSqmZjvnWNeDXYG7q-oKVEJ9uoJT88lKxXF6zxcxoybRlnXH936lfstG_p6Qb2bjwkvIXMZQfB335ZYFRaUND9pHX1dCIoRa1WlGTl1IU67Kq1qtjo-o1FSPWVTdIWY6lrLuK8k6WiON67HClG-QoeYkyr7Ao1lkhaqS1wL5Sed8VNRScTkqbzJjXU1rxSocwUZNLvi7FyqiOTJhNjGjpjc2ngJg87ZsEuuumQ4CCGx1i-FUm6mhm9395eHpIApabnfbUxz-Scl9uLR-I7K3vk-XZFFJ4q_LV5E1zI1Mdj1OX9e4EuE9tLH93Z-_-oj4C7ufmA-B-me61wX8DAAD__3aaW7Q">