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.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index c753600a7..d05e1db7d 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -1973,4 +1973,17 @@ IRType* getIRVectorBaseType(IRType* type)
return as<IRVectorType>(type)->getElementType();
}
+Int getSpecializationConstantId(IRGlobalParam* param)
+{
+ auto layout = findVarLayout(param);
+ if (!layout)
+ return 0;
+
+ auto offset = layout->findOffsetAttr(LayoutResourceKind::SpecializationConstant);
+ if (!offset)
+ return 0;
+
+ return offset->getOffset();
+}
+
} // namespace Slang