Mesa (master): llvmpipe: try to keep plane c values small

Keith Whitwell keithw at kemper.freedesktop.org
Tue Oct 12 10:50:52 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Oct 12 11:02:19 2010 +0100

llvmpipe: try to keep plane c values small

Avoid accumulating more and more fixed point bits.

---

 src/gallium/drivers/llvmpipe/lp_setup_line.c |    3 +-
 src/gallium/drivers/llvmpipe/lp_setup_tri.c  |   38 +++++++++++++++----------
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index 693ac28..c940860 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -640,8 +640,7 @@ try_setup_line( struct lp_setup_context *setup,
          }
       }
 
-      plane->dcdx *= FIXED_ONE;
-      plane->dcdy *= FIXED_ONE;
+      plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE;
 
       /* find trivial reject offsets for each edge for a single-pixel
        * sized block.  These will be scaled up at each recursive level to
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 8fd0346..dfe1bd1 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -343,26 +343,34 @@ do_triangle_ccw(struct lp_setup_context *setup,
        * Also, sometimes (in FBO cases) GL will render upside down
        * to its usual method, in which case it will probably want
        * to use the opposite, top-left convention.
+       *
+       * XXX: Chances are this will get stripped away.  In fact this
+       * is only meaningful if:
+       *
+       *          (plane->c & (FIXED_ONE-1)) == 0
+       *
        */         
-      if (plane->dcdx < 0) {
-         /* both fill conventions want this - adjust for left edges */
-         plane->c++;            
-      }
-      else if (plane->dcdx == 0) {
-         if (setup->pixel_offset == 0) {
-            /* correct for top-left fill convention:
-             */
-            if (plane->dcdy > 0) plane->c++;
+      if ((plane->c & (FIXED_ONE-1)) == 0) {
+         if (plane->dcdx < 0) {
+            /* both fill conventions want this - adjust for left edges */
+            plane->c++;            
          }
-         else {
-            /* correct for bottom-left fill convention:
-             */
-            if (plane->dcdy < 0) plane->c++;
+         else if (plane->dcdx == 0) {
+            if (setup->pixel_offset == 0) {
+               /* correct for top-left fill convention:
+                */
+               if (plane->dcdy > 0) plane->c++;
+            }
+            else {
+               /* correct for bottom-left fill convention:
+                */
+               if (plane->dcdy < 0) plane->c++;
+            }
          }
       }
 
-      plane->dcdx *= FIXED_ONE;
-      plane->dcdy *= FIXED_ONE;
+      plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE;
+
 
       /* find trivial reject offsets for each edge for a single-pixel
        * sized block.  These will be scaled up at each recursive level to




More information about the mesa-commit mailing list