dxgi: Forbid creating D3D12 swapchains on desktop window.

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 2019-06-24 11:26:31 +02:00 committed by Alexandre Julliard
parent 29bc8075cc
commit dd202c1175
2 changed files with 8 additions and 2 deletions

View File

@ -1404,12 +1404,12 @@ static void test_desktop_window(void)
swapchain_desc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; swapchain_desc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;
hr = IDXGIFactory4_CreateSwapChainForHwnd(factory, (IUnknown *)queue, window, &swapchain_desc, NULL, NULL, &swapchain); hr = IDXGIFactory4_CreateSwapChainForHwnd(factory, (IUnknown *)queue, window, &swapchain_desc, NULL, NULL, &swapchain);
todo_wine ok(hr == E_ACCESSDENIED, "Got unexpected hr %#x.\n", hr); ok(hr == E_ACCESSDENIED, "Got unexpected hr %#x.\n", hr);
swapchain_desc.Width = rect.right; swapchain_desc.Width = rect.right;
swapchain_desc.Height = rect.bottom; swapchain_desc.Height = rect.bottom;
hr = IDXGIFactory4_CreateSwapChainForHwnd(factory, (IUnknown *)queue, window, &swapchain_desc, NULL, NULL, &swapchain); hr = IDXGIFactory4_CreateSwapChainForHwnd(factory, (IUnknown *)queue, window, &swapchain_desc, NULL, NULL, &swapchain);
todo_wine ok(hr == E_ACCESSDENIED, "Got unexpected hr %#x.\n", hr); ok(hr == E_ACCESSDENIED, "Got unexpected hr %#x.\n", hr);
IDXGIFactory4_Release(factory); IDXGIFactory4_Release(factory);
destroy_test_context(&context); destroy_test_context(&context);

View File

@ -2683,6 +2683,12 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
VkResult vr; VkResult vr;
HRESULT hr; HRESULT hr;
if (window == GetDesktopWindow())
{
WARN("D3D12 swapchain cannot be created on desktop window.\n");
return E_ACCESSDENIED;
}
swapchain->IDXGISwapChain3_iface.lpVtbl = &d3d12_swapchain_vtbl; swapchain->IDXGISwapChain3_iface.lpVtbl = &d3d12_swapchain_vtbl;
swapchain->refcount = 1; swapchain->refcount = 1;