summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_tritemp.h
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-30 13:01:57 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-30 13:01:57 -0700
commitfcd7c37fd3d0f61cf6ac81170bc0b3fca64ad9bb (patch)
tree4d914939e75c09c6d3592403b34cdf0ce044e361 /src/mesa/swrast/s_tritemp.h
parent44c8dac0af8ae679b25b458980ce97d8ff410766 (diff)
fix broken two-sided stencil
Diffstat (limited to 'src/mesa/swrast/s_tritemp.h')
-rw-r--r--src/mesa/swrast/s_tritemp.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index cded4a6c1c..c609210c0e 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -136,7 +136,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
EdgeT eMaj, eTop, eBot;
GLfloat oneOverArea;
const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
- GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
+ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */
GLfixed vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy;
@@ -235,6 +235,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
{
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
/* Do backface culling */
+
if (area * bf < 0.0)
return;
@@ -242,10 +243,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
return;
oneOverArea = 1.0F / area;
- }
-
- span.facing = ctx->_Facing; /* for 2-sided stencil test */
+ /* 0 = front, 1 = back */
+ span.facing = oneOverArea * swrast->_BackfaceSign > 0.0F;
+ }
/* Edge setup. For a triangle strip these could be reused... */
{