summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_pipe_sampler.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-02-17 10:18:55 -0700
committerBrian Paul <brianp@vmware.com>2012-02-23 07:49:09 -0700
commit810584270d5b34f6a130eac06a5529d616d82b0a (patch)
tree700582cf7ba4bcc8b459d202972d7fddb210a767 /src/gallium/drivers/svga/svga_pipe_sampler.c
parent0fffaa512cbd347af0b81571753d4da6dd58a81e (diff)
downloadexternal_mesa3d-810584270d5b34f6a130eac06a5529d616d82b0a.zip
external_mesa3d-810584270d5b34f6a130eac06a5529d616d82b0a.tar.gz
external_mesa3d-810584270d5b34f6a130eac06a5529d616d82b0a.tar.bz2
svga: no-op sampler view referencing if no change
Just to be safe with ref counting and avoid atomic operations.
Diffstat (limited to 'src/gallium/drivers/svga/svga_pipe_sampler.c')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index c1ea4f8..7675daa 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -225,12 +225,14 @@ svga_set_fragment_sampler_views(struct pipe_context *pipe,
}
for (i = 0; i < num; i++) {
- /* Note: we're using pipe_sampler_view_release() here to work around
- * a possible crash when the old view belongs to another context that
- * was already destroyed.
- */
- pipe_sampler_view_release(pipe, &svga->curr.sampler_views[i]);
- pipe_sampler_view_reference(&svga->curr.sampler_views[i], views[i]);
+ if (svga->curr.sampler_views[i] != views[i]) {
+ /* Note: we're using pipe_sampler_view_release() here to work around
+ * a possible crash when the old view belongs to another context that
+ * was already destroyed.
+ */
+ pipe_sampler_view_release(pipe, &svga->curr.sampler_views[i]);
+ pipe_sampler_view_reference(&svga->curr.sampler_views[i], views[i]);
+ }
if (!views[i])
continue;