summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_tile_cache.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-20 13:24:52 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-02-20 13:24:52 -0700
commitd5640a2dbdc4454d0405f2cd5b18fc49b1ca7694 (patch)
tree5e0ed97d89f54d9f40c1911f926ead5a65c7e37d /src/gallium/drivers/softpipe/sp_tile_cache.c
parent1d45787d4a70c55e7fa899d13b9139430e2fa3e2 (diff)
gallium: new pipe->texture_update() function
Called whenever texture data is changed (glTexImage, glTexSubImage, glCopyTexSubImage, etc).
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_tile_cache.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 9ed3c5072d..da30dd6c48 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -359,30 +359,37 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
struct pipe_surface *ps = tc->surface;
int inuse = 0, pos;
- if (!ps || !ps->buffer)
- return;
-
- for (pos = 0; pos < NUM_ENTRIES; pos++) {
- struct softpipe_cached_tile *tile = tc->entries + pos;
- if (tile->x >= 0) {
- if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
- tile->x, tile->y, TILE_SIZE, TILE_SIZE,
- tile->data.depth32, 0/*STRIDE*/);
- }
- else {
- pipe_put_tile_rgba(pipe, ps,
- tile->x, tile->y, TILE_SIZE, TILE_SIZE,
- (float *) tile->data.color);
+ if (ps && ps->buffer) {
+ /* caching a drawing surface */
+ for (pos = 0; pos < NUM_ENTRIES; pos++) {
+ struct softpipe_cached_tile *tile = tc->entries + pos;
+ if (tile->x >= 0) {
+ if (tc->depth_stencil) {
+ pipe_put_tile_raw(pipe, ps,
+ tile->x, tile->y, TILE_SIZE, TILE_SIZE,
+ tile->data.depth32, 0/*STRIDE*/);
+ }
+ else {
+ pipe_put_tile_rgba(pipe, ps,
+ tile->x, tile->y, TILE_SIZE, TILE_SIZE,
+ (float *) tile->data.color);
+ }
+ tile->x = tile->y = -1; /* mark as empty */
+ inuse++;
}
- tile->x = tile->y = -1; /* mark as empty */
- inuse++;
}
- }
#if TILE_CLEAR_OPTIMIZATION
- sp_tile_cache_flush_clear(&softpipe->pipe, tc);
+ sp_tile_cache_flush_clear(&softpipe->pipe, tc);
#endif
+ }
+ else if (tc->texture) {
+ /* caching a texture, mark all entries as embpy */
+ for (pos = 0; pos < NUM_ENTRIES; pos++) {
+ tc->entries[pos].x = -1;
+ }
+ tc->tex_face = -1;
+ }
#if 0
debug_printf("flushed tiles in use: %d\n", inuse);