summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-conversion.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-14 16:23:19 -0700
committerGitHub <noreply@github.com>2023-08-14 16:23:19 -0700
commit661d6198bbb9857d3fdc6df477e0742ed0b0765c (patch)
tree974a57cfa2e43624e91502e9e652a0cc78105b3a /source/slang/slang-check-conversion.cpp
parent0403e0556b470f6b316153caea2dc6f5c314da5b (diff)
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 <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-conversion.cpp')
-rw-r--r--source/slang/slang-check-conversion.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp
index 09a783fb4..5a9c8df12 100644
--- a/source/slang/slang-check-conversion.cpp
+++ b/source/slang/slang-check-conversion.cpp
@@ -894,6 +894,28 @@ namespace Slang
}
return true;
}
+ // matrix type with different layouts are convertible
+ if (auto fromMatrixType = as<MatrixExpressionType>(fromType))
+ {
+ if (auto toMatrixType = as<MatrixExpressionType>(toType))
+ {
+ if (fromMatrixType->getElementType()->equals(toMatrixType->getElementType()) &&
+ fromMatrixType->getRowCount()->equals(toMatrixType->getRowCount()) &&
+ fromMatrixType->getColumnCount()->equals(toMatrixType->getColumnCount()))
+ {
+ if (outCost)
+ {
+ *outCost = kConversionCost_MatrixLayout;
+ }
+ if (outToExpr)
+ {
+ *outToExpr = fromExpr;
+ }
+ return true;
+ }
+ }
+
+ }
// A type is always convertible to any of its supertypes.
//