diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/slang-deprecated.h | 10 | ||||
| -rw-r--r-- | include/slang.h | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/include/slang-deprecated.h b/include/slang-deprecated.h index 2ae91c6d8..f210e8c48 100644 --- a/include/slang-deprecated.h +++ b/include/slang-deprecated.h @@ -478,9 +478,19 @@ extern "C" If the size of a type cannot be statically computed, perhaps because it depends on a generic parameter that has not been bound to a specific value, this function returns zero. + + Use spReflectionType_GetSpecializedElementCount if the size is dependent on + a link time constant */ SLANG_API size_t spReflectionType_GetElementCount(SlangReflectionType* type); + /** The same as spReflectionType_GetElementCount except it takes into account specialization + * information from the given reflection info + */ + SLANG_API size_t spReflectionType_GetSpecializedElementCount( + SlangReflectionType* type, + SlangReflection* reflection); + SLANG_API SlangReflectionType* spReflectionType_GetElementType(SlangReflectionType* type); SLANG_API unsigned int spReflectionType_GetRowCount(SlangReflectionType* type); 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(); } |
