Fix issue with remapping global uniform blocks

Avoid adding global uniform blocks to stages that don't already have it.
Otherwise multiple stages point to the same block object, and a
remapping that occurs later on will change the mapping on multiple
stages.
This commit is contained in:
Malcolm Bechard 2021-03-17 18:47:13 -04:00
parent 48f08c60e2
commit 5340752190
7 changed files with 332 additions and 6 deletions

View file

@ -2124,7 +2124,12 @@ bool TProgram::crossStageCheck(EShMessages) {
// copy final definition of global block back into each stage
for (unsigned int i = 0; i < activeStages.size(); ++i) {
activeStages[i]->mergeGlobalUniformBlocks(*infoSink, uniforms);
// We only want to merge into already existing global uniform blocks.
// A stage that doesn't already know about the global doesn't care about it's content.
// Otherwise we end up pointing to the same object between different stages
// and that will break binding/set remappings
bool mergeExistingOnly = true;
activeStages[i]->mergeGlobalUniformBlocks(*infoSink, uniforms, mergeExistingOnly);
}
// compare cross stage symbols for each stage boundary