summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
-rw-r--r--source/slang/slang-ast-builder.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp
index bb4f53433..a76f6e07f 100644
--- a/source/slang/slang-ast-builder.cpp
+++ b/source/slang/slang-ast-builder.cpp
@@ -383,6 +383,21 @@ VectorExpressionType* ASTBuilder::getVectorType(
return as<VectorExpressionType>(getSpecializedBuiltinType(makeArrayView(args), "VectorExpressionType"));
}
+MatrixExpressionType* ASTBuilder::getMatrixType(Type* elementType, IntVal* rowCount, IntVal* colCount, IntVal* layout)
+{
+ // Canonicalize constant size arguments to int.
+ if (auto rowCountConstantInt = as<ConstantIntVal>(rowCount))
+ {
+ rowCount = getIntVal(getIntType(), rowCountConstantInt->getValue());
+ }
+ if (auto colCountConstantInt = as<ConstantIntVal>(colCount))
+ {
+ colCount = getIntVal(getIntType(), colCountConstantInt->getValue());
+ }
+ Val* args[] = { elementType, rowCount, colCount, layout };
+ return as<MatrixExpressionType>(getSpecializedBuiltinType(makeArrayView(args), "MatrixExpressionType"));
+}
+
DifferentialPairType* ASTBuilder::getDifferentialPairType(
Type* valueType,
Witness* primalIsDifferentialWitness)