diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 63398e50de7..02bc9096844 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2148,27 +2148,27 @@ void CDECL wined3d_device_set_scissor_rects(struct wined3d_device *device, unsig TRACE("%u: %s\n", i, wine_dbgstr_rect(&rects[i])); } - if (device->recording) - device->recording->changed.scissorRect = TRUE; + if (rect_count) + device->update_stateblock_state->scissor_rect = rects[0]; - if (device->update_state->scissor_rect_count == rect_count - && !memcmp(device->update_state->scissor_rects, rects, rect_count * sizeof(*rects))) + if (device->recording) + { + device->recording->changed.scissorRect = TRUE; + return; + } + + if (device->state.scissor_rect_count == rect_count + && !memcmp(device->state.scissor_rects, rects, rect_count * sizeof(*rects))) { TRACE("App is setting the old scissor rectangles over, nothing to do.\n"); return; } if (rect_count) - memcpy(device->update_state->scissor_rects, rects, rect_count * sizeof(*rects)); + memcpy(device->state.scissor_rects, rects, rect_count * sizeof(*rects)); else - memset(device->update_state->scissor_rects, 0, sizeof(device->update_state->scissor_rects)); - device->update_state->scissor_rect_count = rect_count; - - if (device->recording) - { - TRACE("Recording... not performing anything.\n"); - return; - } + memset(device->state.scissor_rects, 0, sizeof(device->state.scissor_rects)); + device->state.scissor_rect_count = rect_count; wined3d_cs_emit_set_scissor_rects(device->cs, rect_count, rects); } @@ -4531,6 +4531,7 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device SetRect(&state->scissor_rects[0], 0, 0, view->width, view->height); state->scissor_rect_count = 1; wined3d_cs_emit_set_scissor_rects(device->cs, 1, state->scissor_rects); + device->stateblock_state.scissor_rect = state->scissor_rects[0]; } prev = device->fb.render_targets[view_idx]; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 84f56c959ba..9c035e53e60 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -839,17 +839,11 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) } if (stateblock->changed.scissorRect - && (src_state->scissor_rect_count != stateblock->state.scissor_rect_count - || memcmp(src_state->scissor_rects, stateblock->state.scissor_rects, - src_state->scissor_rect_count * sizeof(*stateblock->state.scissor_rects)))) + && memcmp(&state->scissor_rect, &stateblock->stateblock_state.scissor_rect, sizeof(state->scissor_rect))) { - TRACE("Updating scissor rects.\n"); + TRACE("Updating scissor rect.\n"); - if ((stateblock->state.scissor_rect_count = src_state->scissor_rect_count)) - memcpy(stateblock->state.scissor_rects, src_state->scissor_rects, - src_state->scissor_rect_count * sizeof(*src_state->scissor_rects)); - else - SetRectEmpty(stateblock->state.scissor_rects); + stateblock->stateblock_state.scissor_rect = state->scissor_rect; } if (stateblock->changed.blend_state @@ -1134,8 +1128,11 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) } if (stateblock->changed.scissorRect) - wined3d_device_set_scissor_rects(device, stateblock->state.scissor_rect_count, - stateblock->state.scissor_rects); + { + state->scissor_rect = stateblock->stateblock_state.scissor_rect; + + wined3d_device_set_scissor_rects(device, 1, &stateblock->stateblock_state.scissor_rect); + } if (stateblock->changed.blend_state) wined3d_device_set_blend_state(device, stateblock->state.blend_state, &stateblock->state.blend_factor); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9dd880c7a8c..66a2ee4e418 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2990,6 +2990,7 @@ struct wined3d_stateblock_state struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]; struct wined3d_material material; struct wined3d_viewport viewport; + RECT scissor_rect; }; struct wined3d_device