Add an option to unfold short circuiting in AST.
We replace "a || b" with "a ? true : b",
"a && b" with "a ? b : false".
This is to work around short circuiting bug in Mac drivers.
ANGLEBUG=482
TEST=webgl conformance tests
R=alokp@chromium.org, kbr@chromium.org
Review URL: https://codereview.appspot.com/14529048
Conflicts:
src/build_angle.gypi
src/compiler/translator/Compiler.cpp
Change-Id: Ic2384a97d58f54294efcb3a012deb2007a9fc658
Reviewed-on: https://chromium-review.googlesource.com/178996
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 8a2b77a..e51bd12 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -437,7 +437,7 @@
node->getCondition()->traverse(this);
out << ")\n";
- incrementDepth();
+ incrementDepth(node);
visitCodeBlock(node->getTrueBlock());
if (node->getFalseBlock())
@@ -462,7 +462,7 @@
// Scope the sequences except when at the global scope.
if (depth > 0) out << "{\n";
- incrementDepth();
+ incrementDepth(node);
const TIntermSequence& sequence = node->getSequence();
for (TIntermSequence::const_iterator iter = sequence.begin();
iter != sequence.end(); ++iter)
@@ -500,7 +500,7 @@
writeVariableType(node->getType());
out << " " << hashFunctionName(node->getName());
- incrementDepth();
+ incrementDepth(node);
// Function definition node contains one or two children nodes
// representing function parameters and function body. The latter
// is not present in case of empty function bodies.
@@ -640,7 +640,7 @@
{
TInfoSinkBase& out = objSink();
- incrementDepth();
+ incrementDepth(node);
// Loop header.
TLoopType loopType = node->getType();
if (loopType == ELoopFor) // for loop