diff options
author | marha <marha@users.sourceforge.net> | 2012-02-13 08:47:19 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-13 08:47:19 +0100 |
commit | eaa70945cb3f1a432b8c505ecede9ebc7769f36d (patch) | |
tree | 8e44ff4da739e384a2c6a34c1b42ecfb8e212344 /mesalib/src/mesa/state_tracker/st_atom_texture.c | |
parent | 474621addc25cb22865c54b70ffbec07c82eb04c (diff) | |
download | vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.gz vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.bz2 vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.zip |
libX11 libxcb mesa xserver mkfontscale git update 13 feb 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_texture.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index d241527cc..e8941da8d 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -300,24 +300,31 @@ update_fragment_textures(struct st_context *st) const struct gl_context *ctx = st->ctx; struct gl_fragment_program *fprog = ctx->FragmentProgram._Current; GLuint su; + int old_max = st->state.num_textures; + GLbitfield samplers_used = fprog->Base.SamplersUsed; st->state.num_textures = 0; /* loop over sampler units (aka tex image units) */ - for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) { + for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) { struct pipe_sampler_view *sampler_view = NULL; - if (fprog->Base.SamplersUsed & (1 << su)) { + + if (samplers_used & 1) { GLboolean retval; GLuint texUnit; - texUnit = fprog->Base.SamplerUnits[su]; + texUnit = fprog->Base.SamplerUnits[su]; - retval = update_single_texture(st, &sampler_view, texUnit); - if (retval == GL_FALSE) - continue; + retval = update_single_texture(st, &sampler_view, texUnit); + if (retval == GL_FALSE) + continue; st->state.num_textures = su + 1; + } else if (samplers_used == 0 && su >= old_max) { + /* if we've reset all the old views and we have no more new ones */ + break; } + pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view); } |