diff options
author | Brian Paul <[email protected]> | 2014-01-15 18:09:56 -0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-01-17 08:52:11 -0800 |
commit | d6fa71fbb0d365cefdabfea9de62cfece71f7486 (patch) | |
tree | a92afaaefdd8163c05a1fdbb17d529a635faef5a /src/gallium/drivers/llvmpipe/lp_rast.c | |
parent | 7b4ceec0b7591fa7a2dd66c45727341f52bf5258 (diff) |
llvmpipe: handle NULL color buffer pointers
Fixes regression from 9baa45f78b8ca7d66280e36009b6a685055d7cd6
v2: incorporate a few small changes suggested by Roland.
Reviewed-by: José Fonseca <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 6feec947137..6ee849b64ad 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -110,6 +110,25 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task, /** + * Examine a framebuffer object to determine if any of the colorbuffers + * use a pure integer format. + * XXX this could be a gallium utility function if useful elsewhere. + */ +static boolean +is_fb_pure_integer(const struct pipe_framebuffer_state *fb) +{ + unsigned i; + for (i = 0; i < fb->nr_cbufs; i++) { + if (fb->cbufs[i] && + util_format_is_pure_integer(fb->cbufs[i]->format)) { + return TRUE; + } + } + return FALSE; +} + + +/** * Clear the rasterizer's current color tile. * This is a bin command called during bin processing. * Clear commands always clear all bound layers. @@ -124,7 +143,7 @@ lp_rast_clear_color(struct lp_rasterizer_task *task, unsigned i; union util_color uc; - if (util_format_is_pure_integer(scene->fb.cbufs[0]->format)) { + if (is_fb_pure_integer(&scene->fb)) { /* * We expect int/uint clear values here, though some APIs * might disagree (but in any case util_pack_color() @@ -174,20 +193,22 @@ lp_rast_clear_color(struct lp_rasterizer_task *task, clear_color[3]); for (i = 0; i < scene->fb.nr_cbufs; i++) { - util_pack_color(arg.clear_color.f, - scene->fb.cbufs[i]->format, &uc); - - util_fill_box(scene->cbufs[i].map, - scene->fb.cbufs[i]->format, - scene->cbufs[i].stride, - scene->cbufs[i].layer_stride, - task->x, - task->y, - 0, - task->width, - task->height, - scene->fb_max_layer + 1, - &uc); + if (scene->fb.cbufs[i]) { + util_pack_color(arg.clear_color.f, + scene->fb.cbufs[i]->format, &uc); + + util_fill_box(scene->cbufs[i].map, + scene->fb.cbufs[i]->format, + scene->cbufs[i].stride, + scene->cbufs[i].layer_stride, + task->x, + task->y, + 0, + task->width, + task->height, + scene->fb_max_layer + 1, + &uc); + } } } } @@ -444,8 +465,15 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, /* color buffer */ for (i = 0; i < scene->fb.nr_cbufs; i++) { - stride[i] = scene->cbufs[i].stride; - color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, x, y, inputs->layer); + if (scene->fb.cbufs[i]) { + stride[i] = scene->cbufs[i].stride; + color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, x, y, + inputs->layer); + } + else { + stride[i] = 0; + color[i] = NULL; + } } /* depth buffer */ |