Zebediah Figura : wined3d: Use a backup device context for swapchains created on the desktop window.

Alexandre Julliard julliard at winehq.org
Fri Jun 21 16:44:18 CDT 2019


Module: wine
Branch: master
Commit: 0922237c8308f583b9dd27bed386223be87c7057
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0922237c8308f583b9dd27bed386223be87c7057

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jun 20 18:56:28 2019 -0500

wined3d: Use a backup device context for swapchains created on the desktop window.

This patch was written by "naur".

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18490
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10core/tests/d3d10core.c | 2 +-
 dlls/d3d11/tests/d3d11.c         | 2 +-
 dlls/d3d8/tests/visual.c         | 7 +------
 dlls/d3d9/tests/visual.c         | 7 +------
 dlls/wined3d/context.c           | 8 +++++++-
 5 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c
index 81442e9..a395467 100644
--- a/dlls/d3d10core/tests/d3d10core.c
+++ b/dlls/d3d10core/tests/d3d10core.c
@@ -18028,7 +18028,7 @@ static void test_desktop_window(void)
     swapchain_desc.Flags = 0;
 
     hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
-    todo_wine ok(hr == S_OK || broken(hr == DXGI_ERROR_INVALID_CALL) /* Not available on all Windows versions. */,
+    ok(hr == S_OK || broken(hr == DXGI_ERROR_INVALID_CALL) /* Not available on all Windows versions. */,
             "Failed to create swapchain, hr %#x.\n", hr);
     IDXGIFactory_Release(factory);
     if (FAILED(hr))
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index b8a90ec..1d7a7c7 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -29338,7 +29338,7 @@ static void test_desktop_window(void)
     swapchain_desc.Flags = 0;
 
     hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
-    todo_wine ok(hr == S_OK || broken(hr == DXGI_ERROR_INVALID_CALL) /* Not available on all Windows versions. */,
+    ok(hr == S_OK || broken(hr == DXGI_ERROR_INVALID_CALL) /* Not available on all Windows versions. */,
             "Failed to create swapchain, hr %#x.\n", hr);
     IDXGIFactory_Release(factory);
     if (FAILED(hr))
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index a35b180..fc7c3cc 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -11024,12 +11024,7 @@ static void test_desktop_window(void)
     DestroyWindow(window);
 
     device = create_device(d3d, GetDesktopWindow(), GetDesktopWindow(), TRUE);
-    todo_wine ok(!!device, "Failed to create a D3D device.\n");
-    if (!device)
-    {
-        IDirect3D8_Release(d3d);
-        return;
-    }
+    ok(!!device, "Failed to create a D3D device.\n");
 
     hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 1.0f, 0);
     ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index bed74f1..5ba07a3 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -25813,12 +25813,7 @@ static void test_desktop_window(void)
     DestroyWindow(window);
 
     device = create_device(d3d, GetDesktopWindow(), GetDesktopWindow(), TRUE);
-    todo_wine ok(!!device, "Failed to create a D3D device.\n");
-    if (!device)
-    {
-        IDirect3D9_Release(d3d);
-        return;
-    }
+    ok(!!device, "Failed to create a D3D device.\n");
 
     hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 1.0f, 0);
     ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5b293b4..619b5ff 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1961,10 +1961,16 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
 
     context_gl->tid = GetCurrentThreadId();
     context_gl->window = context->swapchain->win_handle;
-    if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE)))
+    if (context_gl->window == GetDesktopWindow())
     {
+        TRACE("Swapchain is created on the desktop window, trying backup device context.\n");
+        context_gl->dc = NULL;
+    }
+    else if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE)))
         WARN("Failed to retrieve device context, trying swapchain backup.\n");
 
+    if (!context_gl->dc)
+    {
         if (!(context_gl->dc = swapchain_get_backup_dc(context->swapchain)))
         {
             ERR("Failed to retrieve a device context.\n");




More information about the wine-cvs mailing list