When compiling HLSL that creates an array of structs with resource members and accesses them via constant indexing, DXC's SPIRV backend generates invalid SPIR-V:
fatal error: generated SPIR-V is invalid: The result pointer storage class and base pointer storage class in OpAccessChain do not match. %13 = OpAccessChain %_ptr_Uniform_uint %gBuf %uint_0 %uint_0
Repro:
RWByteAddressBuffer gBuf : register(u0);
struct BufStruct { RWByteAddressBuffer buf; };
[numthreads(1,1,1)]
void main() {
BufStruct s[2];
s[0].buf = gBuf;
s[0].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 creates an array of structs with resource members and accesses them via constant indexing, DXC's SPIRV backend generates invalid SPIR-V:
fatal error: generated SPIR-V is invalid: The result pointer storage class and base pointer storage class in OpAccessChain do not match. %13 = OpAccessChain %_ptr_Uniform_uint %gBuf %uint_0 %uint_0Repro:
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).