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.
This commit is contained in:
@@ -56,9 +56,11 @@ update_textures(struct st_context *st)
|
|||||||
|
|
||||||
for (unit = 0; unit < st->ctx->Const.MaxTextureCoordUnits; unit++) {
|
for (unit = 0; unit < st->ctx->Const.MaxTextureCoordUnits; unit++) {
|
||||||
const GLuint su = fprog->Base.SamplerUnits[unit];
|
const GLuint su = fprog->Base.SamplerUnits[unit];
|
||||||
|
struct pipe_texture *pt = NULL;
|
||||||
|
|
||||||
|
if (fprog->Base.SamplersUsed & (1 << su)) {
|
||||||
struct gl_texture_object *texObj = st->ctx->Texture.Unit[su]._Current;
|
struct gl_texture_object *texObj = st->ctx->Texture.Unit[su]._Current;
|
||||||
struct st_texture_object *stObj = st_texture_object(texObj);
|
struct st_texture_object *stObj = st_texture_object(texObj);
|
||||||
struct pipe_texture *pt;
|
|
||||||
|
|
||||||
if (texObj) {
|
if (texObj) {
|
||||||
GLboolean flush, retval;
|
GLboolean flush, retval;
|
||||||
@@ -72,12 +74,9 @@ update_textures(struct st_context *st)
|
|||||||
st->state.num_textures = unit + 1;
|
st->state.num_textures = unit + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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);
|
pt = st_get_stobj_texture(stObj);
|
||||||
|
}
|
||||||
|
|
||||||
pipe_texture_reference(&st->state.sampler_texture[unit], pt);
|
pipe_texture_reference(&st->state.sampler_texture[unit], pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user