Commit 65c79dbc by Olli Etuaho Committed by Commit Bot

Clean up RecordConstantPrecision interaction with switch/case

There were two bugs here that were masking each other: 1. Case nodes were not being added to AST traversal path. 2. RecordConstantPrecision did not check if a constant was a child of a case node. Fix these. BUG=angleproject:1490 TEST=WebGL 2 conformance tests Change-Id: Ic6cb7942bf57870fa26eb6a011919a2d7951cc85 Reviewed-on: https://chromium-review.googlesource.com/394588Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 5d9f5df0
...@@ -680,7 +680,11 @@ void TIntermTraverser::traverseCase(TIntermCase *node) ...@@ -680,7 +680,11 @@ void TIntermTraverser::traverseCase(TIntermCase *node)
visit = visitCase(PreVisit, node); visit = visitCase(PreVisit, node);
if (visit && node->getCondition()) if (visit && node->getCondition())
{
incrementDepth(node);
node->getCondition()->traverse(this); node->getCondition()->traverse(this);
decrementDepth();
}
if (visit && postVisit) if (visit && postVisit)
visitCase(PostVisit, node); visitCase(PostVisit, node);
......
...@@ -45,6 +45,11 @@ RecordConstantPrecisionTraverser::RecordConstantPrecisionTraverser() ...@@ -45,6 +45,11 @@ RecordConstantPrecisionTraverser::RecordConstantPrecisionTraverser()
bool RecordConstantPrecisionTraverser::operandAffectsParentOperationPrecision(TIntermTyped *operand) bool RecordConstantPrecisionTraverser::operandAffectsParentOperationPrecision(TIntermTyped *operand)
{ {
if (getParentNode()->getAsCaseNode())
{
return false;
}
const TIntermBinary *parentAsBinary = getParentNode()->getAsBinaryNode(); const TIntermBinary *parentAsBinary = getParentNode()->getAsBinaryNode();
if (parentAsBinary != nullptr) if (parentAsBinary != nullptr)
{ {
......
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