Commit fd3b9be6 by Olli Etuaho

Set mUsesDiscardRewriting more conservatively

This fixes a regression from recent refactoring of unfolding short-circuiting operators. mUsesDiscardRewriting used to be set based on detecting patterns that the AST traverser now overwrites before the code reaches OutputHLSL. With this patch mUsesDiscardRewriting is set more conservatively, which ensures that using discard works correctly also in case the input shader contains the same kind of pattern as the short-circuiting operator unfolding creates. TEST=WebGL conformance tests on D3D9 BUG=chromium:488552 Change-Id: Iea0103822a268079593b0913f0b6fc54c745c6e3 Reviewed-on: https://chromium-review.googlesource.com/271761Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 274f0709
...@@ -53,28 +53,6 @@ class FindDiscard : public NodeSearchTraverser<FindDiscard> ...@@ -53,28 +53,6 @@ class FindDiscard : public NodeSearchTraverser<FindDiscard>
} }
}; };
class FindSideEffectRewriting : public NodeSearchTraverser<FindSideEffectRewriting>
{
public:
virtual bool visitBinary(Visit visit, TIntermBinary *node)
{
switch (node->getOp())
{
case EOpLogicalOr:
case EOpLogicalAnd:
if (node->getRight()->hasSideEffects())
{
mFound = true;
}
break;
default: break;
}
return !mFound;
}
};
} }
#endif // COMPILER_TRANSLATOR_NODESEARCH_H_ #endif // COMPILER_TRANSLATOR_NODESEARCH_H_
...@@ -2320,7 +2320,7 @@ void OutputHLSL::writeSelection(TIntermSelection *node) ...@@ -2320,7 +2320,7 @@ void OutputHLSL::writeSelection(TIntermSelection *node)
} }
// ANGLE issue 486: Detect problematic conditional discard // ANGLE issue 486: Detect problematic conditional discard
if (discard && FindSideEffectRewriting::search(node)) if (discard)
{ {
mUsesDiscardRewriting = true; mUsesDiscardRewriting = true;
} }
......
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