mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
llvmpipe: clamp maxx,maxy to framebuffer size (in terms of tiles)
In some corner cases the right-most / bottom-most vertex can be right on the edge of the framebuffer. Because the maxx, maxy vals are computed with a series of float/int, pixel/tile transformations we can end up with maxx >= scene->x_tiles or maxy >= scene->y_tiles. This leads to putting data into bins that never get processed, or reset. This becomes stale data that can lead to segfaults. Clamping fixes this.
This commit is contained in:
parent
de10168a46
commit
214ffad015
1 changed files with 5 additions and 0 deletions
|
|
@ -389,6 +389,11 @@ do_triangle_ccw(struct setup_context *setup,
|
|||
maxx = tri->maxx / TILE_SIZE;
|
||||
maxy = tri->maxy / TILE_SIZE;
|
||||
|
||||
/* Clamp maxx, maxy to framebuffer size
|
||||
*/
|
||||
maxx = MIN2(maxx, scene->tiles_x - 1);
|
||||
maxy = MIN2(maxy, scene->tiles_y - 1);
|
||||
|
||||
/* Determine which tile(s) intersect the triangle's bounding box
|
||||
*/
|
||||
if (miny == maxy && minx == maxx)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue