[PATCH 2/5] wined3d: Get rid of wined3d_device_uninit_gdi().

Henri Verbeet hverbeet at codeweavers.com
Fri Apr 12 07:50:45 CDT 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/ddraw/ddraw.c        |  2 +-
 dlls/wined3d/device.c     | 27 ++++++---------------------
 dlls/wined3d/wined3d.spec |  1 -
 include/wine/wined3d.h    |  1 -
 4 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index f4aabf4efab..cb7c12a1de1 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -400,7 +400,7 @@ static void ddraw_destroy_swapchain(struct ddraw *ddraw)
     }
     else
     {
-        wined3d_device_uninit_gdi(ddraw->wined3d_device);
+        wined3d_device_uninit_3d(ddraw->wined3d_device);
     }
 
     ddraw_set_swapchain_window(ddraw, NULL);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1424ed4ab7e..a0c44b5d41c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1174,11 +1174,12 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
 
 HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
 {
+    BOOL no3d = device->wined3d->flags & WINED3D_NO3D;
     unsigned int i;
 
     TRACE("device %p.\n", device);
 
-    if (!device->d3d_initialized)
+    if (!device->d3d_initialized && !no3d)
         return WINED3DERR_INVALIDCALL;
 
     wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
@@ -1192,7 +1193,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
 
     wine_rb_clear(&device->samplers, device_free_sampler, NULL);
 
-    wined3d_device_delete_opengl_contexts(device);
+    if (no3d)
+        device->blitter->ops->blitter_destroy(device->blitter, NULL);
+    else
+        wined3d_device_delete_opengl_contexts(device);
 
     if (device->fb.depth_stencil)
     {
@@ -1239,25 +1243,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
     return WINED3D_OK;
 }
 
-HRESULT CDECL wined3d_device_uninit_gdi(struct wined3d_device *device)
-{
-    unsigned int i;
-
-    device->blitter->ops->blitter_destroy(device->blitter, NULL);
-
-    for (i = 0; i < device->swapchain_count; ++i)
-    {
-        TRACE("Releasing the implicit swapchain %u.\n", i);
-        if (wined3d_swapchain_decref(device->swapchains[i]))
-            FIXME("Something's still holding the implicit swapchain.\n");
-    }
-
-    heap_free(device->swapchains);
-    device->swapchains = NULL;
-    device->swapchain_count = 0;
-    return WINED3D_OK;
-}
-
 /* Enables thread safety in the wined3d device and its resources. Called by DirectDraw
  * from SetCooperativeLevel if DDSCL_MULTITHREADED is specified, and by d3d8/9 from
  * CreateDevice if D3DCREATE_MULTITHREADED is passed.
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 1422c65245e..704e19db46b 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -189,7 +189,6 @@
 @ cdecl wined3d_device_setup_fullscreen_window(ptr ptr long long)
 @ cdecl wined3d_device_show_cursor(ptr long)
 @ cdecl wined3d_device_uninit_3d(ptr)
-@ cdecl wined3d_device_uninit_gdi(ptr)
 @ cdecl wined3d_device_update_sub_resource(ptr ptr long ptr ptr long long long)
 @ cdecl wined3d_device_update_texture(ptr ptr ptr)
 @ cdecl wined3d_device_validate_device(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index e943e0d988c..8a29ef63999 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2481,7 +2481,6 @@ void __cdecl wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT i
 void __cdecl wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h);
 BOOL __cdecl wined3d_device_show_cursor(struct wined3d_device *device, BOOL show);
 HRESULT __cdecl wined3d_device_uninit_3d(struct wined3d_device *device);
-HRESULT __cdecl wined3d_device_uninit_gdi(struct wined3d_device *device);
 void __cdecl wined3d_device_update_sub_resource(struct wined3d_device *device, struct wined3d_resource *resource,
         unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
         unsigned int depth_pitch, unsigned int flags);
-- 
2.11.0




More information about the wine-devel mailing list