diff options
author | Roland Scheidegger <[email protected]> | 2013-06-13 00:40:34 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-13 00:41:43 +0200 |
commit | 4cce4efaa38e95c121343565de5e517345d6a9dd (patch) | |
tree | dab5bd208a95271819e8e5f4f7adc05f7ac81c14 /src/gallium/drivers/llvmpipe/lp_rast.c | |
parent | 957c040eb86495da2a693c831e13342a81ac1a2e (diff) |
util: new util_fill_box helper
Use new util_fill_box helper for util_clear_render_target.
(Also fix off-by-one map error.)
v2: handle non-zero z correctly in new helper
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index dcd66ab00c1..79d4c588d12 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -135,8 +135,6 @@ lp_rast_clear_color(struct lp_rasterizer_task *task, for (i = 0; i < scene->fb.nr_cbufs; i++) { enum pipe_format format = scene->fb.cbufs[i]->format; - unsigned layer; - uint8_t *map_layer = scene->cbufs[i].map; if (util_format_is_pure_sint(format)) { util_format_write_4i(format, arg.clear_color.i, 0, &uc, 0, 0, 0, 1, 1); @@ -146,17 +144,17 @@ lp_rast_clear_color(struct lp_rasterizer_task *task, util_format_write_4ui(format, arg.clear_color.ui, 0, &uc, 0, 0, 0, 1, 1); } - for (layer = 0; layer <= scene->fb_max_layer; layer++) { - util_fill_rect(map_layer, - scene->fb.cbufs[i]->format, - scene->cbufs[i].stride, - task->x, - task->y, - task->width, - task->height, - &uc); - map_layer += scene->cbufs[i].layer_stride; - } + util_fill_box(scene->cbufs[i].map, + 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); } } else { @@ -173,22 +171,20 @@ lp_rast_clear_color(struct lp_rasterizer_task *task, clear_color[3]); for (i = 0; i < scene->fb.nr_cbufs; i++) { - unsigned layer; - uint8_t *map_layer = scene->cbufs[i].map; - - for (layer = 0; layer <= scene->fb_max_layer; layer++) { - util_pack_color(arg.clear_color.f, - scene->fb.cbufs[i]->format, &uc); - util_fill_rect(map_layer, - scene->fb.cbufs[i]->format, - scene->cbufs[i].stride, - task->x, - task->y, - task->width, - task->height, - &uc); - map_layer += scene->cbufs[i].layer_stride; - } + 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); } } } |