aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_atom_sampler.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
commit179ebdfaf7fe0a0017054c052b76210eeff084a9 (patch)
tree5daa6e5583ced6a6b12b03e12c16ef2acedb5b5c /mesalib/src/mesa/state_tracker/st_atom_sampler.c
parent535951cba015f2a2b63292e0ca983d0d6e736b71 (diff)
parenteaa70945cb3f1a432b8c505ecede9ebc7769f36d (diff)
downloadvcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.gz
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.bz2
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_atom_sampler.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index 8845fed51..ee69fc390 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -233,29 +233,33 @@ update_fragment_samplers(struct st_context *st)
const struct gl_context *ctx = st->ctx;
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
GLuint su;
+ GLuint samplers_used = fprog->Base.SamplersUsed;
+ GLuint old_max = st->state.num_samplers;
st->state.num_samplers = 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_state *sampler = st->state.samplers + su;
-
- if (fprog->Base.SamplersUsed & (1 << su)) {
+ if (samplers_used & 1) {
GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
+ texUnit = fprog->Base.SamplerUnits[su];
- convert_sampler(st, sampler, texUnit);
+ convert_sampler(st, sampler, texUnit);
st->state.num_samplers = su + 1;
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, sampler);
}
- else {
+ else if (samplers_used != 0 || su < old_max) {
/*printf("%s su=%u null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, NULL);
+ } else {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
}