=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi: Require window when creating swapchain.

Alexandre Julliard julliard at winehq.org
Tue Jan 30 14:38:14 CST 2018


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Jan 30 15:54:55 2018 +0100

dxgi: Require window when creating swapchain.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10_1/tests/d3d10_1.c |  2 +-
 dlls/d3d11/tests/d3d11.c     |  2 +-
 dlls/dxgi/factory.c          |  6 +-----
 dlls/dxgi/tests/device.c     | 14 +++++++++-----
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/d3d10_1/tests/d3d10_1.c b/dlls/d3d10_1/tests/d3d10_1.c
index 2b18110..7c2b3ba 100644
--- a/dlls/d3d10_1/tests/d3d10_1.c
+++ b/dlls/d3d10_1/tests/d3d10_1.c
@@ -252,7 +252,7 @@ static void test_create_device(void)
     swapchain_desc.OutputWindow = NULL;
     hr = D3D10CreateDeviceAndSwapChain1(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0,
             supported_feature_level, D3D10_1_SDK_VERSION, &swapchain_desc, &swapchain, &device);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "D3D10CreateDeviceAndSwapChain1 returned %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "D3D10CreateDeviceAndSwapChain1 returned %#x.\n", hr);
     ok(!swapchain, "Got unexpected swapchain pointer %p.\n", swapchain);
     ok(!device, "Got unexpected device pointer %p.\n", device);
 
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index ca71718..2625e08 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1616,7 +1616,7 @@ static void test_create_device(void)
     swapchain_desc.OutputWindow = NULL;
     hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0, D3D11_SDK_VERSION,
             &swapchain_desc, &swapchain, &device, &feature_level, &immediate_context);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "D3D11CreateDeviceAndSwapChain returned %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "D3D11CreateDeviceAndSwapChain returned %#x.\n", hr);
     ok(!swapchain, "Got unexpected swapchain pointer %p.\n", swapchain);
     ok(!device, "Got unexpected device pointer %p.\n", device);
     ok(!feature_level, "Got unexpected feature level %#x.\n", feature_level);
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index aa9cdb8..bea116b 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -258,7 +258,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor
             "output %p, swapchain %p.\n",
             iface, device, window, swapchain_desc, fullscreen_desc, output, swapchain);
 
-    if (!device || !swapchain_desc || !swapchain)
+    if (!device || !window || !swapchain_desc || !swapchain)
     {
         WARN("Invalid pointer.\n");
         return DXGI_ERROR_INVALID_CALL;
@@ -292,10 +292,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor
         WARN("BufferCount is %u.\n", swapchain_desc->BufferCount);
         return DXGI_ERROR_INVALID_CALL;
     }
-    if (!window)
-    {
-        FIXME("No output window, should use factory output window.\n");
-    }
 
     if (FAILED(hr = IUnknown_QueryInterface(device, &IID_IWineDXGIDevice, (void **)&dxgi_device)))
     {
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 4ad5b9f..c4bf826 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -1077,7 +1077,6 @@ static void test_create_swapchain(void)
         return;
     }
 
-    creation_desc.OutputWindow = 0;
     creation_desc.BufferDesc.Width = 800;
     creation_desc.BufferDesc.Height = 600;
     creation_desc.BufferDesc.RefreshRate.Numerator = 60;
@@ -1089,14 +1088,11 @@ static void test_create_swapchain(void)
     creation_desc.SampleDesc.Quality = 0;
     creation_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
     creation_desc.BufferCount = 1;
-    creation_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    creation_desc.OutputWindow = NULL;
     creation_desc.Windowed = TRUE;
     creation_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
     creation_desc.Flags = 0;
 
-    memset(&initial_state, 0, sizeof(initial_state));
-    capture_fullscreen_state(&initial_state.fullscreen_state, creation_desc.OutputWindow);
-
     hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj);
     ok(SUCCEEDED(hr), "IDXGIDevice does not implement IUnknown.\n");
 
@@ -1112,6 +1108,14 @@ static void test_create_swapchain(void)
     refcount = get_refcount((IUnknown *)device);
     ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
 
+    creation_desc.OutputWindow = NULL;
+    hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+
+    creation_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    memset(&initial_state, 0, sizeof(initial_state));
+    capture_fullscreen_state(&initial_state.fullscreen_state, creation_desc.OutputWindow);
+
     hr = IDXGIFactory_CreateSwapChain(factory, NULL, &creation_desc, &swapchain);
     ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     hr = IDXGIFactory_CreateSwapChain(factory, obj, NULL, &swapchain);




More information about the wine-cvs mailing list