WineD3D: Move WINED3DRS_ZFUNCENABLE to the state table

Stefan Dösinger stefan at codeweavers.com
Thu Dec 7 18:44:55 CST 2006


-------------- next part --------------
From 4f715a1f72a9a0938dd26e2ebb5b4f79a9d131d1 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Fri, 8 Dec 2006 00:47:18 +0100
Subject: [PATCH] WineD3D: Move WINED3DRS_ZFUNC to the state table

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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 291f795..b51f32d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3443,18 +3443,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     case WINED3DRS_SHADEMODE                 :
     case WINED3DRS_DITHERENABLE              :
     case WINED3DRS_ZWRITEENABLE              :
-        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
-        break;
-
     case WINED3DRS_ZFUNC                     :
-        {
-            int glParm = CompareFunc(Value);
-
-            if(glParm) {
-                glDepthFunc(glParm);
-                checkGLcall("glDepthFunc");
-            }
-        }
+        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
         break;
 
     case WINED3DRS_AMBIENT                   :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 3f9aeec..684ff94 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -195,6 +195,15 @@ static void state_zwritenable(DWORD stat
     }
 }
 
+static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    int glParm = CompareFunc(stateblock->renderState[WINED3DRS_ZFUNC]);
+
+    if(glParm) {
+        glDepthFunc(glParm);
+        checkGLcall("glDepthFunc");
+    }
+}
+
 const struct StateEntry StateTable[] =
 {
       /* State name                                         representative,                                     apply function */
@@ -221,7 +230,7 @@ const struct StateEntry StateTable[] =
     { /* 20, WINED3DRS_DESTBLEND                    */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
     { /* 21, WINED3DRS_TEXTUREMAPBLEND              */      0 /* Handled in ddraw */,                           state_undefined     },
     { /* 22, WINED3DRS_CULLMODE                     */      STATE_RENDER(WINED3DRS_CULLMODE),                   state_cullmode      },
-    { /* 23, WINED3DRS_ZFUNC                        */      STATE_RENDER(WINED3DRS_ZFUNC),                      state_unknown       },
+    { /* 23, WINED3DRS_ZFUNC                        */      STATE_RENDER(WINED3DRS_ZFUNC),                      state_zfunc         },
     { /* 24, WINED3DRS_ALPHAREF                     */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
     { /* 25, WINED3DRS_ALPHAFUNC                    */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
     { /* 26, WINED3DRS_DITHERENABLE                 */      STATE_RENDER(WINED3DRS_DITHERENABLE),               state_ditherenable  },
-- 
1.4.2.4



More information about the wine-patches mailing list