summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_quad_depth_test.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-19 10:10:08 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-19 10:10:08 -0600
commit2b2f761e2b0dc160793be2f48e811d2d455e1e22 (patch)
tree390bd4395ff8f92a84c586142e3703bf32fad006 /src/mesa/pipe/softpipe/sp_quad_depth_test.c
parent46c3cf18315345effd15a69987294c1195843e2a (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_depth_test.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index ff1d84a02d..efd08b981c 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -32,6 +32,7 @@
#include "sp_headers.h"
#include "sp_surface.h"
#include "sp_quad.h"
+#include "sp_tile_cache.h"
/**
@@ -48,6 +49,9 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
unsigned zmask = 0;
unsigned j;
float scale;
+#if 0
+ struct cached_tile *tile = sp_get_cached_tile(softpipe, quad->x0, quad->y0);
+#endif
assert(sps); /* shouldn't get here if there's no zbuffer */
@@ -74,8 +78,16 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
qzzzz[j] = (unsigned) (quad->outputs.depth[j] * scale);
}
+#if 0
+ for (j = 0; j < 4; j++) {
+ int x = quad->x0 % TILE_SIZE + (j & 1);
+ int y = quad->y0 % TILE_SIZE + (j >> 1);
+ bzzzz[j] = tile->depth[y][x];
+ }
+#else
/* get zquad from zbuffer */
sps->read_quad_z(sps, quad->x0, quad->y0, bzzzz);
+#endif
switch (softpipe->depth_stencil->depth.func) {
case PIPE_FUNC_NEVER:
@@ -139,8 +151,16 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
}
}
+#if 1
/* write updated zquad to zbuffer */
sps->write_quad_z(sps, quad->x0, quad->y0, bzzzz);
+#else
+ for (j = 0; j < 4; j++) {
+ int x = quad->x0 % TILE_SIZE + (j & 1);
+ int y = quad->y0 % TILE_SIZE + (j >> 1);
+ tile->depth[y][x] = bzzzz[j];
+ }
+#endif
}
}