diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-reflection-api.cpp | 21 | ||||
| -rw-r--r-- | source/slang/slang-type-layout.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 714dc292f..8bcab8ada 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -1559,6 +1559,7 @@ namespace Slang TypeLayout::ExtendedInfo::BindingRangeInfo bindingRange; bindingRange.leafTypeLayout = typeLayout; + bindingRange.variable = path.primary ? path.primary->var->getVariable() : nullptr; bindingRange.bindingType = bindingType; bindingRange.count = multiplier; bindingRange.descriptorSetIndex = -1; @@ -1745,6 +1746,7 @@ namespace Slang // TypeLayout::ExtendedInfo::BindingRangeInfo bindingRange; bindingRange.leafTypeLayout = typeLayout; + bindingRange.variable = path.primary ? path.primary->var->getVariable() : nullptr; bindingRange.bindingType = SLANG_BINDING_TYPE_EXISTENTIAL_VALUE; bindingRange.count = multiplier; bindingRange.descriptorSetIndex = 0; @@ -1817,6 +1819,7 @@ namespace Slang // TypeLayout::ExtendedInfo::BindingRangeInfo bindingRange; bindingRange.leafTypeLayout = typeLayout; + bindingRange.variable = path.primary ? path.primary->var->getVariable() : nullptr; bindingRange.bindingType = bindingType; bindingRange.count = multiplier; bindingRange.descriptorSetIndex = 0; @@ -2016,6 +2019,24 @@ SLANG_API SlangReflectionTypeLayout* spReflectionTypeLayout_getBindingRangeLeafT return convert(bindingRange.leafTypeLayout); } +SLANG_API SlangReflectionVariable* spReflectionTypeLayout_getBindingRangeVariable( + SlangReflectionTypeLayout* inTypeLayout, SlangInt index) +{ + auto typeLayout = convert(inTypeLayout); + if (!typeLayout) + return 0; + + auto extTypeLayout = Slang::getExtendedTypeLayout(typeLayout); + if (index < 0) + return 0; + if (index >= extTypeLayout->m_bindingRanges.getCount()) + return 0; + auto& bindingRange = extTypeLayout->m_bindingRanges[index]; + + return convert(bindingRange.variable); +} + + SLANG_API SlangInt spReflectionTypeLayout_getBindingRangeDescriptorSetIndex(SlangReflectionTypeLayout* inTypeLayout, SlangInt index) { auto typeLayout = convert(inTypeLayout); diff --git a/source/slang/slang-type-layout.h b/source/slang/slang-type-layout.h index 82d333fa9..d66a77365 100644 --- a/source/slang/slang-type-layout.h +++ b/source/slang/slang-type-layout.h @@ -431,6 +431,7 @@ public: struct BindingRangeInfo { + VarDeclBase* variable; TypeLayout* leafTypeLayout; SlangBindingType bindingType; LayoutSize count; |
