From 618b4c7657f539e66f032cd40554798bc0d68f6d Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Sat, 1 Mar 2025 05:22:58 +0800 Subject: Resolve 'extern' types during type layout generation if possible (#6450) * Resolve 'extern' types during type layout generation if possible Closes https://github.com/shader-slang/slang/issues/5994 Closes https://github.com/shader-slang/slang/issues/6437 * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He --- source/slang/slang-parameter-binding.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang-parameter-binding.cpp') diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 0e47ff56d..86d76fc6d 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -2382,7 +2382,14 @@ static RefPtr processEntryPointVaryingParameter( // otherwise they will include all of the above cases... else if (auto declRefType = as(type)) { + // If we are trying to get the layout of some extern type, do our best + // to look it up in other loaded modules and generate the type layout + // based on that. + declRefType = context->layoutContext.lookupExternDeclRefType(declRefType); + auto declRef = declRefType->getDeclRef(); + + if (auto structDeclRef = declRef.as()) { RefPtr structLayout = new StructTypeLayout(); -- cgit v1.2.3