From 0a7bfacdf096cb0fcdf375333122e0cf20e143cb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 7 Apr 2008 20:04:24 -0400 Subject: [PATCH] Implemented LOOP/ENDLOOP in GLSL profile. I _think_ this should work, we'll see. --HG-- branch : trunk --- mojoshader.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mojoshader.c b/mojoshader.c index e68f43cb..d1b251de 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -2349,8 +2349,10 @@ static void emit_GLSL_CALLNZ(Context *ctx) static void emit_GLSL_LOOP(Context *ctx) { - //fail(ctx, "unimplemented."); // !!! FIXME - output_line(ctx, "for (int aL = BLAH, BLAH, BLAH) {"); + 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); ctx->indent++; } // emit_GLSL_LOOP @@ -2367,7 +2369,6 @@ static void emit_GLSL_RET(Context *ctx) static void emit_GLSL_ENDLOOP(Context *ctx) { - //fail(ctx, "unimplemented."); // !!! FIXME ctx->indent--; output_line(ctx, "}"); } // emit_GLSL_ENDLOOP