Skip to content

[SPIRV] "casting to type 'RWByteAddressBuffer' unimplemented" when using ternary/phi with local resources #8381

@bob80905

Description

@bob80905

When compiling HLSL that uses a ternary expression to select between two global resources and assign to a local resource variable, DXC's SPIRV backend emits:

error: casting to type 'RWByteAddressBuffer' unimplemented

Repro:

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

[numthreads(1,1,1)] 
void main() {  
  RWByteAddressBuffer buf = (true ? gBuf0 : gBuf1); 
  buf.Store(0, 42);
}

Command:

dxc.exe -spirv -fspv-target-env=vulkan1.3 -T cs_6_0 -Fo out.spv repro.hlsl

This also reproduces with nested if/else phi patterns (e.g. buf = false ? gBuf0 : gBuf1 inside an if block). DXC DXIL and Clang DXIL both compile this successfully. 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