From c16fc84a0071892ea0f4e3c5c70aa101e6400aec Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 26 Jun 2017 09:07:07 -0700 Subject: Include imported code when generating reflection data - The basic idea is simple: be sure to enumerate code in `__import`ed modules when generating reflection info - Note that we don't currently allow an entry point to appear in an imported module, so we only consider globlal-scope parameters - Although there isn't currently a real implementation of namespacing, I went ahead and ensured that parameters in imported modules are treated as distinct from parameters in the user's code, even if they have the same name. --- source/slang/type-layout.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source/slang/type-layout.cpp') diff --git a/source/slang/type-layout.cpp b/source/slang/type-layout.cpp index 3427d6a6f..8b8a2b437 100644 --- a/source/slang/type-layout.cpp +++ b/source/slang/type-layout.cpp @@ -632,9 +632,20 @@ createParameterBlockTypeLayout( RefPtr elementTypeLayout, LayoutRulesImpl* rules) { - auto info = getParameterBlockLayoutInfo( - parameterBlockType, - rules); + SimpleLayoutInfo info; + if (parameterBlockType) + { + info = getParameterBlockLayoutInfo( + parameterBlockType, + rules); + } + else + { + // If there is no concrete type, then it seems like we are + // being asked to compute layout for the global scope + info = rules->GetObjectLayout(ShaderParameterKind::ConstantBuffer); + } + auto typeLayout = new ParameterBlockTypeLayout(); -- cgit v1.2.3