Zebediah Figura : ddraw: Retrieve clip planes from the primary stateblock.

Alexandre Julliard julliard at winehq.org
Fri Feb 28 13:54:40 CST 2020


Module: wine
Branch: master
Commit: 8af7f54a1e6f54c40269291cece946f3841daf64
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8af7f54a1e6f54c40269291cece946f3841daf64

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Feb 27 18:48:45 2020 -0600

ddraw: Retrieve clip planes from the primary stateblock.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ddraw/device.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 4284109237..b244a0309b 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -6576,27 +6576,24 @@ static HRESULT WINAPI d3d_device7_SetClipPlane_FPUPreserve(IDirect3DDevice7 *ifa
 static HRESULT d3d_device7_GetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane)
 {
     struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
-    struct wined3d_vec4 *wined3d_plane;
-    HRESULT hr;
 
     TRACE("iface %p, idx %u, plane %p.\n", iface, idx, plane);
 
     if (!plane)
         return DDERR_INVALIDPARAMS;
 
-    wined3d_plane = (struct wined3d_vec4 *)plane;
-
     wined3d_mutex_lock();
-    hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, wined3d_plane);
-    if (hr == WINED3DERR_INVALIDCALL && idx < ARRAY_SIZE(device->user_clip_planes))
+    if (idx < WINED3D_MAX_CLIP_DISTANCES)
+        memcpy(plane, &wined3d_stateblock_get_state(device->state)->clip_planes[idx], sizeof(struct wined3d_vec4));
+    else
     {
         WARN("Clip plane %u is not supported.\n", idx);
-        *wined3d_plane = device->user_clip_planes[idx];
-        hr = D3D_OK;
+        if (idx < ARRAY_SIZE(device->user_clip_planes))
+            memcpy(plane, &device->user_clip_planes[idx], sizeof(struct wined3d_vec4));
     }
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI d3d_device7_GetClipPlane_FPUSetup(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane)




More information about the wine-cvs mailing list