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

Alexandre Julliard julliard at winehq.org
Tue Feb 25 17:23:07 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Feb 24 16:11:37 2020 -0600

d3d8: 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/d3d8/d3d8_private.h |  2 +-
 dlls/d3d8/device.c       | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 0fcc8bd7a0..9bf92af7c9 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -131,7 +131,7 @@ struct d3d8_device
     DWORD in_destruction : 1;
     DWORD padding : 14;
 
-    unsigned int vs_uniform_count;
+    unsigned int max_user_clip_planes, vs_uniform_count;
 
     /* The d3d8 API supports only one implicit swapchain (no D3DCREATE_ADAPTERGROUP_DEVICE,
      * no GetSwapchain, GetBackBuffer doesn't accept a swapchain number). */
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 725286cd16..17ce954a7d 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1829,15 +1829,20 @@ static HRESULT WINAPI d3d8_device_SetClipPlane(IDirect3DDevice8 *iface, DWORD in
 static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD index, float *plane)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
-    HRESULT hr;
 
     TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
 
+    if (index >= device->max_user_clip_planes)
+    {
+        TRACE("Plane %u requested, but only %u planes are supported.\n", index, device->max_user_clip_planes);
+        return WINED3DERR_INVALIDCALL;
+    }
+
     wined3d_mutex_lock();
-    hr = wined3d_device_get_clip_plane(device->wined3d_device, index, (struct wined3d_vec4 *)plane);
+    memcpy(plane, &wined3d_stateblock_get_state(device->state)->clip_planes[index], sizeof(struct wined3d_vec4));
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static void resolve_depth_buffer(struct d3d8_device *device)
@@ -3710,6 +3715,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
     }
 
     wined3d_get_device_caps(wined3d, adapter, device_type, &caps);
+    device->max_user_clip_planes = caps.MaxUserClipPlanes;
     device->vs_uniform_count = caps.MaxVertexShaderConst;
 
     if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &device->state)))




More information about the wine-cvs mailing list