Issue 159438
Summary [HLSL] Add _m and _<numeric> based accessors to hlsl::matrix.
Labels new issue
Assignees
Reporter farzonl
    ## Example
https://godbolt.org/z/Te74xc414
```hlsl
//------------------------------------------------------------------------------
// 5) Zero-based (._m<row><col>) and one-based (._<row><col>) point accessors
//    Works on matrices and returns a scalar element.
//------------------------------------------------------------------------------
float2x2 A_scalar = float2x2(1, 2,
                             3, 4);

export float fn() {
    float  z00 = A_scalar._m00;  // zero-based row=0 col=0
 float  z10 = A_scalar._m10;  // row=1 col=0
    float  o11 = A_scalar._11; // one-based row=1 col=1
    float  o21 = A_scalar._21;   // row=2 col=1 (if size allows)
    return z00 * z10 * o11 * o21;
}
```

## TODO
- [ ] Add functions to parse and validate matrix point accessors
- [ ] Modify SemaExprMember.cpp to handle matrix point accessors
- [ ]  Use `CheckExtVectorComponent` as an example
- [ ] Test the implementation

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to