Stefan Dösinger : wined3d: Move WINED3DRS_ZWRITEENABLE to the state table.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 8 06:07:08 CST 2006


Module: wine
Branch: master
Commit: 8879c7d8ddf74ae6fc8ba047c9627a84ab88efeb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8879c7d8ddf74ae6fc8ba047c9627a84ab88efeb

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Dec  8 01:43:25 2006 +0100

wined3d: Move WINED3DRS_ZWRITEENABLE to the state table.

---

 dlls/wined3d/device.c |   11 +----------
 dlls/wined3d/state.c  |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 91acffd..291f795 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3442,17 +3442,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     case WINED3DRS_CULLMODE                  :
     case WINED3DRS_SHADEMODE                 :
     case WINED3DRS_DITHERENABLE              :
-        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
-        break;
-
     case WINED3DRS_ZWRITEENABLE              :
-        if (Value) {
-            glDepthMask(1);
-            checkGLcall("glDepthMask");
-        } else {
-            glDepthMask(0);
-            checkGLcall("glDepthMask");
-        }
+        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
         break;
 
     case WINED3DRS_ZFUNC                     :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 0d104e0..3f9aeec 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -182,6 +182,19 @@ static void state_ditherenable(DWORD sta
     }
 }
 
+static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
+     * this has to be merged with ZENABLE and ZFUNC
+     */
+    if (stateblock->renderState[WINED3DRS_ZWRITEENABLE]) {
+        glDepthMask(1);
+        checkGLcall("glDepthMask(1)");
+    } else {
+        glDepthMask(0);
+        checkGLcall("glDepthMask(0)");
+    }
+}
+
 const struct StateEntry StateTable[] =
 {
       /* State name                                         representative,                                     apply function */
@@ -199,7 +212,7 @@ const struct StateEntry StateTable[] =
     { /* 11, WINED3DRS_MONOENABLE                   */      STATE_RENDER(WINED3DRS_MONOENABLE),                 state_unknown       },
     { /* 12, WINED3DRS_ROP2                         */      STATE_RENDER(WINED3DRS_ROP2),                       state_unknown       },
     { /* 13, WINED3DRS_PLANEMASK                    */      STATE_RENDER(WINED3DRS_PLANEMASK),                  state_unknown       },
-    { /* 14, WINED3DRS_ZWRITEENABLE                 */      STATE_RENDER(WINED3DRS_ZWRITEENABLE),               state_unknown       },
+    { /* 14, WINED3DRS_ZWRITEENABLE                 */      STATE_RENDER(WINED3DRS_ZWRITEENABLE),               state_zwritenable   },
     { /* 15, WINED3DRS_ALPHATESTENABLE              */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
     { /* 16, WINED3DRS_LASTPIXEL                    */      STATE_RENDER(WINED3DRS_LASTPIXEL),                  state_unknown       },
     { /* 17, WINED3DRS_TEXTUREMAG                   */      0 /* Handled in ddraw */,                           state_undefined     },




More information about the wine-cvs mailing list