diff options
Diffstat (limited to 'source/slang/slang-check-conversion.cpp')
| -rw-r--r-- | source/slang/slang-check-conversion.cpp | 22 |
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. // |
