softpipe: also shortcircuit non-texture tile lookups
[mesa.git] / src / gallium / drivers / softpipe / sp_tile_cache.h
index 3017fcbebc96199d23f48ce76c57adfcf9341e94..ac2aae587589efc5f9c70715844b4fff468deae5 100644 (file)
@@ -141,7 +141,8 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba,
                     uint clearValue);
 
 extern struct softpipe_cached_tile *
-sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y);
+sp_find_cached_tile(struct softpipe_tile_cache *tc, 
+                    union tile_address addr );
 
 extern const struct softpipe_cached_tile *
 sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, 
@@ -179,6 +180,19 @@ sp_get_cached_tile_tex(struct softpipe_tile_cache *tc,
 }
 
 
+static INLINE struct softpipe_cached_tile *
+sp_get_cached_tile(struct softpipe_tile_cache *tc, 
+                   int x, int y )
+{
+   union tile_address addr = tile_address( x, y, 0, 0, 0 );
+
+   if (tc->last_tile->addr.value == addr.value)
+      return tc->last_tile;
+
+   return sp_find_cached_tile( tc, addr );
+}
+
+
 
 
 #endif /* SP_TILE_CACHE_H */