dxgi: Reject DXGI_FORMAT_UNKNOWN for swapchains.

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-03-06 14:19:55 +01:00 committed by Alexandre Julliard
parent 11dfed9f9e
commit 42b22b0a77
1 changed files with 7 additions and 1 deletions

View File

@ -85,7 +85,7 @@ BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc)
case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL: case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:
min_buffer_count = 2; min_buffer_count = 2;
if (!dxgi_validate_flip_swap_effect_format(desc->Format)) if (desc->Format && !dxgi_validate_flip_swap_effect_format(desc->Format))
return FALSE; return FALSE;
if (desc->SampleDesc.Count != 1 || desc->SampleDesc.Quality) if (desc->SampleDesc.Count != 1 || desc->SampleDesc.Quality)
@ -738,6 +738,9 @@ HRESULT d3d11_swapchain_init(struct d3d11_swapchain *swapchain, struct dxgi_devi
*/ */
if (!implicit) if (!implicit)
{ {
if (desc->backbuffer_format == WINED3DFMT_UNKNOWN)
return E_INVALIDARG;
if (FAILED(hr = IWineDXGIAdapter_GetParent(device->adapter, &IID_IDXGIFactory, if (FAILED(hr = IWineDXGIAdapter_GetParent(device->adapter, &IID_IDXGIFactory,
(void **)&swapchain->factory))) (void **)&swapchain->factory)))
{ {
@ -2604,6 +2607,9 @@ HRESULT d3d12_swapchain_create(IWineDXGIFactory *factory, ID3D12CommandQueue *qu
ID3D12Device *device; ID3D12Device *device;
HRESULT hr; HRESULT hr;
if (swapchain_desc->Format == DXGI_FORMAT_UNKNOWN)
return DXGI_ERROR_INVALID_CALL;
if (!fullscreen_desc) if (!fullscreen_desc)
{ {
memset(&default_fullscreen_desc, 0, sizeof(default_fullscreen_desc)); memset(&default_fullscreen_desc, 0, sizeof(default_fullscreen_desc));