On 5 December 2017 at 02:56, Józef Kucia <jkucia(a)codeweavers.com> wrote:
@@ -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, ... @@ -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; Ultimately it's perhaps not that big of a deal, but the name "user_clip_planes" seems to suggest it contains a copy of the UCPs, while it really only contains the ones you can't use.