Skip to content

[SPIRV] Invalid OpCompositeConstruct when aggregate-initializing struct with resource member #8382

@bob80905

Description

@bob80905

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).

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