summaryrefslogtreecommitdiffstats
path: root/include/slang.h
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-07-01 23:36:02 +0800
committerGitHub <noreply@github.com>2025-07-01 23:36:02 +0800
commitc94ca1692e101df87215232e87fa7edadc1a7b05 (patch)
treed84c5b27af4d88cd5bdd71358bc2434e8f47a1ce /include/slang.h
parentd50c3f34a2eda5bf5e278c78d32cc9923fd83b82 (diff)
Allow Link time constant array length sizing, warn on unsupported functionality (#7067)
* Add link time array layout test * Add link time constant array size compilation test * Link time constant array size test * Allow getting link time array size Closes https://github.com/shader-slang/slang/issues/6753 * format * Switch to SIMPLE test and check output * Implement without binary api changes * diagnose on link time constant sized array * fix test --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'include/slang.h')
-rw-r--r--include/slang.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/slang.h b/include/slang.h
index 782c4a082..4a3af7de1 100644
--- a/include/slang.h
+++ b/include/slang.h
@@ -2291,9 +2291,9 @@ struct TypeReflection
}
// only useful if `getKind() == Kind::Array`
- size_t getElementCount()
+ size_t getElementCount(SlangReflection* reflection = nullptr)
{
- return spReflectionType_GetElementCount((SlangReflectionType*)this);
+ return spReflectionType_GetSpecializedElementCount((SlangReflectionType*)this, reflection);
}
size_t getTotalArrayElementCount()
@@ -2454,6 +2454,8 @@ enum class BindingType : SlangBindingTypeIntegral
ExtMask = SLANG_BINDING_TYPE_EXT_MASK,
};
+struct ShaderReflection;
+
struct TypeLayoutReflection
{
TypeReflection* getType()
@@ -2543,7 +2545,10 @@ struct TypeLayoutReflection
}
// only useful if `getKind() == Kind::Array`
- size_t getElementCount() { return getType()->getElementCount(); }
+ size_t getElementCount(ShaderReflection* reflection = nullptr)
+ {
+ return getType()->getElementCount((SlangReflection*)reflection);
+ }
size_t getTotalArrayElementCount() { return getType()->getTotalArrayElementCount(); }