diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-10-19 10:10:08 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-10-19 10:10:08 -0600 |
commit | 2b2f761e2b0dc160793be2f48e811d2d455e1e22 (patch) | |
tree | 390bd4395ff8f92a84c586142e3703bf32fad006 /src/mesa/pipe/softpipe/sp_quad_colormask.c | |
parent | 46c3cf18315345effd15a69987294c1195843e2a (diff) |
Initial implementation of surface tile caching.
Instead of using read/write_quad() functions, do framebuffer accesses via
get/put_tile(). A cache of tiles is used to avoid frequent get/put() calls.
Only implemented for color buffers right now.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_quad_colormask.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_colormask.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/mesa/pipe/softpipe/sp_quad_colormask.c index c3e110532a..aa69f53580 100644 --- a/src/mesa/pipe/softpipe/sp_quad_colormask.c +++ b/src/mesa/pipe/softpipe/sp_quad_colormask.c @@ -36,17 +36,31 @@ #include "sp_headers.h" #include "sp_surface.h" #include "sp_quad.h" +#include "sp_tile_cache.h" +/** + * XXX colormask could be rolled into blending... + */ static void colormask_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf); float dest[4][QUAD_SIZE]; - - sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest); + struct softpipe_cached_tile * + tile = sp_get_cached_tile(sps, quad->x0, quad->y0); + uint i, j; + + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = (quad->x0 & (TILE_SIZE-1)) + (j & 1); + int y = (quad->y0 & (TILE_SIZE-1)) + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } + } /* R */ if (!(softpipe->blend->colormask & PIPE_MASK_R)) |