fix structure indexing reassignment during block merging
authorMalcolm Bechard <malcolm@derivative.ca>
Tue, 17 May 2022 03:03:37 +0000 (23:03 -0400)
committerMalcolm Bechard <malcolm@derivative.ca>
Tue, 17 May 2022 04:53:52 +0000 (00:53 -0400)
For EOpIndexDirectStruct binaries, we want to visit the left symbol (the
structure) before we visit the binary, so it gets updated first.
That way we are comparing the updated structure against the target
'unitType', not the original structure.

glslang/MachineIndependent/linkValidate.cpp

index 9b45570..7fed096 100644 (file)
@@ -642,7 +642,7 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
         }
         TMergeBlockTraverser(const TIntermSymbol* newSym, const glslang::TType* unitType, glslang::TIntermediate* unit,
                              const std::map<unsigned int, unsigned int>* memberIdxUpdates)
-            : newSymbol(newSym), unitType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates)
+            : TIntermTraverser(false, true), newSymbol(newSym), unitType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates)
         {
         }
         virtual ~TMergeBlockTraverser() {}