wined3d: Split combined render target and depth/stencil clears if needed in ffp_blitter_clear().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-07-17 14:01:39 +02:00 committed by Alexandre Julliard
parent b8e0af67f5
commit a9a5f371ae
1 changed files with 17 additions and 11 deletions

View File

@ -2570,6 +2570,7 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
{ {
struct wined3d_rendertarget_view *view; struct wined3d_rendertarget_view *view;
struct wined3d_blitter *next; struct wined3d_blitter *next;
DWORD next_flags = 0;
unsigned int i; unsigned int i;
if (flags & WINED3DCLEAR_TARGET) if (flags & WINED3DCLEAR_TARGET)
@ -2579,12 +2580,15 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
if (!(view = fb->render_targets[i])) if (!(view = fb->render_targets[i]))
continue; continue;
if ((!(flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) if (ffp_blitter_use_cpu_clear(view)
&& ffp_blitter_use_cpu_clear(view))
|| (!(view->resource->usage & WINED3DUSAGE_RENDERTARGET) || (!(view->resource->usage & WINED3DUSAGE_RENDERTARGET)
&& (wined3d_settings.offscreen_rendering_mode != ORM_FBO && (wined3d_settings.offscreen_rendering_mode != ORM_FBO
|| !(view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE)))) || !(view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE))))
goto next; {
next_flags |= WINED3DCLEAR_TARGET;
flags &= ~WINED3DCLEAR_TARGET;
break;
}
/* FIXME: We should reject colour fills on formats with fixups, /* FIXME: We should reject colour fills on formats with fixups,
* but this would break P8 colour fills for example. */ * but this would break P8 colour fills for example. */
@ -2593,16 +2597,18 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
if ((flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) if ((flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
&& (view = fb->depth_stencil) && ffp_blitter_use_cpu_clear(view)) && (view = fb->depth_stencil) && ffp_blitter_use_cpu_clear(view))
goto next; {
next_flags |= flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
flags &= ~(WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
}
if (flags)
device_clear_render_targets(device, rt_count, fb, rect_count, device_clear_render_targets(device, rt_count, fb, rect_count,
clear_rects, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, flags, colour, depth, stencil);
return;
next: if (next_flags && (next = blitter->next))
if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, rect_count, next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
clear_rects, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, next_flags, colour, depth, stencil);
} }
static void ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op, static void ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,