From: Keith Whitwell Date: Wed, 11 May 2005 08:34:19 +0000 (+0000) Subject: Rename temp_flag to temp_in_use. Use ctx->Const.MaxVertexProgramTemps X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3509fd8c1b38d955a066a2bad429dbfba162fa30;p=mesa.git Rename temp_flag to temp_in_use. Use ctx->Const.MaxVertexProgramTemps rather than MAX_NV_VERTEX_PROGRAM_TEMPS and deal with this possibly being greater than 32. --- diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 678083293ba..5d2f441ff94 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -76,7 +76,7 @@ struct tnl_program { GLcontext *ctx; struct vertex_program *program; - GLuint temp_flag; + GLuint temp_in_use; GLuint temp_reserved; struct ureg eye_position; @@ -144,13 +144,13 @@ static struct ureg swizzle1( struct ureg reg, int x ) static struct ureg get_temp( struct tnl_program *p ) { - int bit = ffs( ~p->temp_flag ); + int bit = ffs( ~p->temp_in_use ); if (!bit) { fprintf(stderr, "%s: out of temporaries\n", __FILE__); exit(1); } - p->temp_flag |= 1<<(bit-1); + p->temp_in_use |= 1<<(bit-1); return make_ureg(PROGRAM_TEMPORARY, bit-1); } @@ -164,14 +164,14 @@ static struct ureg reserve_temp( struct tnl_program *p ) static void release_temp( struct tnl_program *p, struct ureg reg ) { if (reg.file == PROGRAM_TEMPORARY) { - p->temp_flag &= ~(1<temp_flag |= p->temp_reserved; /* can't release reserved temps */ + p->temp_in_use &= ~(1<temp_in_use |= p->temp_reserved; /* can't release reserved temps */ } } static void release_temps( struct tnl_program *p ) { - p->temp_flag = p->temp_reserved; + p->temp_in_use = p->temp_reserved; } @@ -1138,8 +1138,13 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) p.eye_normal = undef; p.identity = undef; - p.temp_flag = 0; - p.temp_reserved = ~((1<Const.MaxVertexProgramTemps >= sizeof(int) * 8) + p.temp_reserved = 0; + else + p.temp_reserved = ~((1<Const.MaxVertexProgramTemps)-1); + p.program->Instructions = MALLOC(sizeof(struct vp_instruction) * MAX_INSN); /* Initialize the arb_program struct */