Mesa (master): svga: no-op sampler view referencing if no change
Brian Paul
brianp at kemper.freedesktop.org
Thu Feb 23 14:54:39 UTC 2012
Module: Mesa
Branch: master
Commit: 810584270d5b34f6a130eac06a5529d616d82b0a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=810584270d5b34f6a130eac06a5529d616d82b0a
Author: Brian Paul <brianp at vmware.com>
Date: Fri Feb 17 10:18:55 2012 -0700
svga: no-op sampler view referencing if no change
Just to be safe with ref counting and avoid atomic operations.
---
src/gallium/drivers/svga/svga_pipe_sampler.c | 14 ++++++++------
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;
More information about the mesa-commit
mailing list