Fixed LOOP output in GLSL profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 16 Apr 2008 23:19:25 -0400
branchtrunk
changeset 133 a2e9b4314286
parent 132 771666af0fa6
child 134 205c793ecf3e
Fixed LOOP output in GLSL profile.
mojoshader.c
--- a/mojoshader.c	Wed Apr 16 18:03:08 2008 -0400
+++ b/mojoshader.c	Wed Apr 16 23:19:25 2008 -0400
@@ -2349,8 +2349,11 @@
 {
     const char *varname = get_GLSL_sourcearg_varname(ctx, 1);
     assert(ctx->source_args[0].regnum == 0);  // in case they add aL1 someday.
-    output_line(ctx, "for (int aL = %s.y, const int aLend = %s.x+%s.y; aL < aLend; aL += %s.z) {",
-                varname, varname, varname, varname);
+    output_line(ctx, "{");
+    ctx->indent++;
+    output_line(ctx, "const int aLend = %s.x+%s.y;", varname, varname);
+    output_line(ctx, "for (int aL = %s.y; aL < aLend; aL += %s.z) {",
+                varname, varname);
     ctx->indent++;
 } // emit_GLSL_LOOP
 
@@ -2369,6 +2372,8 @@
 {
     ctx->indent--;
     output_line(ctx, "}");
+    ctx->indent--;
+    output_line(ctx, "}");
 } // emit_GLSL_ENDLOOP
 
 static void emit_GLSL_LABEL(Context *ctx)