diff options
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
| -rw-r--r-- | source/slang/slang-parameter-binding.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 825e0f4af..55c487e4e 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -712,6 +712,15 @@ RefPtr<TypeLayout> getTypeLayoutForGlobalShaderParameter( return createTypeLayoutWith(layoutContext, specializationConstantRule, type); } + if (varDecl->hasModifier<InModifier>()) + { + return createTypeLayoutWith(layoutContext, rules->getVaryingInputRules(), type); + } + else if (varDecl->hasModifier<OutModifier>()) + { + return createTypeLayoutWith(layoutContext, rules->getVaryingOutputRules(), type); + } + // TODO(tfoley): there may be other cases that we need to handle here // An "ordinary" global variable is implicitly a uniform @@ -1120,6 +1129,25 @@ static void addExplicitParameterBindings_GLSL( return; } + if (auto foundVaryingInput = typeLayout->FindResourceInfo(LayoutResourceKind::VaryingInput)) + { + info[kResInfo].resInfo = foundVaryingInput; + + if (auto layoutAttr = varDecl.getDecl()->findModifier<GLSLLocationAttribute>()) + info[kResInfo].semanticInfo.index = layoutAttr->value; + else + return; + } + if (auto foundVaryingOutput = typeLayout->FindResourceInfo(LayoutResourceKind::VaryingOutput)) + { + info[kResInfo].resInfo = foundVaryingOutput; + + if (auto layoutAttr = varDecl.getDecl()->findModifier<GLSLLocationAttribute>()) + info[kResInfo].semanticInfo.index = layoutAttr->value; + else + return; + } + // For remaining cases, we only want to apply GLSL-style layout modifers // when compiling for Khronos and WGSL targets. // |
