summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-base.cpp')
-rw-r--r--source/slang/slang-emit-base.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/slang-emit-base.cpp b/source/slang/slang-emit-base.cpp
index d00b723ab..0f1c54e70 100644
--- a/source/slang/slang-emit-base.cpp
+++ b/source/slang/slang-emit-base.cpp
@@ -52,4 +52,25 @@ IRVarLayout* SourceEmitterBase::getVarLayout(IRInst* var)
return as<IRVarLayout>(decoration->getLayout());
}
+BaseType SourceEmitterBase::extractBaseType(IRType* inType)
+{
+ auto type = inType;
+ for (;;)
+ {
+ if (auto irBaseType = as<IRBasicType>(type))
+ {
+ return irBaseType->getBaseType();
+ }
+ else if (auto vecType = as<IRVectorType>(type))
+ {
+ type = vecType->getElementType();
+ continue;
+ }
+ else
+ {
+ return BaseType::Void;
+ }
+ }
+}
+
}