diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:29:50 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:31:02 +0200 |
commit | 70dd5e7c66b1fe3f82e5b4db2406050baba15f05 (patch) | |
tree | 3f012200ef3c934f33db1a4ef2b790fae3141860 /gfx/angle/src/compiler/translator/SeparateDeclarations.cpp | |
parent | 3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff) | |
parent | 8481fa25d246f1968d0a254ee3c6cdd82c60781a (diff) | |
download | UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.gz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.lz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.xz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.zip |
Merge branch 'ANGLE-rollback'
This resolves #624
Note: Cherry-picked some fixes on top of the ANGLE version that we want to keep.
Diffstat (limited to 'gfx/angle/src/compiler/translator/SeparateDeclarations.cpp')
-rwxr-xr-x | gfx/angle/src/compiler/translator/SeparateDeclarations.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/gfx/angle/src/compiler/translator/SeparateDeclarations.cpp b/gfx/angle/src/compiler/translator/SeparateDeclarations.cpp index 4d3835370..d33747f85 100755 --- a/gfx/angle/src/compiler/translator/SeparateDeclarations.cpp +++ b/gfx/angle/src/compiler/translator/SeparateDeclarations.cpp @@ -17,9 +17,6 @@ #include "compiler/translator/IntermNode.h" -namespace sh -{ - namespace { @@ -29,7 +26,7 @@ class SeparateDeclarationsTraverser : private TIntermTraverser static void apply(TIntermNode *root); private: SeparateDeclarationsTraverser(); - bool visitDeclaration(Visit, TIntermDeclaration *node) override; + bool visitAggregate(Visit, TIntermAggregate *node) override; }; void SeparateDeclarationsTraverser::apply(TIntermNode *root) @@ -44,28 +41,32 @@ SeparateDeclarationsTraverser::SeparateDeclarationsTraverser() { } -bool SeparateDeclarationsTraverser::visitDeclaration(Visit, TIntermDeclaration *node) +bool SeparateDeclarationsTraverser::visitAggregate(Visit, TIntermAggregate *node) { - TIntermSequence *sequence = node->getSequence(); - if (sequence->size() > 1) + if (node->getOp() == EOpDeclaration) { - TIntermBlock *parentBlock = getParentNode()->getAsBlock(); - ASSERT(parentBlock != nullptr); - - TIntermSequence replacementDeclarations; - for (size_t ii = 0; ii < sequence->size(); ++ii) + TIntermSequence *sequence = node->getSequence(); + if (sequence->size() > 1) { - TIntermDeclaration *replacementDeclaration = new TIntermDeclaration(); + TIntermAggregate *parentAgg = getParentNode()->getAsAggregate(); + ASSERT(parentAgg != nullptr); - replacementDeclaration->appendDeclarator(sequence->at(ii)->getAsTyped()); - replacementDeclaration->setLine(sequence->at(ii)->getLine()); - replacementDeclarations.push_back(replacementDeclaration); - } + TIntermSequence replacementDeclarations; + for (size_t ii = 0; ii < sequence->size(); ++ii) + { + TIntermAggregate *replacementDeclaration = new TIntermAggregate; - mMultiReplacements.push_back( - NodeReplaceWithMultipleEntry(parentBlock, node, replacementDeclarations)); + replacementDeclaration->setOp(EOpDeclaration); + replacementDeclaration->getSequence()->push_back(sequence->at(ii)); + replacementDeclaration->setLine(sequence->at(ii)->getLine()); + replacementDeclarations.push_back(replacementDeclaration); + } + + mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentAgg, node, replacementDeclarations)); + } + return false; } - return false; + return true; } } // namespace @@ -74,5 +75,3 @@ void SeparateDeclarations(TIntermNode *root) { SeparateDeclarationsTraverser::apply(root); } - -} // namespace sh |