Mesa (master): llvmpipe: cull zero-area triangles early

Keith Whitwell keithw at kemper.freedesktop.org
Wed Aug 25 09:32:12 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Aug 20 16:18:23 2010 +0100

llvmpipe: cull zero-area triangles early

---

 src/gallium/drivers/llvmpipe/lp_setup_tri.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 614a637..b432539 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -819,9 +819,10 @@ static void triangle_both( struct lp_setup_context *setup,
    const float fy = v1[0][1] - v2[0][1];
 
    /* det = cross(e,f).z */
-   if (ex * fy - ey * fx < 0.0f) 
+   const float det = ex * fy - ey * fx;
+   if (det < 0.0f) 
       triangle_ccw( setup, v0, v1, v2 );
-   else
+   else if (det > 0.0f)
       triangle_cw( setup, v0, v1, v2 );
 }
 




More information about the mesa-commit mailing list