From fcd7c37fd3d0f61cf6ac81170bc0b3fca64ad9bb Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Nov 2007 13:01:57 -0700 Subject: fix broken two-sided stencil --- src/mesa/swrast/s_tritemp.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/mesa/swrast/s_tritemp.h') 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... */ { -- cgit v1.2.3