summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_tex_sample.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-07-22 15:08:42 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-08-29 09:21:17 +0100
commit2301314e7ccd37faae80353d35109bb029dc9335 (patch)
tree2204dad40e37adbaa8bb70bd6f07c34f674b7786 /src/gallium/drivers/llvmpipe/lp_tex_sample.c
parentdf1823ec5b2c64a9d1a5fc13be0e0f37741c3ffa (diff)
llvmpipe: shortcircuit repeated lookups of the same tile
The lp_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/llvmpipe/lp_tex_sample.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 5a11ba0175..d24845cac9 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_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 llvmpipe_cached_tile *tile
- = lp_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 llvmpipe_cached_tile *tile;
+
+ tile = lp_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];