Module: Mesa Branch: gallium-0.1 Commit: 12df01af7b9b44f87f07723a8dfa925718475152 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=12df01af7b9b44f87f07723a8dfa925718475152
Author: Brian Paul <bri...@vmware.com> Date: Mon Feb 16 18:45:58 2009 -0700 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. --- src/gallium/drivers/softpipe/sp_tile_cache.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index b50c984..8c2f6d2 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 pipe_context *pipe, 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 pipe_context *pipe, 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 || _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit