<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/150678>150678</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL][SPIRV] Invalid SPIRV produced 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 the following 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/47WrPdhav
```
Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282
# | vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
# | Specialization constant operation Bitcast requires Kernel capability
# | %43 = OpSpecConstantOp %uint Bitcast %38
```

This `%42 = OpSpecConstantOp %3 Bitcast %37` requires the Kernel capability, but HLSL does not support Kernel SPIRV.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VN-P2zYM_muYFyGBTFm278EP-XHBgl2R4tJesUfZYhKtiuVJcm7tXz_ISe-ydCugIJbE7yM_iqQKwRw6ohrkAuRqooZ4dL4OvbJ20jj9rd4Rme7A4pHY3lnrXtPurKzRKhrXMfLeefZ6pI617tQbe7E2gbVOE_A5FPy6-HwX_dDGwZNeDPs9eRDLvXUq5iAe2abjDMSceTqYEMkDVpEDPoBYJBo-f_7yH_jBdBf4dog_4YfsFp-WXHTDKR49KR0Aqwxwef09gFwBn5-d0eykTAdYAT4wKK_oxA9ywUGuGIgVW4nVcvu0fY7u8-KPT485YLXpfli8ub2isl-grhnAigMuWZbNshQRm0o-k-MJH7PwJqRc3WX1GGMfQMwB14Drg9ONs3Hm_AFw_R1wnZdf_Ed9VOc73Mv7Kz6mV0zJA7lgL583q-nL191RafIfnB4sLT2pSJtu76b90mma8qoUJRtVlUv2gUJQB9pcNPK_lSxQYoXJIYrR5Pz1wnHLeklxctvfOADxOPpggFXojT9Pz8qy3js9tKSZutbcBXnjYddTa5Q13y-SWteFqLrIXE_-crQwsVUhMk9_DcZTYL-T78iyVvWqMdbEbzd0gDIXo55tn6iXV75tn65S2b3xAUpR3SUX-PxT6oK0Q5nj_zKJf9GUUPD3-FLX_RwjLlkzRPbb0-6JaUeBdS6yMPS98_GH-e7j5vllNtG10A_iQU2ozkop8qIqsZgca8qzrGx5XmjNscykxnIvmrxtRZHLMttPTI0cJS9RZpWo8mKWc2xQkWr2RUYFFpBzOiljZ9aeT6nYJiaEgepM8qKsJlY1ZMM4VhA7emXjLSCmKePrBJo2wyFAzq0JMbzTRBPtOI-SvtRKcjGKSbW26cbJc1H3XhJ30ycNHjaE9HnfbpPB2_quX0w8Ds2sdSfAdYri-jftvfuT2gi4HmMPgOuruHON_wQAAP__At-U3A">