dxgi: Require window when creating swapchain.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-30 15:54:55 +01:00 committed by Alexandre Julliard
parent e0c76efcbb
commit 7e72c2d4ac
4 changed files with 12 additions and 12 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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)))
{

View File

@ -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);