From cd4bb85a2689730a5cca01724eb2a794dbc4fbe7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 4 Aug 2008 09:25:32 +0200 Subject: [PATCH] Logic bug: could hit else condition when we didn't want to. Fixes assertion failure for constant arrays. --HG-- branch : trunk --- mojoshader_opengl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index 337a3a42..2d9fd9d2 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -1140,16 +1140,20 @@ static void lookup_uniforms(MOJOSHADER_glProgram *program, if (loc != -1) // maybe the Uniform was optimized out? { // only do constants once, at link time. These aren't changed ever. - if ( (u->constant) && (ctx->profileMustLoadConstantArrays()) ) + if (u->constant) { - const int base = u->index; - const int size = u->array_count; - GLfloat *f = (GLfloat *) alloca(sizeof (GLfloat) * size * 4); - fill_constant_array(f, base, size, pd); - ctx->profileUseProgramObject(program); - ctx->profileUniform4fv(pd, loc, size, f); - ctx->profileUseProgramObject(ctx->bound_program); + if (ctx->profileMustLoadConstantArrays()) + { + const int base = u->index; + const int size = u->array_count; + GLfloat *f = (GLfloat *) alloca(sizeof (GLfloat)*(size*4)); + fill_constant_array(f, base, size, pd); + ctx->profileUseProgramObject(program); + ctx->profileUniform4fv(pd, loc, size, f); + ctx->profileUseProgramObject(ctx->bound_program); + } // if } // if + else { UniformMap *map = &program->uniforms[program->uniform_count];