=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: ddraw: Store all 32 user clip planes.

Alexandre Julliard julliard at winehq.org
Tue Dec 5 15:02:14 CST 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Dec  5 00:26:34 2017 +0100

ddraw: Store all 32 user clip planes.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ddraw/ddraw_private.h |  4 ++++
 dlls/ddraw/device.c        | 22 ++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 0ae4532..0b6666a 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -38,6 +38,8 @@
 #include "wine/list.h"
 #include "wine/wined3d.h"
 
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
 extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
 extern DWORD force_refresh_rate DECLSPEC_HIDDEN;
 
@@ -341,6 +343,8 @@ struct d3d_device
     /* Handle management */
     struct ddraw_handle_table handle_table;
     D3DMATRIXHANDLE          world, proj, view;
+
+    struct wined3d_vec4 user_clip_planes[D3DMAXUSERCLIPPLANES];
 };
 
 HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 7d92df5..32a2f1a 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -6457,6 +6457,7 @@ static HRESULT WINAPI d3d_device7_GetLightEnable_FPUPreserve(IDirect3DDevice7 *i
 static HRESULT d3d_device7_SetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane)
 {
     struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
+    const struct wined3d_vec4 *wined3d_plane;
     HRESULT hr;
 
     TRACE("iface %p, idx %u, plane %p.\n", iface, idx, plane);
@@ -6464,8 +6465,16 @@ static HRESULT d3d_device7_SetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DV
     if (!plane)
         return DDERR_INVALIDPARAMS;
 
+    wined3d_plane = (struct wined3d_vec4 *)plane;
+
     wined3d_mutex_lock();
-    hr = wined3d_device_set_clip_plane(device->wined3d_device, idx, (struct wined3d_vec4 *)plane);
+    hr = wined3d_device_set_clip_plane(device->wined3d_device, idx, wined3d_plane);
+    if (hr == WINED3DERR_INVALIDCALL && idx < ARRAY_SIZE(device->user_clip_planes))
+    {
+        WARN("Clip plane %u is not supported.\n", idx);
+        device->user_clip_planes[idx] = *wined3d_plane;
+        hr = D3D_OK;
+    }
     wined3d_mutex_unlock();
 
     return hr;
@@ -6505,6 +6514,7 @@ 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);
@@ -6512,8 +6522,16 @@ static HRESULT d3d_device7_GetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DV
     if (!plane)
         return DDERR_INVALIDPARAMS;
 
+    wined3d_plane = (struct wined3d_vec4 *)plane;
+
     wined3d_mutex_lock();
-    hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, (struct wined3d_vec4 *)plane);
+    hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, wined3d_plane);
+    if (hr == WINED3DERR_INVALIDCALL && idx < ARRAY_SIZE(device->user_clip_planes))
+    {
+        WARN("Clip plane %u is not supported.\n", idx);
+        *wined3d_plane = device->user_clip_planes[idx];
+        hr = D3D_OK;
+    }
     wined3d_mutex_unlock();
 
     return hr;




More information about the wine-cvs mailing list