[PATCH 2/9] wined3d: Use raw blits in wined3d_device_copy_resource().

Henri Verbeet hverbeet at codeweavers.com
Wed Nov 15 15:13:01 CST 2017


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/cs.c      | 4 ++--
 dlls/wined3d/device.c  | 4 ++--
 dlls/wined3d/surface.c | 8 +++++---
 include/wine/wined3d.h | 1 +
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 104e4c4..f7c943e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2045,14 +2045,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
         struct wined3d_context *context;
         struct wined3d_bo_address addr;
 
-        if (op->flags)
+        if (op->flags & ~WINED3D_BLT_RAW)
         {
             FIXME("Flags %#x not implemented for %s resources.\n",
                     op->flags, debug_d3dresourcetype(op->dst_resource->type));
             goto error;
         }
 
-        if (op->src_resource->format != op->dst_resource->format)
+        if (!(op->flags & WINED3D_BLT_RAW) && op->src_resource->format != op->dst_resource->format)
         {
             FIXME("Format conversion not implemented for %s resources.\n",
                     debug_d3dresourcetype(op->dst_resource->type));
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3963105..d19f279 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4041,7 +4041,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
     {
         wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1);
         wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &box,
-                src_resource, 0, &box, 0, NULL, WINED3D_TEXF_POINT);
+                src_resource, 0, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
         return;
     }
 
@@ -4068,7 +4068,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
             unsigned int idx = j * dst_texture->level_count + i;
 
             wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &box,
-                    src_resource, idx, &box, 0, NULL, WINED3D_TEXF_POINT);
+                    src_resource, idx, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
         }
     }
 }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 379fa6a..02e0c70 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3073,7 +3073,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
         same_sub_resource = FALSE;
         dst_format = dst_texture->resource.format;
         dst_fmt_flags = dst_texture->resource.format_flags;
-        if (dst_texture->resource.format->id != src_texture->resource.format->id)
+        if (!(flags & WINED3D_BLT_RAW) && dst_texture->resource.format->id != src_texture->resource.format->id)
         {
             if (!(converted_texture = surface_convert_format(src_texture, src_sub_resource_idx, dst_format)))
             {
@@ -3108,6 +3108,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
         dst_map.data = context_map_bo_address(context, &dst_data,
                 dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
     }
+    flags &= ~WINED3D_BLT_RAW;
 
     bpp = dst_format->byte_count;
     src_height = src_box->bottom - src_box->top;
@@ -3737,7 +3738,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
 
     static const DWORD simple_blit = WINED3D_BLT_SRC_CKEY
             | WINED3D_BLT_SRC_CKEY_OVERRIDE
-            | WINED3D_BLT_ALPHA_TEST;
+            | WINED3D_BLT_ALPHA_TEST
+            | WINED3D_BLT_RAW;
 
     TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
             dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
@@ -3908,7 +3910,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
 
         return WINED3D_OK;
     }
-    else if (!scale && !convert)
+    else if ((flags & WINED3D_BLT_RAW) || (!scale && !convert))
     {
         blit_op = WINED3D_BLIT_OP_RAW_BLIT;
     }
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 131bbf4..f35d980 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1342,6 +1342,7 @@ enum wined3d_shader_byte_code_format
 #define WINED3D_BLT_SRC_CKEY_OVERRIDE                           0x00010000
 #define WINED3D_BLT_WAIT                                        0x01000000
 #define WINED3D_BLT_DO_NOT_WAIT                                 0x08000000
+#define WINED3D_BLT_RAW                                         0x20000000
 #define WINED3D_BLT_SYNCHRONOUS                                 0x40000000
 #define WINED3D_BLT_ALPHA_TEST                                  0x80000000
 #define WINED3D_BLT_MASK                                        0x0901e800
-- 
2.1.4




More information about the wine-devel mailing list