wined3d: Limit clears to the size of the framebuffer.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2018-03-28 21:05:15 +02:00 committed by Alexandre Julliard
parent 451c376977
commit c830b0706b
1 changed files with 14 additions and 3 deletions

View File

@ -531,7 +531,9 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
unsigned int rt_count = cs->device->adapter->gl_info.limits.buffers; unsigned int rt_count = cs->device->adapter->gl_info.limits.buffers;
const struct wined3d_state *state = &cs->device->state; const struct wined3d_state *state = &cs->device->state;
const struct wined3d_viewport *vp = &state->viewport; const struct wined3d_viewport *vp = &state->viewport;
struct wined3d_rendertarget_view *view;
struct wined3d_cs_clear *op; struct wined3d_cs_clear *op;
RECT view_rect;
unsigned int i; unsigned int i;
op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]), op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]),
@ -553,12 +555,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{ {
for (i = 0; i < rt_count; ++i) for (i = 0; i < rt_count; ++i)
{ {
if (state->fb->render_targets[i]) if ((view = state->fb->render_targets[i]))
wined3d_resource_acquire(state->fb->render_targets[i]->resource); {
SetRect(&view_rect, 0, 0, view->width, view->height);
IntersectRect(&op->draw_rect, &op->draw_rect, &view_rect);
wined3d_resource_acquire(view->resource);
}
} }
} }
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
wined3d_resource_acquire(state->fb->depth_stencil->resource); {
view = state->fb->depth_stencil;
SetRect(&view_rect, 0, 0, view->width, view->height);
IntersectRect(&op->draw_rect, &op->draw_rect, &view_rect);
wined3d_resource_acquire(view->resource);
}
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
} }