Skip to content

[SPIRV] "Cannot load a runtime-sized array" when initializing local resource via comma expression #8383

@bob80905

Description

@bob80905

When compiling HLSL that uses a comma expression to initialize a local resource variable, DXC's SPIRV backend generates invalid SPIR-V:

fatal error: generated SPIR-V is invalid: Cannot load a runtime-sized array %13 = OpLoad %type_RWByteAddressBuffer %gBuf1

Repro:

RWByteAddressBuffer gBuf0 : register(u0); 
RWByteAddressBuffer gBuf1 : register(u1);

[numthreads(1,1,1)] void main() {  
RWByteAddressBuffer buf = (gBuf0, gBuf1);  
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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions