Mesa (master): llvmpipe: Convert some of the null checks back to asserts.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Sep 29 16:47:34 UTC 2011


Module: Mesa
Branch: master
Commit: 1da10443440800a6f5e4a4e6463737cce27706fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1da10443440800a6f5e4a4e6463737cce27706fd

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Sep 29 11:07:24 2011 +0100

llvmpipe: Convert some of the null checks back to asserts.

This turns some of the null check warnings in commit
023ca40d80670ac0eee8c755ca5f54b1e7c2712e back to asserts, as
the underlying cause of fdo bug 40591 should be fixed now.

---

 src/gallium/drivers/llvmpipe/lp_rast.c |   38 ++++++++++---------------------
 1 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 2bb61fc..1317858 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -334,20 +334,11 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
 {
    const struct lp_scene *scene = task->scene;
    const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
-   const struct lp_rast_state *state = task->state;
-   struct lp_fragment_shader_variant *variant = state->variant;
+   const struct lp_rast_state *state;
+   struct lp_fragment_shader_variant *variant;
    const unsigned tile_x = task->x, tile_y = task->y;
    unsigned x, y;
 
-   if (!variant) {
-      static boolean warned = FALSE;
-      if (!warned) {
-         debug_warning("null variant pointer");
-         warned = TRUE;
-      }
-      return;
-   }
-
    if (inputs->disable) {
       /* This command was partially binned and has been disabled */
       return;
@@ -355,6 +346,13 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
 
    LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
 
+   state = task->state;
+   assert(state);
+   if (!state) {
+      return;
+   }
+   variant = state->variant;
+
    /* render the whole 64x64 tile in 4x4 chunks */
    for (y = 0; y < TILE_SIZE; y += 4){
       for (x = 0; x < TILE_SIZE; x += 4) {
@@ -400,21 +398,13 @@ lp_rast_shade_tile_opaque(struct lp_rasterizer_task *task,
    const struct lp_scene *scene = task->scene;
    unsigned i;
 
+   LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
+
+   assert(task->state);
    if (!task->state) {
-      /* This indicates that some sort of rendering command was queued
-       * before we set up the rasterization state.  Just returning here
-       * allows the piglit fbo-mipmap-copypix test to run/pass.
-       */
-      static boolean warned = FALSE;
-      if (!warned) {
-         debug_warning("null state pointer");
-         warned = TRUE;
-      }
       return;
    }
 
-   LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
-
    /* this will prevent converting the layout from tiled to linear */
    for (i = 0; i < scene->fb.nr_cbufs; i++) {
       (void)lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
@@ -807,10 +797,6 @@ static PIPE_THREAD_ROUTINE( thread_func, init_data )
    boolean debug = false;
 
    while (1) {
-      /* make sure these pointers aren't pointing to old data */
-      task->scene = NULL;
-      task->state = NULL;
-
       /* wait for work */
       if (debug)
          debug_printf("thread %d waiting for work\n", task->thread_index);




More information about the mesa-commit mailing list