diff options
author | Roland Scheidegger <[email protected]> | 2017-06-23 19:35:50 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2017-06-23 19:39:29 +0200 |
commit | c7688d2de5bb0861965e6e7b76a396ab6eec253f (patch) | |
tree | 249bae051093db2dc686917d2688fbae8f27f36c /src/gallium/drivers/llvmpipe/lp_setup_line.c | |
parent | 672d245ffe85e85afe6ddd36868c145bb528c79b (diff) |
llvmpipe:fix using 32bit rasterization mistakenly, causing overflows
We use the bounding box (triangle extents) to figure out if 32bit rasterization
could potentially overflow. However, we used the bounding box which already got
rounded up to 0 for negative coords for this, which is incorrect, leading to
overflows and hence bogus rendering in some of our private use.
It might be possible to simplify this somehow (we're now using 3 different
boxes for binning) but I don't quite see how.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_line.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 018130c3192..d0bac5efb99 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -288,7 +288,9 @@ try_setup_line( struct lp_setup_context *setup, struct lp_rast_plane *plane; struct lp_line_info info; float width = MAX2(1.0, setup->line_width); - struct u_rect bbox; + const struct u_rect *scissor; + struct u_rect bbox, bboxpos; + boolean s_planes[4]; unsigned tri_bytes; int x[4]; int y[4]; @@ -579,10 +581,12 @@ try_setup_line( struct lp_setup_context *setup, return TRUE; } + bboxpos = bbox; + /* Can safely discard negative regions: */ - bbox.x0 = MAX2(bbox.x0, 0); - bbox.y0 = MAX2(bbox.y0, 0); + bboxpos.x0 = MAX2(bboxpos.x0, 0); + bboxpos.y0 = MAX2(bboxpos.y0, 0); nr_planes = 4; /* @@ -591,8 +595,8 @@ try_setup_line( struct lp_setup_context *setup, */ if (setup->scissor_test) { /* why not just use draw_regions */ - boolean s_planes[4]; - scissor_planes_needed(s_planes, &bbox, &setup->scissors[viewport_index]); + scissor = &setup->scissors[viewport_index]; + scissor_planes_needed(s_planes, &bboxpos, scissor); nr_planes += s_planes[0] + s_planes[1] + s_planes[2] + s_planes[3]; } @@ -718,11 +722,7 @@ try_setup_line( struct lp_setup_context *setup, * (easier to evaluate) to ordinary planes.) */ if (nr_planes > 4) { - /* why not just use draw_regions */ - const struct u_rect *scissor = &setup->scissors[viewport_index]; struct lp_rast_plane *plane_s = &plane[4]; - boolean s_planes[4]; - scissor_planes_needed(s_planes, &bbox, scissor); if (s_planes[0]) { plane_s->dcdx = -1 << 8; @@ -755,7 +755,7 @@ try_setup_line( struct lp_setup_context *setup, assert(plane_s == &plane[nr_planes]); } - return lp_setup_bin_triangle(setup, line, &bbox, nr_planes, viewport_index); + return lp_setup_bin_triangle(setup, line, &bbox, &bboxpos, nr_planes, viewport_index); } |