From da45f49cc63fff06513dc28d9616084fc81798d4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Jan 2010 14:41:02 +0000 Subject: llvmpipe: quick hack to short-circuit empty bins --- src/gallium/drivers/llvmpipe/lp_rast.c | 23 ++++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_setup.c | 4 +++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 38c27b90e3..4c13d4d80b 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -576,6 +576,26 @@ rasterize_bin( struct lp_rasterizer *rast, lp_rast_end_tile( rast, thread_index ); } +static boolean +is_empty_bin( struct lp_rasterizer *rast, + const struct cmd_bin *bin ) +{ + const struct cmd_block *head = bin->commands.head; + int i; + + if (head->next != NULL || + head->count > PIPE_MAX_COLOR_BUFS + 1) + return FALSE; + + for (i = 0; i < head->count; i++) + if (head->cmd[i] != lp_rast_load_color && + head->cmd[i] != lp_rast_load_zstencil) + return FALSE; + + return TRUE; +} + + /** * Rasterize/execute all bins within a scene. @@ -606,7 +626,8 @@ rasterize_scene( struct lp_rasterizer *rast, assert(scene); while ((bin = lp_scene_bin_iter_next(scene, &x, &y))) { - rasterize_bin( rast, thread_index, bin, x * TILE_SIZE, y * TILE_SIZE); + if (!is_empty_bin( rast, bin )) + rasterize_bin( rast, thread_index, bin, x * TILE_SIZE, y * TILE_SIZE); } } #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 74f3054864..38ea0c663f 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -153,7 +153,9 @@ begin_binning( struct setup_context *setup ) { struct lp_scene *scene = lp_setup_get_current_scene(setup); - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s color: %s depth: %s\n", __FUNCTION__, + (setup->clear.flags & PIPE_CLEAR_COLOR) ? "clear": "load", + (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) ? "clear": "load"); if (setup->fb.nr_cbufs) { if (setup->clear.flags & PIPE_CLEAR_COLOR) -- cgit v1.2.3