From: Brian Paul Date: Tue, 17 Feb 2009 01:45:58 +0000 (-0700) Subject: softpipe: some improvements to texture tile cache X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=07855a1d766e21e4a017a5f9f19936ce5511e088;p=mesa.git softpipe: some improvements to texture tile cache Use a somewhat better function in tex_cache_pos() to get better caching. Increase number of cache entries to 50. Also fix a texture invalidation bug. If texture is marked as modified, invalidate all texture tiles. --- diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index ab76009375c..bd5a672f77e 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -40,7 +40,7 @@ #include "sp_texture.h" #include "sp_tile_cache.h" -#define NUM_ENTRIES 32 +#define NUM_ENTRIES 50 /** XXX move these */ @@ -484,7 +484,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe, static INLINE uint tex_cache_pos(int x, int y, int z, int face, int level) { - uint entry = x + y * 5 + z * 4 + face + level; + uint entry = x + y * 9 + z * 3 + face + level * 7; return entry % NUM_ENTRIES; } @@ -510,8 +510,12 @@ sp_get_cached_tile_tex(struct softpipe_context *sp, if (tc->texture) { struct softpipe_texture *spt = softpipe_texture(tc->texture); if (spt->modified) { - /* texture was modified, force a cache reload */ - tile->x = -1; + /* texture was modified, invalidate all cached tiles */ + uint p; + for (p = 0; p < NUM_ENTRIES; p++) { + tile = tc->entries + p; + tile->x = -1; + } spt->modified = FALSE; } } @@ -523,6 +527,10 @@ sp_get_cached_tile_tex(struct softpipe_context *sp, level != tile->level) { /* cache miss */ +#if 0 + printf("miss at %u x=%d y=%d z=%d face=%d level=%d\n", pos, + x/TILE_SIZE, y/TILE_SIZE, z, face, level); +#endif /* check if we need to get a new surface */ if (!tc->tex_surf || tc->tex_face != face ||