Mesa (lp-binning): llvmpipe: properly clip tile writes

Keith Whitwell keithw at kemper.freedesktop.org
Fri Oct 9 15:21:06 UTC 2009


Module: Mesa
Branch: lp-binning
Commit: 05131f7502150968d7ee19673676f74d4c2fd22b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=05131f7502150968d7ee19673676f74d4c2fd22b

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Oct  9 16:19:00 2009 +0100

llvmpipe: properly clip tile writes

---

 src/gallium/drivers/llvmpipe/lp_rast.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index e733315..3585011 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -269,15 +269,23 @@ static void lp_rast_store_color( struct lp_rasterizer *rast )
 {
    const unsigned x = rast->x;
    const unsigned y = rast->y;
+   unsigned w = TILESIZE;
+   unsigned h = TILESIZE;
 
-   RAST_DEBUG("%s %d,%d\n", __FUNCTION__, x, y);
+   if (x + w > rast->width)
+      w -= x + w - rast->width;
+
+   if (y + h > rast->height)
+      h -= y + h - rast->height;
+
+   RAST_DEBUG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
 
    lp_tile_write_4ub(rast->cbuf_transfer->format,
                      rast->tile.color,
                      rast->cbuf_map, 
                      rast->cbuf_transfer->stride,
                      x, y,
-                     TILESIZE, TILESIZE);
+                     w, h);
 }
 
 




More information about the mesa-commit mailing list