summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 58bb7aaf2..4919850eb 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -23,6 +23,18 @@ IRType* getVectorElementType(IRType* type)
return vectorType->getElementType();
if (auto coopVecType = as<IRCoopVectorType>(type))
return coopVecType->getElementType();
+ if (auto coopMatType = as<IRCoopMatrixType>(type))
+ return coopMatType->getElementType();
+ return type;
+}
+
+IRType* getVectorOrCoopMatrixElementType(IRType* type)
+{
+ auto vectorElementType = getVectorElementType(type);
+ if (vectorElementType != type)
+ return vectorElementType;
+ if (auto coopMatrixType = as<IRCoopMatrixType>(type))
+ return coopMatrixType->getElementType();
return type;
}