Mesa (lp-binning): llvmpipe: clamp maxx,maxy to framebuffer size ( in terms of tiles)
Brian Paul
brianp at kemper.freedesktop.org
Wed Jan 13 00:17:08 UTC 2010
Module: Mesa
Branch: lp-binning
Commit: 214ffad01598c8780417b9fa9df75e951c8ac049
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=214ffad01598c8780417b9fa9df75e951c8ac049
Author: Brian Paul <brianp at vmware.com>
Date: Tue Jan 12 17:08:07 2010 -0700
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.
---
src/gallium/drivers/llvmpipe/lp_setup_tri.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 5197dca..9248125 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -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)
More information about the mesa-commit
mailing list