diff options
Diffstat (limited to 'source/slang/slang-reflection-api.cpp')
| -rw-r--r-- | source/slang/slang-reflection-api.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 6f022cc90..eb1514f4c 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -1396,7 +1396,12 @@ namespace Slang // TypeLayout::ExtendedInfo::SubObjectRangeInfo subObjectRange; subObjectRange.bindingRangeIndex = bindingRangeIndex; - + subObjectRange.spaceOffset = 0; + if (kind == LayoutResourceKind::RegisterSpace) + { + auto resInfo = path->var->FindResourceInfo(LayoutResourceKind::RegisterSpace); + subObjectRange.spaceOffset = resInfo->index; + } // It is possible that the sub-object has descriptor ranges // that will need to be exposed upward, into the parent. // @@ -2010,6 +2015,24 @@ SLANG_API SlangInt spReflectionTypeLayout_getSubObjectRangeBindingRangeIndex(Sla return extTypeLayout->m_subObjectRanges[subObjectRangeIndex].bindingRangeIndex; } +SLANG_API SlangInt spReflectionTypeLayout_getSubObjectRangeSpaceOffset( + SlangReflectionTypeLayout* inTypeLayout, + SlangInt subObjectRangeIndex) +{ + auto typeLayout = convert(inTypeLayout); + if (!typeLayout) + return 0; + + auto extTypeLayout = Slang::getExtendedTypeLayout(typeLayout); + + if (subObjectRangeIndex < 0) + return 0; + if (subObjectRangeIndex >= extTypeLayout->m_subObjectRanges.getCount()) + return 0; + + return extTypeLayout->m_subObjectRanges[subObjectRangeIndex].spaceOffset; +} + #if 0 SLANG_API SlangInt spReflectionTypeLayout_getBindingRangeSubObjectRangeIndex(SlangReflectionTypeLayout* inTypeLayout, SlangInt index) |
