Check for linking multiple ES shaders to the same stage

This commit is contained in:
Thomas Perl 2016-05-25 09:26:43 +02:00
parent 0bb546f8ae
commit 7bfd08d21c
6 changed files with 21 additions and 168 deletions

View file

@ -1526,6 +1526,23 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
if (stages[stage].size() == 0)
return true;
int numEsShaders = 0, numNonEsShaders = 0;
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
if ((*it)->intermediate->getProfile() == EEsProfile) {
numEsShaders++;
} else {
numNonEsShaders++;
}
}
if (numEsShaders > 0 && numNonEsShaders > 0) {
infoSink->info.message(EPrefixError, "Cannot mix ES profile with non-ES profile shaders");
return false;
} else if (numEsShaders > 1) {
infoSink->info.message(EPrefixError, "Cannot attach multiple ES shaders of the same type to a single program");
return false;
}
//
// Be efficient for the common single compilation unit per stage case,
// reusing it's TIntermediate instead of merging into a new one.

View file

@ -86,10 +86,6 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
numPushConstants += unit.numPushConstants;
callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end());
if ((profile != EEsProfile && unit.profile == EEsProfile) ||
(profile == EEsProfile && unit.profile != EEsProfile))
error(infoSink, "Cannot mix ES profile with non-ES profile shaders\n");
if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger)
error(infoSink, "gl_FragCoord redeclarations must match across shaders\n");