From 661d6198bbb9857d3fdc6df477e0742ed0b0765c Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 14 Aug 2023 16:23:19 -0700 Subject: Support per field matrix layout (#3101) * Support per field matrix layout * Fix warnings. * Fix. * Fix tests. * Fix spiv gen. * Fix. * More test fixes. * Fix. * Run only GPU tests on self-hosted servers. * Remove -use-glsl-matrix-layout-modifier. * Fix. --------- Co-authored-by: Yong He --- source/slang/slang-ast-builder.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/slang/slang-ast-builder.cpp') 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(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(rowCount)) + { + rowCount = getIntVal(getIntType(), rowCountConstantInt->getValue()); + } + if (auto colCountConstantInt = as(colCount)) + { + colCount = getIntVal(getIntType(), colCountConstantInt->getValue()); + } + Val* args[] = { elementType, rowCount, colCount, layout }; + return as(getSpecializedBuiltinType(makeArrayView(args), "MatrixExpressionType")); +} + DifferentialPairType* ASTBuilder::getDifferentialPairType( Type* valueType, Witness* primalIsDifferentialWitness) -- cgit v1.2.3