Skip to content

[DXIL] Broken codegen for loading elements from FP16 matrix types in StructuredBuffer #4492

@pclarberg

Description

@pclarberg

On latest main I get the wrong result when loading elements from fp16 matrix types stored in structured buffers.

struct Data
{
    float16_t4x4 a;
};

StructuredBuffer<Data> buf : register(t1);

...
float16_t2 b = buf.a[0].xy;

This loads elements a[0][0] and a[0][2], not a[0][1] as expected.
Looking at the generated code it looks like it thinks there is 4B between each element not 2B.

See attached example HLSL and generated DXIL.
dxc-float16_t4x4-example.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashcorrectnessBugs that impact shader correctnessmatrix-bugBugs relating to matrix types

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions