Limit HLSL loop scope to match that of GLSL, for excessive loops.
TRAC #21167
ISSUE=338
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: http://angleproject.googlecode.com/svn/trunk@1208 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index d7e69d3..50186b3 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -2052,6 +2052,8 @@
return false; // Not an excessive loop
}
+ out << "{";
+
while (iterations > 0)
{
int clampedLimit = initial + increment * std::min(MAX_LOOP_ITERATIONS, iterations);
@@ -2088,6 +2090,8 @@
initial += MAX_LOOP_ITERATIONS * increment;
iterations -= MAX_LOOP_ITERATIONS;
}
+
+ out << "}";
return true;
}