summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-type-layout.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-10-02 09:49:18 -0700
committerGitHub <noreply@github.com>2020-10-02 09:49:18 -0700
commitaadf6002783b88ea79c30a2f908270685b6c3d27 (patch)
tree890d60ea78a81b35fa9ad28873bbe25c1fc7f9a4 /source/slang/slang-type-layout.cpp
parent274c20a5eb133779a9d890ca79120815fb92b04e (diff)
Specialize exsitentials parameters in struct fields. (#1565)
* Specialize exsitentials parameters in struct fields. * Cleanup. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-type-layout.cpp')
-rw-r--r--source/slang/slang-type-layout.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index 88ec5f4f7..33bdb4ef4 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -2536,8 +2536,19 @@ createStructuredBufferTypeLayout(
typeLayout->addResourceUsage(info.kind, info.size);
}
+ // If element type contains existential type params and object params,
+ // we need to propagate them through the StructuredBufferLayout.
+ if (auto existentialTypeInfo = elementTypeLayout->FindResourceInfo(LayoutResourceKind::ExistentialTypeParam))
+ {
+ typeLayout->addResourceUsage(existentialTypeInfo->kind, existentialTypeInfo->count);
+ }
+ if (auto existentialObjInfo = elementTypeLayout->FindResourceInfo(LayoutResourceKind::ExistentialObjectParam))
+ {
+ typeLayout->addResourceUsage(existentialObjInfo->kind, existentialObjInfo->count);
+ }
+
// Note: for now we don't deal with the case of a structured
- // buffer that might contain anything other than "uniform" data,
+ // buffer that might contain any other resource types,
// because there really isn't a way to implement that.
return typeLayout;