From 73af7100416e1627d1de0aaa94983f56406a9d49 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 12 Feb 2019 15:13:00 -0800 Subject: Track stage for varying sub-fields (#842) Fixes #841 This reverts a small change made in #815 that seemed innocent at the time: we stopped tracking an explicit `Stage` to go with every `VarLayout` that is part of an entry-point varying parameter, and instead only associated the stage with the top-level parameter. That change ended up breaking the logic to emit the `flat` modifier automatically for integer type fragment-shader inputs for GLSL, but we didn't have a regression test to catch that case. This change adds a regression test to cover this case, and adds the small number of lines that were removed from `parameter-binding.cpp`. A few other test outputs had to be updated for the change (these are outputs that were changed in #815 for the same reason). --- source/slang/parameter-binding.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/slang/parameter-binding.cpp') diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp index 89226cdd9..f0abfe31c 100644 --- a/source/slang/parameter-binding.cpp +++ b/source/slang/parameter-binding.cpp @@ -2016,6 +2016,19 @@ static RefPtr processEntryPointVaryingParameter( EntryPointParameterState const& state, RefPtr varLayout) { + // Make sure to associate a stage with every + // varying parameter (including sub-fields of + // `struct`-type parameters), since downstream + // code generation will need to look at the + // stage (possibly on individual leaf fields) to + // decide when to emit things like the `flat` + // interpolation modifier. + // + if( varLayout ) + { + varLayout->stage = state.stage; + } + // The default handling of varying parameters should not apply // to geometry shader output streams; they have their own special rules. if( auto gsStreamType = as(type) ) -- cgit v1.2.3