Henri Verbeet : wined3d: Assume identical source and destination formats in surface_upload_from_surface ().

Alexandre Julliard julliard at winehq.org
Fri Apr 7 15:17:03 CDT 2017


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Apr  6 23:44:32 2017 +0200

wined3d: Assume identical source and destination formats in surface_upload_from_surface().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/device.c  | 12 ++++++------
 dlls/wined3d/surface.c | 13 +------------
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 362276d..bd07053 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3551,12 +3551,6 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
     TRACE("device %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n",
             device, src_texture, src_level, dst_texture, level_count);
 
-    if (src_texture->resource.format != dst_texture->resource.format)
-    {
-        WARN("Source and destination formats do not match.\n");
-        return WINED3DERR_INVALIDCALL;
-    }
-
     if (wined3d_texture_get_level_width(src_texture, src_level) != dst_texture->resource.width
             || wined3d_texture_get_level_height(src_texture, src_level) != dst_texture->resource.height
             || wined3d_texture_get_level_depth(src_texture, src_level) != dst_texture->resource.depth)
@@ -3636,6 +3630,12 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
         return WINED3DERR_INVALIDCALL;
     }
 
+    if (src_texture->resource.format != dst_texture->resource.format)
+    {
+        WARN("Source and destination formats do not match.\n");
+        return WINED3DERR_INVALIDCALL;
+    }
+
     level_count = min(wined3d_texture_get_level_count(src_texture),
             wined3d_texture_get_level_count(dst_texture));
 
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 56fbaf2..c9d9c10 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -874,8 +874,6 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
     struct wined3d_texture *src_texture = src_surface->container;
     struct wined3d_texture *dst_texture = dst_surface->container;
     unsigned int src_row_pitch, src_slice_pitch;
-    const struct wined3d_format *src_format;
-    const struct wined3d_format *dst_format;
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context *context;
     struct wined3d_bo_address data;
@@ -887,15 +885,6 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
             dst_surface, wine_dbgstr_point(dst_point),
             src_surface, wine_dbgstr_rect(src_rect));
 
-    src_format = src_texture->resource.format;
-    dst_format = dst_texture->resource.format;
-
-    if (src_format->id != dst_format->id)
-    {
-        WARN("Source and destination surfaces should have the same format.\n");
-        return WINED3DERR_INVALIDCALL;
-    }
-
     if (!dst_point)
     {
         p.x = 0;
@@ -947,7 +936,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
             src_texture->sub_resources[src_sub_resource_idx].locations);
     wined3d_texture_get_pitch(src_texture, src_surface->texture_level, &src_row_pitch, &src_slice_pitch);
 
-    wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect,
+    wined3d_surface_upload_data(dst_surface, gl_info, src_texture->resource.format, src_rect,
             src_row_pitch, dst_point, FALSE, wined3d_const_bo_address(&data));
 
     context_release(context);




More information about the wine-cvs mailing list