diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-12-04 14:06:10 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-12-04 14:07:08 -0700 |
commit | 02afd45d3b2eccff5d566cdeb32b3211803bd500 (patch) | |
tree | 7396a68565fdea10c9ead9c0df61654a66d56629 /src/mesa/swrast/s_tritemp.h | |
parent | 2ee7035886d9f857677776f84e55f92153318832 (diff) |
fix span->facing computation and gl_FrontFacing initialization
Diffstat (limited to 'src/mesa/swrast/s_tritemp.h')
-rw-r--r-- | src/mesa/swrast/s_tritemp.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index c609210c0e..8e3c5b5eeb 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)->_BackfaceCullSign; + GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; 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; @@ -234,18 +234,17 @@ 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) + if (IS_INF_OR_NAN(area) || area == 0.0F) return; - if (IS_INF_OR_NAN(area) || area == 0.0F) + if (area * bf * swrast->_BackfaceCullSign < 0.0) return; oneOverArea = 1.0F / area; /* 0 = front, 1 = back */ - span.facing = oneOverArea * swrast->_BackfaceSign > 0.0F; + span.facing = oneOverArea * bf > 0.0F; } /* Edge setup. For a triangle strip these could be reused... */ |