d3d8: 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-24 16:11:37 -06:00 committed by Alexandre Julliard
parent bc414af57e
commit 7b20951ed4
2 changed files with 10 additions and 4 deletions

View File

@ -131,7 +131,7 @@ struct d3d8_device
DWORD in_destruction : 1; DWORD in_destruction : 1;
DWORD padding : 14; 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, /* The d3d8 API supports only one implicit swapchain (no D3DCREATE_ADAPTERGROUP_DEVICE,
* no GetSwapchain, GetBackBuffer doesn't accept a swapchain number). */ * no GetSwapchain, GetBackBuffer doesn't accept a swapchain number). */

View File

@ -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) static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD index, float *plane)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, index %u, plane %p.\n", iface, index, plane); 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(); 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(); wined3d_mutex_unlock();
return hr; return D3D_OK;
} }
static void resolve_depth_buffer(struct d3d8_device *device) 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); wined3d_get_device_caps(wined3d, adapter, device_type, &caps);
device->max_user_clip_planes = caps.MaxUserClipPlanes;
device->vs_uniform_count = caps.MaxVertexShaderConst; device->vs_uniform_count = caps.MaxVertexShaderConst;
if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &device->state))) if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &device->state)))