}
-static void release_temps( struct texenv_fragment_program *p )
+static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p )
{
- GLuint max_temp = p->ctx->Const.FragmentProgram.MaxTemps;
+ GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps;
/* KW: To support tex_env_crossbar, don't release the registers in
* temps_output.
p.one = undef;
p.last_tex_stage = 0;
- release_temps(&p);
+ release_temps(ctx, &p);
if (key->enabled_units) {
/* First pass - to support texture_env_crossbar, first identify
for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++)
if (key->enabled_units & (1<<unit)) {
p.src_previous = emit_texenv( &p, unit );
- release_temps(&p); /* release all temps */
+ release_temps(ctx, &p); /* release all temps */
}
}
cache->size = size;
}
-static void clear_cache( struct texenvprog_cache *cache )
+static void clear_cache( GLcontext *ctx, struct texenvprog_cache *cache )
{
struct texenvprog_cache_item *c, *next;
GLuint i;
for (c = cache->items[i]; c; c = next) {
next = c->next;
_mesa_free(c->key);
- cache->ctx->Driver.DeleteProgram(cache->ctx,
- (struct gl_program *) c->data);
+ ctx->Driver.DeleteProgram(ctx, (struct gl_program *) c->data);
_mesa_free(c);
}
cache->items[i] = NULL;
}
-static void cache_item( struct texenvprog_cache *cache,
+static void cache_item( GLcontext *ctx,
+ struct texenvprog_cache *cache,
GLuint hash,
const struct state_key *key,
void *data )
if (cache->size < 1000)
rehash(cache);
else
- clear_cache(cache);
+ clear_cache(ctx, cache);
}
cache->n_items++;
create_new_program(ctx, &key, prog);
- cache_item(&ctx->Texture.env_fp_cache, hash, &key, prog);
+ cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, prog);
}
return prog;
void _mesa_TexEnvProgramCacheInit( GLcontext *ctx )
{
- ctx->Texture.env_fp_cache.ctx = ctx;
ctx->Texture.env_fp_cache.size = 17;
ctx->Texture.env_fp_cache.n_items = 0;
ctx->Texture.env_fp_cache.items = (struct texenvprog_cache_item **)
void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx )
{
- clear_cache(&ctx->Texture.env_fp_cache);
+ clear_cache(ctx, &ctx->Texture.env_fp_cache);
_mesa_free(ctx->Texture.env_fp_cache.items);
}