summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-05-02 17:37:18 +1000
committerDave Airlie <[email protected]>2010-05-03 16:27:42 +1000
commite8f48b1dc99a8db05c07d442acd3baf8f3620f6e (patch)
treecbf2ad98ae9767363d44eb7932948afae82129e7 /src/gallium
parent26a9b7e4c737c89b47844303bb7413ceab0280a5 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c16
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 fbce9e042ba..b3e1c494069 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) {