wined3d: Check back stencil fail values only if defined

Vitaly Budovski vbudovsk at cs.rmit.edu.au
Fri Mar 31 06:02:51 CST 2006


Changelog:

wined3d: Check back stencil fail values only if defined by driver.
-------------- next part --------------
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d322e82..c9bb7a5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3782,20 +3782,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
 
         GLint action = StencilOp(Value);
 
-        glGetIntegerv(GL_STENCIL_BACK_FAIL, &stencilFail);
-        glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL, &depthFail);
-        glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS, &stencilPass);
-
-        if(WINED3DRS_CCW_STENCILFAIL == State) {
-            stencilFail = action;
-        }
-        else if(WINED3DRS_CCW_STENCILZFAIL == State) {
-            depthFail = action;
-        }
-        else if(WINED3DRS_CCW_STENCILPASS == State) {
-            stencilPass = action;
-        }
-
         if(!This->stateBlock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE]) {
 #if 0 /* Don't use OpenGL 2.0 calls for now */
             if(GL_EXTCALL(glStencilOpSeparate)) {
@@ -3804,23 +3790,81 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
             }
             else
 #endif
-	    if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
+            if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
                 glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
                 checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
                 GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
                 checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
+
+                glGetIntegerv(GL_STENCIL_FAIL, &stencilFail);
+                glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &depthFail);
+                glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &stencilPass);
+
+                if(WINED3DRS_CCW_STENCILFAIL == State) {
+                    stencilFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILZFAIL == State) {
+                    depthFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILPASS == State) {
+                    stencilPass = action;
+                }
+
                 glStencilOp(stencilFail, depthFail, stencilPass);
                 checkGLcall("glStencilOp(...)");
             }
             else if(GL_SUPPORT(ATI_SEPARATE_STENCIL)) {
+                glGetIntegerv(GL_STENCIL_BACK_FAIL_ATI, &stencilFail);
+                glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI, &depthFail);
+                glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI, &stencilPass);
+
+                if(WINED3DRS_CCW_STENCILFAIL == State) {
+                    stencilFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILZFAIL == State) {
+                    depthFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILPASS == State) {
+                    stencilPass = action;
+                }
+
                 GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail, depthFail, stencilPass));
                 checkGLcall("glStencilOpSeparateATI(GL_BACK,...)");
             } else {
                 TRACE("Separate stencil operation not supported on this version of opengl");
+
+                glGetIntegerv(GL_STENCIL_FAIL, &stencilFail);
+                glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &depthFail);
+                glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &stencilPass);
+
+                if(WINED3DRS_CCW_STENCILFAIL == State) {
+                    stencilFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILZFAIL == State) {
+                    depthFail = action;
+                }
+                else if(WINED3DRS_CCW_STENCILPASS == State) {
+                    stencilPass = action;
+                }
+
                 glStencilOp(stencilFail, depthFail, stencilPass);
                 checkGLcall("glStencilOp(...)");
             }
         } else {
+            glGetIntegerv(GL_STENCIL_FAIL, &stencilFail);
+            glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &depthFail);
+            glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &stencilPass);
+
+            if(WINED3DRS_CCW_STENCILFAIL == State) {
+                stencilFail = action;
+            }
+            else if(WINED3DRS_CCW_STENCILZFAIL == State) {
+                depthFail = action;
+            }
+            else if(WINED3DRS_CCW_STENCILPASS == State) {
+                stencilPass = action;
+            }
+
             glStencilOp(stencilFail, depthFail, stencilPass);
             checkGLcall("glStencilOp(...)");
         }


More information about the wine-patches mailing list