aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-21 07:55:46 +0200
committermarha <marha@users.sourceforge.net>2012-08-21 07:55:46 +0200
commit1bf52245e51f23656a3520056b440a633ea5a61b (patch)
tree4e175b2e2a4a843e101d582ba996eaef336f90fc /mesalib/src/mesa/state_tracker/st_atom_texture.c
parent0f140f539691e1657d8ea0fcbcca2d5947574406 (diff)
parent7cd970786d72a68b735f33904bdded6c8aebdf33 (diff)
downloadvcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.tar.gz
vcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.tar.bz2
vcxsrv-1bf52245e51f23656a3520056b440a633ea5a61b.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 6e2efd960..df05e83c2 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -265,7 +265,7 @@ update_textures(struct st_context *st,
{
const GLuint old_max = *num_textures;
GLbitfield samplers_used = prog->SamplersUsed;
- GLuint unit;
+ GLuint unit, new_count;
if (samplers_used == 0x0 && old_max == 0)
return;
@@ -294,9 +294,16 @@ update_textures(struct st_context *st,
pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view);
}
+ /* Ex: if old_max = 3 and *num_textures = 1, we need to pass an
+ * array of views={X, NULL, NULL} to unref the old texture views
+ * at positions [1] and [2].
+ */
+ new_count = MAX2(*num_textures, old_max);
+ assert(new_count <= max_units);
+
cso_set_sampler_views(st->cso_context,
shader_stage,
- MIN2(*num_textures, max_units),
+ new_count,
sampler_views);
}