Skip to content
Browse files

Moved glEnable/Disable for NVIDIA two sided stencil ops to the outsid…

…e of the surface loop.
  • Loading branch information...
1 parent 141597d commit 5232b940bffee251d0e123e13e39780b2f988ee7 @ljbade ljbade committed
Showing with 10 additions and 6 deletions.
  1. +10 −6 neo/renderer/draw_common.cpp
View
16 neo/renderer/draw_common.cpp
@@ -1172,14 +1172,12 @@ static void RB_T_Shadow( const drawSurf_t *surf ) {
// patented depth-fail stencil shadows
if ( !external ) {
- if (r_useTwoSidedStencil.GetBool() && glConfig.twoSidedStencilAvailable) {
- qglEnable( GL_STENCIL_TEST_TWO_SIDE_EXT );
+ if (glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool()) {
qglActiveStencilFaceEXT( backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK );
qglStencilOp( GL_KEEP, tr.stencilDecr, GL_KEEP );
qglActiveStencilFaceEXT( backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT );
qglStencilOp( GL_KEEP, tr.stencilIncr, GL_KEEP );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
- qglDisable( GL_STENCIL_TEST_TWO_SIDE_EXT );
} else if(r_useTwoSidedStencil.GetBool() && glConfig.atiTwoSidedStencilAvailable) {
qglStencilOpSeparateATI( backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, tr.stencilDecr, GL_KEEP );
qglStencilOpSeparateATI( backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, tr.stencilIncr, GL_KEEP );
@@ -1196,14 +1194,12 @@ static void RB_T_Shadow( const drawSurf_t *surf ) {
}
} else {
// traditional depth-pass stencil shadows
- if (r_useTwoSidedStencil.GetBool() && glConfig.twoSidedStencilAvailable) {
- qglEnable( GL_STENCIL_TEST_TWO_SIDE_EXT );
+ if (glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool()) {
qglActiveStencilFaceEXT( backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilIncr );
qglActiveStencilFaceEXT( backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilDecr );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
- qglDisable( GL_STENCIL_TEST_TWO_SIDE_EXT );
} else if(r_useTwoSidedStencil.GetBool() && glConfig.atiTwoSidedStencilAvailable) {
qglStencilOpSeparateATI( backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, GL_KEEP, tr.stencilIncr );
qglStencilOpSeparateATI( backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, GL_KEEP, tr.stencilDecr );
@@ -1270,6 +1266,10 @@ void RB_StencilShadowPass( const drawSurf_t *drawSurfs ) {
qglEnable( GL_DEPTH_BOUNDS_TEST_EXT );
}
+ if ( glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool() ) {
+ qglEnable( GL_STENCIL_TEST_TWO_SIDE_EXT );
+ }
+
RB_RenderDrawSurfChainWithFunction( drawSurfs, RB_T_Shadow );
GL_Cull( CT_FRONT_SIDED );
@@ -1281,6 +1281,10 @@ void RB_StencilShadowPass( const drawSurf_t *drawSurfs ) {
if ( glConfig.depthBoundsTestAvailable && r_useDepthBoundsTest.GetBool() ) {
qglDisable( GL_DEPTH_BOUNDS_TEST_EXT );
}
+
+ if ( glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool() ) {
+ qglDisable( GL_STENCIL_TEST_TWO_SIDE_EXT );
+ }
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );

0 comments on commit 5232b94

Please sign in to comment.
Something went wrong with that request. Please try again.