From c3af68dc5022715cc8f126b7df12f3f5248aefe7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Dec 2007 14:39:37 +0000 Subject: gallium: remove set_sampler_units interface The effect of this mapping can be acheived by the state tracker and setting up the pipe texture state pointers to incorporate its affects. --- src/mesa/state_tracker/st_atom_texture.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/mesa/state_tracker/st_atom_texture.c') diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index c4e5af02d5..fb21d29c40 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -46,20 +46,24 @@ static void update_textures(struct st_context *st) { - GLuint u; + GLuint s; - for (u = 0; u < st->ctx->Const.MaxTextureImageUnits; u++) { + /* ST_NEW_FRAGMENT_PROGRAM + */ + struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; + + for (s = 0; s < st->ctx->Const.MaxTextureCoordUnits; s++) { + GLuint su = fprog->Base.SamplerUnits[s]; + struct gl_texture_object *texObj - = st->ctx->Texture.Unit[u]._Current; + = st->ctx->Texture.Unit[su]._Current; + struct pipe_texture *pt; + if (texObj) { GLboolean flush, retval; - retval = st_finalize_texture(st->ctx, st->pipe, u, &flush); -#if 0 - printf("finalize_texture returned %d, flush = %d\n", - retval, flush); -#endif + retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush); pt = st_get_texobj_texture(texObj); } @@ -67,8 +71,14 @@ update_textures(struct st_context *st) pt = NULL; } - st->state.texture[u] = pt; - st->pipe->set_texture_state(st->pipe, u, pt); + /* XXX: need to ensure that textures are unbound/removed from + * this table before being deleted, otherwise the pointer + * comparison below could fail. + */ + if (st->state.sampler_texture[s] != pt) { + st->state.sampler_texture[s] = pt; + st->pipe->set_sampler_texture(st->pipe, s, pt); + } } } @@ -77,7 +87,7 @@ const struct st_tracked_state st_update_texture = { .name = "st_update_texture", .dirty = { .mesa = _NEW_TEXTURE, - .st = 0, + .st = ST_NEW_FRAGMENT_PROGRAM, }, .update = update_textures }; -- cgit v1.2.3