From cf8707ba40efad628c7d2ca8462272ddf848e681 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Apr 2008 23:19:25 -0400 Subject: [PATCH] Fixed LOOP output in GLSL profile. --HG-- branch : trunk --- mojoshader.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mojoshader.c b/mojoshader.c index 79541161..eefe358b 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -2349,8 +2349,11 @@ static void emit_GLSL_LOOP(Context *ctx) { 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 @@ static void emit_GLSL_ENDLOOP(Context *ctx) { ctx->indent--; output_line(ctx, "}"); + ctx->indent--; + output_line(ctx, "}"); } // emit_GLSL_ENDLOOP static void emit_GLSL_LABEL(Context *ctx)