From b40a6d6b40a46c1206a9a309885a7e1fbbc1cf93 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 24 May 2016 13:16:08 +0200 Subject: [PATCH] Use version/profile from first compilation stage When linking multiple compilation units per shader stage, the code creates a new intermediate, but fails to set its version and profile. This change makes it so that the new intermediate inherits the version and profile of the first compilation unit, so that two ES SL compilation units can be combined. --- glslang/MachineIndependent/ShaderLang.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 3a3bd58c..2c5a1ca7 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1530,10 +1530,13 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) // Be efficient for the common single compilation unit per stage case, // reusing it's TIntermediate instead of merging into a new one. // + TIntermediate *firstIntermediate = stages[stage].front()->intermediate; if (stages[stage].size() == 1) - intermediate[stage] = stages[stage].front()->intermediate; + intermediate[stage] = firstIntermediate; else { - intermediate[stage] = new TIntermediate(stage); + intermediate[stage] = new TIntermediate(stage, + firstIntermediate->getVersion(), + firstIntermediate->getProfile()); newedIntermediate[stage] = true; }