[PATCH 1/5] d3d8: Get rid of the format switching code in d3d8_device_CopyRects().

Henri Verbeet hverbeet at codeweavers.com
Mon Sep 29 02:11:51 CDT 2014


This can't possibly do anything, since we fail texture creation for
WINED3DFMT_UNKNOWN. If texture creation with D3DFMT_UNKNOWN is actually
supposed to work, we should probably pick an appropriate format at creation,
instead of during CopyRects(). This code has existed in some form or another
since the initial version in commit 850a9429dbc07c0b38e9f9f60aaec43759326d24.
No tests, of course.
---
 dlls/d3d8/device.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 8ddb0cb..dd0b9ee 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -988,7 +988,6 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
     struct wined3d_resource_desc wined3d_desc;
     struct wined3d_resource *wined3d_resource;
     UINT src_w, src_h;
-    HRESULT hr;
 
     TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
             iface, src_surface, src_rects, rect_count, dst_surface, dst_points);
@@ -1020,24 +1019,13 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
     dst_format = wined3d_desc.format;
 
     /* Check that the source and destination formats match */
-    if (src_format != dst_format && WINED3DFMT_UNKNOWN != dst_format)
+    if (src_format != dst_format)
     {
         WARN("Source %p format must match the destination %p format, returning D3DERR_INVALIDCALL.\n",
                 src_surface, dst_surface);
         wined3d_mutex_unlock();
         return D3DERR_INVALIDCALL;
     }
-    else if (WINED3DFMT_UNKNOWN == dst_format)
-    {
-        TRACE("Converting destination surface from WINED3DFMT_UNKNOWN to the source format.\n");
-        if (FAILED(hr = wined3d_surface_update_desc(dst->wined3d_surface, wined3d_desc.width, wined3d_desc.height,
-                src_format, wined3d_desc.multisample_type, wined3d_desc.multisample_quality, NULL, 0)))
-        {
-            WARN("Failed to update surface desc, hr %#x.\n", hr);
-            wined3d_mutex_unlock();
-            return hr;
-        }
-    }
 
     /* Quick if complete copy ... */
     if (!rect_count && !src_rects && !dst_points)
-- 
1.7.10.4




More information about the wine-patches mailing list