From b762c75061dc93b24e21be78b84733dea71ea0b7 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 21 Jan 2021 13:55:38 -0800 Subject: Fix reflection to correctly report descriptor ranges of `StructureBuffer`s of existential types. (#1667) --- source/slang/slang-reflection-api.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 6d59761a4..2a3667295 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -1587,8 +1587,13 @@ namespace Slang // return; } - else if(resourceKindCount == 1) + else { + // `resourceKindCount` should be 1 in most cases. + // However if this field is a buffer of existential type, + // the resourceInfo array will contain additional ExistentialTypeParam + // and ExistentialObjectParam entries. These entries doesn't affect the + // logic here, so we only need to care about the first entry. auto& resInfo = typeLayout->resourceInfos[0]; LayoutResourceKind kind = resInfo.kind; @@ -1673,15 +1678,6 @@ namespace Slang m_extendedInfo->m_bindingRanges.add(bindingRange); } - else - { - // This type appears to be one that consumes multiple - // resource kinds, but was not handled by any of - // the special-case logic above. In such a case we - // are in trouble. - // - return; - } } } }; -- cgit v1.2.3