summaryrefslogtreecommitdiff
path: root/source/slang/slang-reflection-api.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-reflection-api.cpp')
-rw-r--r--source/slang/slang-reflection-api.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp
index 52047a751..9295bfdf6 100644
--- a/source/slang/slang-reflection-api.cpp
+++ b/source/slang/slang-reflection-api.cpp
@@ -3164,6 +3164,22 @@ SLANG_API bool spReflectionVariable_HasDefaultValue(SlangReflectionVariable* inV
return false;
}
+SLANG_API SlangResult
+spReflectionVariable_GetDefaultValueInt(SlangReflectionVariable* inVar, int64_t* rs)
+{
+ auto decl = convert(inVar).getDecl();
+ if (auto varDecl = as<VarDeclBase>(decl))
+ {
+ if (auto constantVal = as<ConstantIntVal>(varDecl->val))
+ {
+ *rs = constantVal->getValue();
+ return 0;
+ }
+ }
+
+ return SLANG_E_INVALID_ARG;
+}
+
SLANG_API SlangReflectionGeneric* spReflectionVariable_GetGenericContainer(
SlangReflectionVariable* var)
{