Mesa (master): softpipe: invalidate cache view when swizzles are different.

Dave Airlie airlied at kemper.freedesktop.org
Mon May 3 06:34:05 UTC 2010


Module: Mesa
Branch: master
Commit: e8f48b1dc99a8db05c07d442acd3baf8f3620f6e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8f48b1dc99a8db05c07d442acd3baf8f3620f6e

Author: Dave Airlie <airlied at redhat.com>
Date:   Sun May  2 17:37:18 2010 +1000

softpipe: invalidate cache view when swizzles are different.

Current code only invalidated if the texture was different, however we
store swizzled values in the cache, so we need to invalidate in that case
also.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/softpipe/sp_tex_tile_cache.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index fbce9e0..b3e1c49 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -115,6 +115,20 @@ sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc)
    }
 }
 
+static boolean
+sp_tex_tile_is_compat_view(struct softpipe_tex_tile_cache *tc,
+                           struct pipe_sampler_view *view)
+{
+   if (!view)
+      return FALSE;
+   return (tc->texture == view->texture &&
+           tc->format == view->format &&
+           tc->swizzle_r == view->swizzle_r &&
+           tc->swizzle_g == view->swizzle_g &&
+           tc->swizzle_b == view->swizzle_b &&
+           tc->swizzle_a == view->swizzle_a);
+}
+
 /**
  * Specify the sampler view to cache.
  */
@@ -127,7 +141,7 @@ sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
 
    assert(!tc->transfer);
 
-   if (tc->texture != texture) {
+   if (!sp_tex_tile_is_compat_view(tc, view)) {
       pipe_resource_reference(&tc->texture, texture);
 
       if (tc->tex_trans) {




More information about the mesa-commit mailing list