Commit a48f26fb by Qin Jiajia Committed by Commit Bot

ES31: Use deepCopy to make sure that every node being used only once

This patch uses deepCopy for nodes which are used more than once in the SSBO traverser. Bug: angleproject:1951 Change-Id: Ie8e03d4f595484a1e2ca0397ed30a7f484add607 Reviewed-on: https://chromium-review.googlesource.com/c/1370678Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
parent 3a256228
...@@ -174,21 +174,21 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitBinary(Visit visit, ...@@ -174,21 +174,21 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitBinary(Visit visit,
if (leftSSBO) if (leftSSBO)
{ {
TIntermSymbol *tempSymbol = TIntermSymbol *tempSymbol =
insertInitStatementAndReturnTempSymbol(node->getLeft(), &insertions); insertInitStatementAndReturnTempSymbol(node->getLeft()->deepCopy(), &insertions);
TIntermBinary *tempCompoundOperate = TIntermBinary *tempCompoundOperate =
new TIntermBinary(node->getOp(), tempSymbol, rightNode); new TIntermBinary(node->getOp(), tempSymbol->deepCopy(), rightNode->deepCopy());
insertions.push_back(tempCompoundOperate); insertions.push_back(tempCompoundOperate);
insertStatementsInParentBlock(insertions); insertStatementsInParentBlock(insertions);
TIntermBinary *assignTempValueToSSBO = TIntermBinary *assignTempValueToSSBO =
new TIntermBinary(EOpAssign, node->getLeft(), tempSymbol); new TIntermBinary(EOpAssign, node->getLeft(), tempSymbol->deepCopy());
queueReplacement(assignTempValueToSSBO, OriginalNode::IS_DROPPED); queueReplacement(assignTempValueToSSBO, OriginalNode::IS_DROPPED);
} }
else else
{ {
insertStatementsInParentBlock(insertions); insertStatementsInParentBlock(insertions);
TIntermBinary *compoundAssignRValueToLValue = TIntermBinary *compoundAssignRValueToLValue =
new TIntermBinary(node->getOp(), node->getLeft(), rightNode); new TIntermBinary(node->getOp(), node->getLeft(), rightNode->deepCopy());
queueReplacement(compoundAssignRValueToLValue, OriginalNode::IS_DROPPED); queueReplacement(compoundAssignRValueToLValue, OriginalNode::IS_DROPPED);
} }
} }
...@@ -216,7 +216,8 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitBinary(Visit visit, ...@@ -216,7 +216,8 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitBinary(Visit visit,
} }
insertStatementsInParentBlock(insertions); insertStatementsInParentBlock(insertions);
TIntermBinary *newExpr = new TIntermBinary(node->getOp(), leftNode, rightNode); TIntermBinary *newExpr =
new TIntermBinary(node->getOp(), leftNode->deepCopy(), rightNode->deepCopy());
queueReplacement(newExpr, OriginalNode::IS_DROPPED); queueReplacement(newExpr, OriginalNode::IS_DROPPED);
} }
return !mFoundSSBO; return !mFoundSSBO;
...@@ -282,7 +283,7 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitAggregate(Visit vis ...@@ -282,7 +283,7 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitAggregate(Visit vis
readBackToSSBOs.push_back(readBackToSSBO); readBackToSSBOs.push_back(readBackToSSBO);
} }
} }
node->replaceChildNode(ssboArgument, argumentCopy); node->replaceChildNode(ssboArgument->deepCopy(), argumentCopy);
} }
} }
...@@ -306,7 +307,7 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitAggregate(Visit vis ...@@ -306,7 +307,7 @@ bool RewriteExpressionsWithShaderStorageBlockTraverser::visitAggregate(Visit vis
insertions.insert(insertions.end(), readBackToSSBOs.begin(), readBackToSSBOs.end()); insertions.insert(insertions.end(), readBackToSSBOs.begin(), readBackToSSBOs.end());
} }
insertStatementsInParentBlock(insertions); insertStatementsInParentBlock(insertions);
queueReplacement(tempSymbol, OriginalNode::IS_DROPPED); queueReplacement(tempSymbol->deepCopy(), OriginalNode::IS_DROPPED);
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment