diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 4e8a00907..6385e5f57 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1069,6 +1069,23 @@ namespace Slang validateArraySizeForVariable(varDecl); } + // If there is a matrix layout modifier, we will modify the matrix type now. + if (auto matrixType = as<MatrixExpressionType>(varDecl->type.type)) + { + if (auto matrixLayoutModifier = varDecl->findModifier<MatrixLayoutModifier>()) + { + auto matrixLayout = as<ColumnMajorLayoutModifier>(matrixLayoutModifier) ? SLANG_MATRIX_LAYOUT_COLUMN_MAJOR : SLANG_MATRIX_LAYOUT_ROW_MAJOR; + auto newMatrixType = getASTBuilder()->getMatrixType( + matrixType->getElementType(), + matrixType->getRowCount(), + matrixType->getColumnCount(), + getASTBuilder()->getIntVal(getASTBuilder()->getIntType(), matrixLayout)); + varDecl->type.type = newMatrixType; + if (varDecl->initExpr) + varDecl->initExpr = coerce(CoercionSite::Initializer, varDecl->type, varDecl->initExpr); + } + } + checkMeshOutputDecl(varDecl); // The NVAPI library allows user code to express extended operations |
