[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    wined3d: Check back stencil fail values only if defined
From:       Vitaly Budovski <vbudovsk () cs ! rmit ! edu ! au>
Date:       2006-03-31 12:02:51
Message-ID: 442D1A6B.1070909 () cs ! rmit ! edu ! au
[Download RAW message or body]

Changelog:

wined3d: Check back stencil fail values only if defined by driver.

["stencilrenderstate.diff" (text/plain)]

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(...)");
         }




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic