llvmpipe: quick hack to short-circuit empty bins
authorKeith Whitwell <keithw@vmware.com>
Wed, 13 Jan 2010 14:41:02 +0000 (14:41 +0000)
committerKeith Whitwell <keithw@vmware.com>
Wed, 13 Jan 2010 15:18:32 +0000 (15:18 +0000)
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_setup.c

index 38c27b90e357cb343c781faaec4b385068195f67..4c13d4d80b5d823cde028953a588b1f5ee6977d7 100644 (file)
@@ -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
index 74f3054864c99359e57d3f1fff1b179d840115fe..38ea0c663f14b8a0dc5ec259e1ab940cdf3eda73 100644 (file)
@@ -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)