summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-01-21 13:55:38 -0800
committerGitHub <noreply@github.com>2021-01-21 13:55:38 -0800
commitb762c75061dc93b24e21be78b84733dea71ea0b7 (patch)
treeb97f8bf1c042061a5b7f81a6c17c49ad54680cc6
parent6c8135fcd6c5ddb86ade74417e93383917d17cb2 (diff)
Fix reflection to correctly report descriptor ranges of `StructureBuffer`s of existential types. (#1667)
-rw-r--r--source/slang/slang-reflection-api.cpp16
1 files changed, 6 insertions, 10 deletions
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;
- }
}
}
};