ddraw: Retrieve clip planes from the primary stateblock.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-02-27 18:48:45 -06:00 committed by Alexandre Julliard
parent b5c249faa1
commit 8af7f54a1e
1 changed files with 6 additions and 9 deletions

View File

@ -6576,27 +6576,24 @@ static HRESULT WINAPI d3d_device7_SetClipPlane_FPUPreserve(IDirect3DDevice7 *ifa
static HRESULT d3d_device7_GetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane) static HRESULT d3d_device7_GetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice7(iface); 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); TRACE("iface %p, idx %u, plane %p.\n", iface, idx, plane);
if (!plane) if (!plane)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
wined3d_plane = (struct wined3d_vec4 *)plane;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, wined3d_plane); if (idx < WINED3D_MAX_CLIP_DISTANCES)
if (hr == WINED3DERR_INVALIDCALL && idx < ARRAY_SIZE(device->user_clip_planes)) 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); WARN("Clip plane %u is not supported.\n", idx);
*wined3d_plane = device->user_clip_planes[idx]; if (idx < ARRAY_SIZE(device->user_clip_planes))
hr = D3D_OK; memcpy(plane, &device->user_clip_planes[idx], sizeof(struct wined3d_vec4));
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return D3D_OK;
} }
static HRESULT WINAPI d3d_device7_GetClipPlane_FPUSetup(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane) static HRESULT WINAPI d3d_device7_GetClipPlane_FPUSetup(IDirect3DDevice7 *iface, DWORD idx, D3DVALUE *plane)