Mesa (master): llvmpipe: scale up bounding box planes to subpixel precision

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Jan 13 03:00:10 UTC 2016


Module: Mesa
Branch: master
Commit: 16530fdc82cde61495c66abe704e88d7752dfdbf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16530fdc82cde61495c66abe704e88d7752dfdbf

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Sun Jan  3 01:13:45 2016 +0100

llvmpipe: scale up bounding box planes to subpixel precision

Otherwise some planes we get in rasterization have subpixel precision, others
not. Doesn't matter so far, but will soon. (OpenGL actually supports viewports
with subpixel accuracy, so could even do bounding box calcs with that).

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/drivers/llvmpipe/lp_setup_line.c  |   20 ++++++++++----------
 src/gallium/drivers/llvmpipe/lp_setup_point.c |   20 ++++++++++----------
 src/gallium/drivers/llvmpipe/lp_setup_tri.c   |   20 ++++++++++----------
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index a0de599..f425825 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -713,24 +713,24 @@ try_setup_line( struct lp_setup_context *setup,
       const struct u_rect *scissor =
          &setup->scissors[viewport_index];
 
-      plane[4].dcdx = -1;
+      plane[4].dcdx = -1 << 8;
       plane[4].dcdy = 0;
-      plane[4].c = 1-scissor->x0;
-      plane[4].eo = 1;
+      plane[4].c = (1-scissor->x0) << 8;
+      plane[4].eo = 1 << 8;
 
-      plane[5].dcdx = 1;
+      plane[5].dcdx = 1 << 8;
       plane[5].dcdy = 0;
-      plane[5].c = scissor->x1+1;
+      plane[5].c = (scissor->x1+1) << 8;
       plane[5].eo = 0;
 
       plane[6].dcdx = 0;
-      plane[6].dcdy = 1;
-      plane[6].c = 1-scissor->y0;
-      plane[6].eo = 1;
+      plane[6].dcdy = 1 << 8;
+      plane[6].c = (1-scissor->y0) << 8;
+      plane[6].eo = 1 << 8;
 
       plane[7].dcdx = 0;
-      plane[7].dcdy = -1;
-      plane[7].c = scissor->y1+1;
+      plane[7].dcdy = -1 << 8;
+      plane[7].c = (scissor->y1+1) << 8;
       plane[7].eo = 0;
    }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 14c389f..ddb6f0e 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -492,24 +492,24 @@ try_setup_point( struct lp_setup_context *setup,
    {
       struct lp_rast_plane *plane = GET_PLANES(point);
 
-      plane[0].dcdx = -1;
+      plane[0].dcdx = -1 << 8;
       plane[0].dcdy = 0;
-      plane[0].c = 1-bbox.x0;
-      plane[0].eo = 1;
+      plane[0].c = (1-bbox.x0) << 8;
+      plane[0].eo = 1 << 8;
 
-      plane[1].dcdx = 1;
+      plane[1].dcdx = 1 << 8;
       plane[1].dcdy = 0;
-      plane[1].c = bbox.x1+1;
+      plane[1].c = (bbox.x1+1) << 8;
       plane[1].eo = 0;
 
       plane[2].dcdx = 0;
-      plane[2].dcdy = 1;
-      plane[2].c = 1-bbox.y0;
-      plane[2].eo = 1;
+      plane[2].dcdy = 1 << 8;
+      plane[2].c = (1-bbox.y0) << 8;
+      plane[2].eo = 1 << 8;
 
       plane[3].dcdx = 0;
-      plane[3].dcdy = -1;
-      plane[3].c = bbox.y1+1;
+      plane[3].dcdy = -1 << 8;
+      plane[3].c = (bbox.y1+1) << 8;
       plane[3].eo = 0;
    }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 6914882..4925da9 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -676,24 +676,24 @@ do_triangle_ccw(struct lp_setup_context *setup,
    if (nr_planes == 7) {
       const struct u_rect *scissor = &setup->scissors[viewport_index];
 
-      plane[3].dcdx = -1;
+      plane[3].dcdx = -1 << 8;
       plane[3].dcdy = 0;
-      plane[3].c = 1-scissor->x0;
-      plane[3].eo = 1;
+      plane[3].c = (1-scissor->x0) << 8;
+      plane[3].eo = 1 << 8;
 
-      plane[4].dcdx = 1;
+      plane[4].dcdx = 1 << 8;
       plane[4].dcdy = 0;
-      plane[4].c = scissor->x1+1;
+      plane[4].c = (scissor->x1+1) << 8;
       plane[4].eo = 0;
 
       plane[5].dcdx = 0;
-      plane[5].dcdy = 1;
-      plane[5].c = 1-scissor->y0;
-      plane[5].eo = 1;
+      plane[5].dcdy = 1 << 8;
+      plane[5].c = (1-scissor->y0) << 8;
+      plane[5].eo = 1 << 8;
 
       plane[6].dcdx = 0;
-      plane[6].dcdy = -1;
-      plane[6].c = scissor->y1+1;
+      plane[6].dcdy = -1 << 8;
+      plane[6].c = (scissor->y1+1) << 8;
       plane[6].eo = 0;
    }
 




More information about the mesa-commit mailing list