summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-09-19 15:05:51 +0100
committerDave Airlie <airlied@redhat.com>2011-10-11 16:13:29 +0100
commit396ac41fc285f0d7c8545f2b32ba373693a7a326 (patch)
tree87d0cf64099675219014c5f5a0466e97cc4a089d /src/gallium/drivers/softpipe/sp_tex_tile_cache.c
parent866f9b18c68ede63c00917ec9c3dae3524ca8826 (diff)
softpipe: add integer support
This adds support to the clear and tile caches for integer storage and clearing, avoiding any floating paths. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_tex_tile_cache.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index e589ee7c841..2e665c9ee35 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -35,6 +35,7 @@
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_tile.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "sp_context.h"
#include "sp_texture.h"
@@ -228,7 +229,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
union tex_tile_address addr )
{
struct softpipe_tex_cached_tile *tile;
-
+
tile = tc->entries + tex_cache_pos( addr );
if (addr.value != tile->addr.value) {
@@ -290,15 +291,34 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
/* Get tile from the transfer (view into texture), explicitly passing
* the image format.
*/
- pipe_get_tile_rgba_format(tc->pipe,
+ if (util_format_is_pure_uint(tc->format)) {
+ pipe_get_tile_ui_format(tc->pipe,
+ tc->tex_trans,
+ addr.bits.x * TILE_SIZE,
+ addr.bits.y * TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
+ tc->format,
+ (unsigned *) tile->data.colorui);
+ } else if (util_format_is_pure_sint(tc->format)) {
+ pipe_get_tile_i_format(tc->pipe,
tc->tex_trans,
- addr.bits.x * TILE_SIZE,
+ addr.bits.x * TILE_SIZE,
addr.bits.y * TILE_SIZE,
TILE_SIZE,
- TILE_SIZE,
+ TILE_SIZE,
tc->format,
- (float *) tile->data.color);
-
+ (int *) tile->data.colori);
+ } else {
+ pipe_get_tile_rgba_format(tc->pipe,
+ tc->tex_trans,
+ addr.bits.x * TILE_SIZE,
+ addr.bits.y * TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
+ tc->format,
+ (float *) tile->data.color);
+ }
tile->addr = addr;
}