Henri Verbeet : wined3d: Use the CPU blitter for clearing textures that are current in the map binding.

Alexandre Julliard julliard at winehq.org
Thu Apr 20 16:41:31 CDT 2017


Module: wine
Branch: master
Commit: b7140a212df1d683611aefd9ddc375581c6c9c56
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b7140a212df1d683611aefd9ddc375581c6c9c56

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Apr 19 23:40:49 2017 +0200

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 <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/surface.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2ba8060..91db892 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)




More information about the wine-cvs mailing list