Skip to content

[HLSL][SPIRV] Invalid SPIRV produced when compiling code using D3DCOLORtoUBYTE4 #150678

@spall

Description

@spall

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.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:headersHeaders provided by Clang, e.g. for intrinsics

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions