diff options
author | Brian Paul <[email protected]> | 2011-09-09 13:59:20 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-09 14:00:55 -0600 |
commit | 023ca40d80670ac0eee8c755ca5f54b1e7c2712e (patch) | |
tree | 60d74f33b72ddc79e742e39719f93b331ab91301 /src/gallium/drivers/llvmpipe/lp_rast.c | |
parent | e12b4752ef3cbc181d84c1eba672760f120ad346 (diff) |
llvmpipe: add some null pointer checks
It's not clear if these are acceptable cases so issue a one-time warning
in debug builds when we hit them.
Fixes segfault in piglit fbo-mipmap-copypix test.
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index dafadc1ea9b..2bb61fcc7c4 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -339,6 +339,15 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, 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; @@ -391,6 +400,19 @@ lp_rast_shade_tile_opaque(struct lp_rasterizer_task *task, const struct lp_scene *scene = task->scene; unsigned i; + 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 */ @@ -785,6 +807,10 @@ 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); |