From aadf6002783b88ea79c30a2f908270685b6c3d27 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 2 Oct 2020 09:49:18 -0700 Subject: Specialize exsitentials parameters in struct fields. (#1565) * Specialize exsitentials parameters in struct fields. * Cleanup. Co-authored-by: Yong He --- source/slang/slang-type-layout.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-type-layout.cpp') 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; -- cgit v1.2.3