Perform short-circuit unfolding on separate declarations.
BUG=415694
Change-Id: I812abb21d2ab4af0b63631a23026d5860df61672
Reviewed-on: https://chromium-review.googlesource.com/221945
Tested-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 70eebab..cc758e1 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1862,6 +1862,11 @@
{
for (TIntermSequence::iterator sit = sequence->begin(); sit != sequence->end(); sit++)
{
+ if (isSingleStatement(*sit))
+ {
+ mUnfoldShortCircuit->traverse(*sit);
+ }
+
if (!mInsideFunction)
{
out << "static ";
@@ -2503,6 +2508,12 @@
{
return false;
}
+ else if (aggregate->getOp() == EOpDeclaration)
+ {
+ // Declaring multiple comma-separated variables must be considered multiple statements
+ // because each individual declaration has side effects which are visible in the next.
+ return false;
+ }
else
{
for (TIntermSequence::iterator sit = aggregate->getSequence()->begin(); sit != aggregate->getSequence()->end(); sit++)