[PATCH 3/4] wined3d: Move clip plane state to wined3d_state.

Henri Verbeet hverbeet at codeweavers.com
Tue Sep 21 14:20:55 CDT 2010


---
 dlls/wined3d/device.c          |   25 +++++++++++++------------
 dlls/wined3d/state.c           |   10 +++++-----
 dlls/wined3d/stateblock.c      |   14 ++++++++------
 dlls/wined3d/wined3d_private.h |    2 +-
 4 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 289c2a4..6f4c84a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2808,18 +2808,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
 
     This->updateStateBlock->changed.clipplane |= 1 << Index;
 
-    if(This->updateStateBlock->clipplane[Index][0] == pPlane[0] &&
-       This->updateStateBlock->clipplane[Index][1] == pPlane[1] &&
-       This->updateStateBlock->clipplane[Index][2] == pPlane[2] &&
-       This->updateStateBlock->clipplane[Index][3] == pPlane[3]) {
+    if (This->updateStateBlock->state.clip_planes[Index][0] == pPlane[0]
+            && This->updateStateBlock->state.clip_planes[Index][1] == pPlane[1]
+            && This->updateStateBlock->state.clip_planes[Index][2] == pPlane[2]
+            && This->updateStateBlock->state.clip_planes[Index][3] == pPlane[3])
+    {
         TRACE("Application is setting old values over, nothing to do\n");
         return WINED3D_OK;
     }
 
-    This->updateStateBlock->clipplane[Index][0] = pPlane[0];
-    This->updateStateBlock->clipplane[Index][1] = pPlane[1];
-    This->updateStateBlock->clipplane[Index][2] = pPlane[2];
-    This->updateStateBlock->clipplane[Index][3] = pPlane[3];
+    This->updateStateBlock->state.clip_planes[Index][0] = pPlane[0];
+    This->updateStateBlock->state.clip_planes[Index][1] = pPlane[1];
+    This->updateStateBlock->state.clip_planes[Index][2] = pPlane[2];
+    This->updateStateBlock->state.clip_planes[Index][3] = pPlane[3];
 
     /* Handle recording of state blocks */
     if (This->isRecordingState) {
@@ -2843,10 +2844,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO
         return WINED3DERR_INVALIDCALL;
     }
 
-    pPlane[0] = (float) This->stateBlock->clipplane[Index][0];
-    pPlane[1] = (float) This->stateBlock->clipplane[Index][1];
-    pPlane[2] = (float) This->stateBlock->clipplane[Index][2];
-    pPlane[3] = (float) This->stateBlock->clipplane[Index][3];
+    pPlane[0] = (float)This->stateBlock->state.clip_planes[Index][0];
+    pPlane[1] = (float)This->stateBlock->state.clip_planes[Index][1];
+    pPlane[2] = (float)This->stateBlock->state.clip_planes[Index][2];
+    pPlane[3] = (float)This->stateBlock->state.clip_planes[Index][3];
     return WINED3D_OK;
 }
 
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index f7072f5..a99833e 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3809,11 +3809,11 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
     }
 
     TRACE("Clipplane [%f,%f,%f,%f]\n",
-          stateblock->clipplane[index][0],
-          stateblock->clipplane[index][1],
-          stateblock->clipplane[index][2],
-          stateblock->clipplane[index][3]);
-    glClipPlane(GL_CLIP_PLANE0 + index, stateblock->clipplane[index]);
+            stateblock->state.clip_planes[index][0],
+            stateblock->state.clip_planes[index][1],
+            stateblock->state.clip_planes[index][2],
+            stateblock->state.clip_planes[index][3]);
+    glClipPlane(GL_CLIP_PLANE0 + index, stateblock->state.clip_planes[index]);
     checkGLcall("glClipPlane");
 
     glPopMatrix();
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index c8152c8..2834fa5 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -818,10 +818,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
     {
         if (!(map & 1)) continue;
 
-        if (memcmp(targetStateBlock->clipplane[i], This->clipplane[i], sizeof(*This->clipplane)))
+        if (memcmp(targetStateBlock->state.clip_planes[i],
+                This->state.clip_planes[i], sizeof(*This->state.clip_planes)))
         {
             TRACE("Updating clipplane %u.\n", i);
-            memcpy(This->clipplane[i], targetStateBlock->clipplane[i], sizeof(*This->clipplane));
+            memcpy(This->state.clip_planes[i],
+                    targetStateBlock->state.clip_planes[i], sizeof(*This->state.clip_planes));
         }
     }
 
@@ -1061,10 +1063,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
 
         if (!(map & 1)) continue;
 
-        clip[0] = This->clipplane[i][0];
-        clip[1] = This->clipplane[i][1];
-        clip[2] = This->clipplane[i][2];
-        clip[3] = This->clipplane[i][3];
+        clip[0] = This->state.clip_planes[i][0];
+        clip[1] = This->state.clip_planes[i][1];
+        clip[2] = This->state.clip_planes[i][2];
+        clip[3] = This->state.clip_planes[i][3];
         IWineD3DDevice_SetClipPlane(device, i, clip);
     }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 01c8469..5cb9723 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2374,6 +2374,7 @@ struct wined3d_state
     DWORD lowest_disabled_stage;
 
     WINED3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
+    double clip_planes[MAX_CLIPPLANES][4];
     WINED3DMATERIAL material;
     WINED3DVIEWPORT viewport;
     RECT scissor_rect;
@@ -2402,7 +2403,6 @@ struct IWineD3DStateBlockImpl
     struct wined3d_state state;
 
     /* Clipping */
-    double                    clipplane[MAX_CLIPPLANES][4];
     WINED3DCLIPSTATUS         clip_status;
 
     /* Contained state management */
-- 
1.7.2.2




More information about the wine-patches mailing list