wined3d: Store the scissor rect in the wined3d_stateblock_state structure.

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 2019-02-07 00:31:50 +03:30 committed by Alexandre Julliard
parent 032bac171b
commit ce9f7e19cb
3 changed files with 23 additions and 24 deletions

View File

@ -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];

View File

@ -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);

View File

@ -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