diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-07-22 15:08:42 +0100 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-07-22 15:08:42 +0100 |
commit | f911c3b9897b90132c8621a72bfeb824eb3b01e5 (patch) | |
tree | 61243e5d616101304ffa36ad982b7c6e6da2e7b6 /src/gallium/drivers/softpipe/sp_tex_sample.c | |
parent | 13e2d35764e0c8de3356ee663885568fc00424f0 (diff) |
softpipe: shortcircuit repeated lookups of the same tile
The sp_tile_cache is often called repeatedly to look up the same
tile. Add a cache (to the cache) of the single tile most recently
retreived and make a quick inline check to see if this matches the
subsequent request.
Add a tile_address bitfield struct to make this check easier.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_tex_sample.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_tex_sample.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 3daa88eedd..46c56b0c83 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -680,11 +680,13 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, rgba[3][j] = sampler->border_color[3]; } else { - const int tx = x % TILE_SIZE; - const int ty = y % TILE_SIZE; - const struct softpipe_cached_tile *tile - = sp_get_cached_tile_tex(samp->cache, - x, y, z, face, level); + const unsigned tx = x % TILE_SIZE; + const unsigned ty = y % TILE_SIZE; + const struct softpipe_cached_tile *tile; + + tile = sp_get_cached_tile_tex(samp->cache, + tile_address(x, y, z, face, level)); + rgba[0][j] = tile->data.color[ty][tx][0]; rgba[1][j] = tile->data.color[ty][tx][1]; rgba[2][j] = tile->data.color[ty][tx][2]; |