summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-03-25 12:14:49 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-03-25 12:14:49 +1100
commit9e1f7b2c57154704d5881362a44da703b7a4a00f (patch)
tree9cd0ca55f1eb9a0908ae76f65cfda107a7aec0ca /src/mesa/state_tracker/st_atom_texture.c
parent601b018a9a6143c634239d5bb51616724c2e593d (diff)
parent4654803e2595ea041ea83baf5e13e6c68890e9a7 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 9aef30f456..e1528c4d7b 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -56,28 +56,27 @@ update_textures(struct st_context *st)
for (unit = 0; unit < st->ctx->Const.MaxTextureCoordUnits; unit++) {
const GLuint su = fprog->Base.SamplerUnits[unit];
- struct gl_texture_object *texObj = st->ctx->Texture.Unit[su]._Current;
- struct st_texture_object *stObj = st_texture_object(texObj);
- struct pipe_texture *pt;
+ struct pipe_texture *pt = NULL;
- if (texObj) {
- GLboolean flush, retval;
+ if (fprog->Base.SamplersUsed & (1 << su)) {
+ struct gl_texture_object *texObj = st->ctx->Texture.Unit[su]._Current;
+ struct st_texture_object *stObj = st_texture_object(texObj);
- retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
- if (!retval) {
- /* out of mem */
- continue;
+ if (texObj) {
+ GLboolean flush, retval;
+
+ retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
+ if (!retval) {
+ /* out of mem */
+ continue;
+ }
+
+ st->state.num_textures = unit + 1;
}
- st->state.num_textures = unit + 1;
+ pt = st_get_stobj_texture(stObj);
}
- /* XXX: need to ensure that textures are unbound/removed from
- * this table before being deleted, otherwise the pointer
- * comparison below could fail.
- */
-
- pt = st_get_stobj_texture(stObj);
pipe_texture_reference(&st->state.sampler_texture[unit], pt);
}