diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 46de003e50c..e912154e341 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1768,19 +1768,23 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } - if (device->recording) - device->recording->changed.clipplane |= 1u << plane_idx; + device->update_stateblock_state->clip_planes[plane_idx] = *plane; - if (!memcmp(&device->update_state->clip_planes[plane_idx], plane, sizeof(*plane))) + if (device->recording) + { + device->recording->changed.clipplane |= 1u << plane_idx; + return WINED3D_OK; + } + + if (!memcmp(&device->state.clip_planes[plane_idx], plane, sizeof(*plane))) { TRACE("Application is setting old values over, nothing to do.\n"); return WINED3D_OK; } - device->update_state->clip_planes[plane_idx] = *plane; + device->state.clip_planes[plane_idx] = *plane; - if (!device->recording) - wined3d_cs_emit_set_clip_plane(device->cs, plane_idx, plane); + wined3d_cs_emit_set_clip_plane(device->cs, plane_idx, plane); return WINED3D_OK; } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 01b6dca3a8e..d3308217fa4 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -915,10 +915,10 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) { if (!(map & 1)) continue; - if (memcmp(&stateblock->state.clip_planes[i], &src_state->clip_planes[i], sizeof(src_state->clip_planes[i]))) + if (memcmp(&stateblock->stateblock_state.clip_planes[i], &state->clip_planes[i], sizeof(state->clip_planes[i]))) { TRACE("Updating clipplane %u.\n", i); - stateblock->state.clip_planes[i] = src_state->clip_planes[i]; + stateblock->stateblock_state.clip_planes[i] = state->clip_planes[i]; } } @@ -1177,7 +1177,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) { if (!(map & 1)) continue; - wined3d_device_set_clip_plane(device, i, &stateblock->state.clip_planes[i]); + state->clip_planes[i] = stateblock->stateblock_state.clip_planes[i]; + wined3d_device_set_clip_plane(device, i, &stateblock->stateblock_state.clip_planes[i]); } TRACE("Applied stateblock %p.\n", stateblock); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a3c9ef8ce96..d9237e6e873 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2987,6 +2987,7 @@ struct wined3d_stateblock_state DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; + struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]; }; struct wined3d_device