summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-12-11 14:39:37 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2007-12-11 14:39:37 +0000
commitc3af68dc5022715cc8f126b7df12f3f5248aefe7 (patch)
tree587d4fbb480ad63d9326f6d214414b2a7bbee67d /src/mesa/state_tracker/st_atom_texture.c
parent94cadef31f9d4ee9fce1bfa66fabb0a403a6f049 (diff)
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.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c32
1 files changed, 21 insertions, 11 deletions
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
};