llvmpipe: cull zero-area triangles early
authorKeith Whitwell <keithw@vmware.com>
Fri, 20 Aug 2010 15:18:23 +0000 (16:18 +0100)
committerKeith Whitwell <keithw@vmware.com>
Wed, 25 Aug 2010 09:29:27 +0000 (10:29 +0100)
src/gallium/drivers/llvmpipe/lp_setup_tri.c

index 614a6372b4277b8be82faa0e0ec52203399b6b9c..b4325390fe7a8fcba89438d108ae11316953875a 100644 (file)
@@ -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 );
 }