summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-reflection.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-10-14 13:55:45 -0700
committerGitHub <noreply@github.com>2020-10-14 13:55:45 -0700
commit4375cebc68d757238f3129f2472ec863dabc526b (patch)
tree97d155d86a9e9b1f759da22a044d0d653c0e696c /source/slang/slang-reflection.cpp
parent9cb31747782d07111ded70664d46da4f568bea2f (diff)
Add reflection API access to global params type layout (#1577)
This change adds a single new entry point to our reflection API that allows an application to query the `TypeLayout` that represents the global-scope shader parameters. This can be used by the application in order to detect when the global parameters have required allocation of a default constant buffer, or simply to unify the handling of the global scope with handling of other kinds of parameters.
Diffstat (limited to 'source/slang/slang-reflection.cpp')
-rw-r--r--source/slang/slang-reflection.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 1daec501d..1b0a590cc 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -1560,3 +1560,12 @@ SLANG_API int spComputeStringHash(const char* chars, size_t count)
{
return (int)getStableHashCode32(chars, count);
}
+
+SLANG_API SlangReflectionTypeLayout* spReflection_getGlobalParamsTypeLayout(
+ SlangReflection* reflection)
+{
+ auto programLayout = convert(reflection);
+ if(!programLayout) return nullptr;
+
+ return convert(programLayout->parametersLayout->typeLayout);
+}