Merge branch 'master' into glsl-pp-rework-2
[mesa.git] / src / mesa / swrast / s_tritemp.h
index cded4a6c1c414a1715f66b365efe8162a06bfec6..8e3c5b5eebb189d9cedf353ae0ff0628bb905251 100644 (file)
@@ -234,18 +234,18 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
    /* compute area, oneOverArea and perform backface culling */
    {
       const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
-      /* Do backface culling */
-      if (area * bf < 0.0)
-         return;
 
       if (IS_INF_OR_NAN(area) || area == 0.0F)
          return;
 
-      oneOverArea = 1.0F / area;
-   }
+      if (area * bf * swrast->_BackfaceCullSign < 0.0)
+         return;
 
+      oneOverArea = 1.0F / area;
 
-   span.facing = ctx->_Facing; /* for 2-sided stencil test */
+      /* 0 = front, 1 = back */
+      span.facing = oneOverArea * bf > 0.0F;
+   }
 
    /* Edge setup.  For a triangle strip these could be reused... */
    {