mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 22:18:13 +02:00
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.
This commit is contained in:
parent
591401ff05
commit
62623c4dc5
3 changed files with 65 additions and 0 deletions
|
|
@ -45,6 +45,9 @@ st_print_current(void);
|
|||
#define DEBUG_QUERY 0x40
|
||||
#define DEBUG_SCREEN 0x80
|
||||
#define DEBUG_JIT 0x100
|
||||
#define DEBUG_SHOW_TILES 0x200
|
||||
#define DEBUG_SHOW_SUBTILES 0x400
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int LP_DEBUG;
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ static const struct debug_named_value lp_debug_flags[] = {
|
|||
{ "query", DEBUG_QUERY },
|
||||
{ "screen", DEBUG_SCREEN },
|
||||
{ "jit", DEBUG_JIT },
|
||||
{ "show_tiles", DEBUG_SHOW_TILES },
|
||||
{ "show_subtiles", DEBUG_SHOW_SUBTILES },
|
||||
{NULL, 0}
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue