fixes #170777 If we don't use vector type and instead continue to pass on the matrix type when we enter `EmitExtVectorElementExpr` Then we don't need to store the row and column length on the LValue. Using the Matrix type means we can reuse the isMatrixRow() cases in EmitLoadOfLValue and EmitStoreThroughLValue and not have to support a new lValue that is a hybrid between the ExtVectorElt and MatrixRow cases. All we need to do to support this is pass the list of column indices as a `ConstantDataVector` and check the size of this Vector to know how many column iterations we need to do. Further just index into the vector to fetch the right encoded element index value.
17 lines
533 B
HLSL
17 lines
533 B
HLSL
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.4-library -finclude-default-header -verify %s
|
|
|
|
float2x3 gM;
|
|
|
|
void bad_index_type(float f) {
|
|
gM[f]; // expected-error {{matrix row index is not an integer}}
|
|
}
|
|
|
|
// 2 rows: valid row indices: 0, 1
|
|
void bad_constant_row_index() {
|
|
gM[2]; // expected-error {{matrix row index is outside the allowed range}}
|
|
}
|
|
|
|
float4 getMatrix(float3x3 M, int index) {
|
|
return M[index].rgba; // expected-error {{vector component access exceeds type 'vector<float, 3>' (vector of 3 'float' values)}}
|
|
}
|