dxgi: Enable WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE.

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 2016-08-25 12:22:55 +02:00 committed by Alexandre Julliard
parent 92a6c5839d
commit f94ef02dbc
3 changed files with 36 additions and 37 deletions

View File

@ -481,6 +481,9 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_private_store_init(&swapchain->private_store); wined3d_private_store_init(&swapchain->private_store);
if (!desc->windowed && (!desc->backbuffer_width || !desc->backbuffer_height))
FIXME("Fullscreen swapchain with back buffer width/height equal to 0 not supported properly.\n");
swapchain->fullscreen = !desc->windowed; swapchain->fullscreen = !desc->windowed;
desc->windowed = TRUE; desc->windowed = TRUE;
if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,

View File

@ -1183,21 +1183,18 @@ static void test_create_swapchain(void)
expected_height = expected_client_rect->bottom - expected_client_rect->top; expected_height = expected_client_rect->bottom - expected_client_rect->top;
hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain); hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain);
todo_wine ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
hr = IDXGISwapChain_GetDesc(swapchain, &result_desc); hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
ok(result_desc.BufferDesc.Width == expected_width, "Got width %u, expected %u.\n", todo_wine ok(result_desc.BufferDesc.Width == expected_width, "Got width %u, expected %u.\n",
result_desc.BufferDesc.Width, expected_width); result_desc.BufferDesc.Width, expected_width);
ok(result_desc.BufferDesc.Height == expected_height, "Got height %u, expected %u.\n", todo_wine ok(result_desc.BufferDesc.Height == expected_height, "Got height %u, expected %u.\n",
result_desc.BufferDesc.Height, expected_height); result_desc.BufferDesc.Height, expected_height);
check_swapchain_fullscreen_state(swapchain, &expected_state); check_swapchain_fullscreen_state(swapchain, &expected_state);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
check_swapchain_fullscreen_state(swapchain, &initial_state); check_swapchain_fullscreen_state(swapchain, &initial_state);
IDXGISwapChain_Release(swapchain); IDXGISwapChain_Release(swapchain);
}
IDXGIOutput_Release(expected_state.target); IDXGIOutput_Release(expected_state.target);
@ -2161,10 +2158,8 @@ static void test_inexact_modes(void)
sizes[i].width, sizes[i].height, output); sizes[i].width, sizes[i].height, output);
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
todo_wine ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
check_swapchain_fullscreen_state(swapchain, &expected_state); check_swapchain_fullscreen_state(swapchain, &expected_state);
hr = IDXGISwapChain_GetDesc(swapchain, &result_desc); hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
@ -2179,7 +2174,6 @@ static void test_inexact_modes(void)
refcount = IDXGISwapChain_Release(swapchain); refcount = IDXGISwapChain_Release(swapchain);
ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount); ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
}
/* Test SetFullscreenState(). */ /* Test SetFullscreenState(). */
swapchain_desc.BufferDesc.Width = sizes[i].width; swapchain_desc.BufferDesc.Width = sizes[i].width;
@ -2189,10 +2183,9 @@ static void test_inexact_modes(void)
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
todo_wine hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, output); hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, output);
todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
check_swapchain_fullscreen_state(swapchain, &expected_state); check_swapchain_fullscreen_state(swapchain, &expected_state);
hr = IDXGISwapChain_GetDesc(swapchain, &result_desc); hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);

View File

@ -453,11 +453,14 @@ void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode,
wined3d_mode->scanline_ordering = wined3d_scanline_ordering_from_dxgi(mode->ScanlineOrdering); wined3d_mode->scanline_ordering = wined3d_scanline_ordering_from_dxgi(mode->ScanlineOrdering);
} }
#define DXGI_WINED3D_SWAPCHAIN_FLAGS \
(WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
{ {
unsigned int flags = 0; unsigned int flags = 0;
wined3d_flags &= ~WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT; wined3d_flags &= ~DXGI_WINED3D_SWAPCHAIN_FLAGS;
if (wined3d_flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH) if (wined3d_flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{ {
@ -473,7 +476,7 @@ unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags) unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
{ {
unsigned int wined3d_flags = WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */ unsigned int wined3d_flags = DXGI_WINED3D_SWAPCHAIN_FLAGS; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
if (flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH) if (flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)
{ {