diff options
author | Brian Paul <[email protected]> | 2008-03-24 12:59:54 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-03-24 17:21:18 -0600 |
commit | 762e96c80454c94981cd0ccb4b342f192ba8f77e (patch) | |
tree | 0f2babd0556c70b57160799e62f70bb19ff0e25f /src/mesa/state_tracker/st_atom_texture.c | |
parent | ae146e4bc86aeade59d018100e39e160f7553994 (diff) |
gallium: check SamplersUsed to determine if texture needed, as in st_atom_sampler.c
Otherwise, we were sometimes setting texture state but not the corresponding
sampler state.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 31 |
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 9aef30f4566..e1528c4d7b9 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); } |