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.
This commit is contained in:
Thomas Perl 2016-05-24 13:16:08 +02:00
parent 63d4794e8e
commit b40a6d6b40

View File

@ -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;
}