Skip to content

[HLSL] Clang needs to support single subscript operators on matrix type #166206

@farzonl

Description

@farzonl

Today clang will error with error: single subscript expressions are not allowed for matrix values.
But DXC does a vector load
https://hlsl.godbolt.org/z/PM46xW89v

RWStructuredBuffer<int> In;
RWStructuredBuffer<int> Out;
cbuffer Constants {
    uint row;
    uint col;
};
[numthreads(1, 1, 1)]
void CSMain(uint GI : SV_GroupIndex) {
    int2x3 M = int2x3(0, 1, 2, 
                      3, 4, 5);
    Out[0] = M[row].x;
}

The fix is likely that we need a new AST type to allow for single subscript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Support

    Projects

    Status

    Planning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions