From b7140a212df1d683611aefd9ddc375581c6c9c56 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 19 Apr 2017 23:40:49 +0200 Subject: [PATCH] wined3d: Use the CPU blitter for clearing textures that are current in the map binding. In order to avoid bouncing them between the CPU and GPU. This fixes a regression instroduced by commit 381cd03eb3860f4b963af9b37cc3258b3f45d17d. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/surface.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 2ba80605a53..91db8924467 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2538,6 +2538,22 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, } } +static BOOL ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view) +{ + struct wined3d_resource *resource; + struct wined3d_texture *texture; + + resource = view->resource; + if (resource->type == WINED3D_RTYPE_BUFFER) + return FALSE; + + texture = texture_from_resource(resource); + if (!(texture->flags & WINED3D_TEXTURE_PIN_SYSMEM)) + return FALSE; + + return texture->sub_resources[view->sub_resource_idx].locations & resource->map_binding; +} + static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects, const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil) @@ -2558,6 +2574,10 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de if (resource->pool == WINED3D_POOL_SYSTEM_MEM) goto next; + if (!(flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) + && ffp_blitter_use_cpu_clear(view)) + goto next; + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { if (!((view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE)