When compiling HLSL that uses brace initialization to construct a struct containing a resource member, DXC's SPIRV backend generates invalid SPIR-V:
fatal error: generated SPIR-V is invalid: Expected Constituent type to be equal to the corresponding member type of Result Type struct %15 = OpCompositeConstruct %ResHolder_0 %Out
Repro:
RWByteAddressBuffer Out : register(u0);
struct ResHolder { RWByteAddressBuffer buf; };
[numthreads(1,1,1)]
void main() {
ResHolder h = {Out};
h.buf.Store(0, 42);
}
Command:
dxc.exe -spirv -fspv-target-env=vulkan1.3 -T cs_6_0 -Fo out.spv repro.hlsl
DXC DXIL compiles and runs this correctly. DXC version: main (built from source).
When compiling HLSL that uses brace initialization to construct a struct containing a resource member, DXC's SPIRV backend generates invalid SPIR-V:
fatal error: generated SPIR-V is invalid: Expected Constituent type to be equal to the corresponding member type of Result Type struct %15 = OpCompositeConstruct %ResHolder_0 %OutRepro:
Command:
dxc.exe -spirv -fspv-target-env=vulkan1.3 -T cs_6_0 -Fo out.spv repro.hlslDXC DXIL compiles and runs this correctly. DXC version: main (built from source).