From 7f7831c67b58bc250428d252685c62281640710f Mon Sep 17 00:00:00 2001 From: Malcolm Bechard Date: Fri, 16 Sep 2022 17:53:08 -0400 Subject: [PATCH] further updates to 67384dd18b1715 since we are changing the type before the visitBinary now, we need to be comparing against the new type. Previous test cases worked since the 'unitType' was a shallow copy and ended up getting updated in some cases to match the new type, but not all. --- glslang/MachineIndependent/linkValidate.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index e8ef5aef..acc512fd 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -638,18 +638,18 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl class TMergeBlockTraverser : public TIntermTraverser { public: TMergeBlockTraverser(const TIntermSymbol* newSym) - : newSymbol(newSym), unitType(nullptr), unit(nullptr), memberIndexUpdates(nullptr) + : newSymbol(newSym), newType(nullptr), unit(nullptr), memberIndexUpdates(nullptr) { } TMergeBlockTraverser(const TIntermSymbol* newSym, const glslang::TType* unitType, glslang::TIntermediate* unit, const std::map* memberIdxUpdates) - : TIntermTraverser(false, true), newSymbol(newSym), unitType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates) + : TIntermTraverser(false, true), newSymbol(newSym), newType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates) { } virtual ~TMergeBlockTraverser() {} const TIntermSymbol* newSymbol; - const glslang::TType* unitType; // copy of original type + const glslang::TType* newType; // shallow copy of the new type glslang::TIntermediate* unit; // intermediate that is being updated const std::map* memberIndexUpdates; @@ -665,10 +665,10 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl virtual bool visitBinary(TVisit, glslang::TIntermBinary* node) { - if (!unit || !unitType || !memberIndexUpdates || memberIndexUpdates->empty()) + if (!unit || !newType || !memberIndexUpdates || memberIndexUpdates->empty()) return true; - if (node->getOp() == EOpIndexDirectStruct && node->getLeft()->getType() == *unitType) { + if (node->getOp() == EOpIndexDirectStruct && node->getLeft()->getType() == *newType) { // this is a dereference to a member of the block since the // member list changed, need to update this to point to the // right index @@ -696,9 +696,9 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl // The 'unit' intermediate needs the block structures update, but also structure entry indices // may have changed from the old block to the new one that it was merged into, so update those // in 'visitBinary' - TType unitType; - unitType.shallowCopy(unitBlock->getType()); - TMergeBlockTraverser unitFinalLinkTraverser(block, &unitType, unit, &memberIndexUpdates); + TType newType; + newType.shallowCopy(block->getType()); + TMergeBlockTraverser unitFinalLinkTraverser(block, &newType, unit, &memberIndexUpdates); unit->getTreeRoot()->traverse(&unitFinalLinkTraverser); // update the member list