From e8f48b1dc99a8db05c07d442acd3baf8f3620f6e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 2 May 2010 17:37:18 +1000 Subject: 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 --- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gallium') 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) { -- cgit v1.2.3