summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_rast.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-18 13:10:10 -0700
committerBrian Paul <[email protected]>2010-01-18 13:10:14 -0700
commit62623c4dc5d8b646942bc65e8de350e812945ad1 (patch)
tree783845aaee1deab515f23727fa3c097ddf29354c /src/gallium/drivers/llvmpipe/lp_rast.c
parent591401ff05f878ff1607a1a34db1319103025d8f (diff)
llvmpipe: added show_tiles and show_subtiles debug options
These options draw lines over the tiles to show the 64x64 tile bounds and 16x16 sub-tile bounds. For debugging/visualization.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 2e2ebee45de..440bb322358 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -461,6 +461,61 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
}
+#ifdef DEBUG
+/**
+ * Set top row and left column of the tile's pixels to white. For debugging.
+ */
+static void
+outline_tile(uint8_t *tile)
+{
+ const uint8_t val = 0xff;
+ unsigned i;
+
+ for (i = 0; i < TILE_SIZE; i++) {
+ TILE_PIXEL(tile, i, 0, 0) = val;
+ TILE_PIXEL(tile, i, 0, 1) = val;
+ TILE_PIXEL(tile, i, 0, 2) = val;
+ TILE_PIXEL(tile, i, 0, 3) = val;
+
+ TILE_PIXEL(tile, 0, i, 0) = val;
+ TILE_PIXEL(tile, 0, i, 1) = val;
+ TILE_PIXEL(tile, 0, i, 2) = val;
+ TILE_PIXEL(tile, 0, i, 3) = val;
+ }
+}
+#endif /* DEBUG */
+
+
+#ifdef DEBUG
+/**
+ * Draw grid of gray lines at 16-pixel intervals across the tile to
+ * show the sub-tile boundaries. For debugging.
+ */
+static void
+outline_subtiles(uint8_t *tile)
+{
+ const uint8_t val = 0x80;
+ const unsigned step = 16;
+ unsigned i, j;
+
+ for (i = 0; i < TILE_SIZE; i += 16) {
+ for (j = 0; j < TILE_SIZE; j++) {
+ TILE_PIXEL(tile, i, j, 0) = val;
+ TILE_PIXEL(tile, i, j, 1) = val;
+ TILE_PIXEL(tile, i, j, 2) = val;
+ TILE_PIXEL(tile, i, j, 3) = val;
+
+ TILE_PIXEL(tile, j, i, 0) = val;
+ TILE_PIXEL(tile, j, i, 1) = val;
+ TILE_PIXEL(tile, j, i, 2) = val;
+ TILE_PIXEL(tile, j, i, 3) = val;
+ }
+ }
+
+ outline_tile(tile);
+}
+#endif /* DEBUG */
+
/**
@@ -500,6 +555,11 @@ static void lp_rast_store_color( struct lp_rasterizer *rast,
LP_DBG(DEBUG_RAST, "%s [%u] %d,%d %dx%d\n", __FUNCTION__,
thread_index, x, y, w, h);
+ if (LP_DEBUG & DEBUG_SHOW_SUBTILES)
+ outline_subtiles(rast->tasks[thread_index].tile.color[i]);
+ else if (LP_DEBUG & DEBUG_SHOW_TILES)
+ outline_tile(rast->tasks[thread_index].tile.color[i]);
+
lp_tile_write_4ub(transfer->texture->format,
rast->tasks[thread_index].tile.color[i],
rast->cbuf_map[i],