dxgi: Retrieve d3d12 swapchain fullscreen state from wined3d.

Once Alt+Enter handling is implemented, the fullscreen state may change
without dxgi necessarily being aware of it.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-10-05 17:24:16 +08:00 committed by Alexandre Julliard
parent 0a322f0ca5
commit 0e58bcea7f
4 changed files with 26 additions and 2 deletions

View File

@ -2276,7 +2276,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState(IDXGISwapCha
TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
if (fullscreen)
*fullscreen = !swapchain->fullscreen_desc.Windowed;
{
wined3d_mutex_lock();
*fullscreen = !wined3d_swapchain_state_is_windowed(swapchain->state);
wined3d_mutex_unlock();
}
if (target && (*target = swapchain->target))
IDXGIOutput_AddRef(*target);
@ -2289,6 +2293,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc(IDXGISwapChain4 *iface,
struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc = &swapchain->fullscreen_desc;
const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc = &swapchain->desc;
BOOL windowed;
TRACE("iface %p, desc %p.\n", iface, desc);
@ -2298,6 +2303,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc(IDXGISwapChain4 *iface,
return E_INVALIDARG;
}
wined3d_mutex_lock();
windowed = wined3d_swapchain_state_is_windowed(swapchain->state);
wined3d_mutex_unlock();
desc->BufferDesc.Width = swapchain_desc->Width;
desc->BufferDesc.Height = swapchain_desc->Height;
desc->BufferDesc.RefreshRate = fullscreen_desc->RefreshRate;
@ -2308,7 +2317,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc(IDXGISwapChain4 *iface,
desc->BufferUsage = swapchain_desc->BufferUsage;
desc->BufferCount = swapchain_desc->BufferCount;
desc->OutputWindow = swapchain->window;
desc->Windowed = fullscreen_desc->Windowed;
desc->Windowed = windowed;
desc->SwapEffect = swapchain_desc->SwapEffect;
desc->Flags = swapchain_desc->Flags;
@ -2470,6 +2479,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenDesc(IDXGISwapChai
DXGI_SWAP_CHAIN_FULLSCREEN_DESC *desc)
{
struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
BOOL windowed;
TRACE("iface %p, desc %p.\n", iface, desc);
@ -2479,7 +2489,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenDesc(IDXGISwapChai
return E_INVALIDARG;
}
wined3d_mutex_lock();
windowed = wined3d_swapchain_state_is_windowed(swapchain->state);
wined3d_mutex_unlock();
*desc = swapchain->fullscreen_desc;
desc->Windowed = windowed;
return S_OK;
}

View File

@ -2266,6 +2266,13 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
return WINED3D_OK;
}
BOOL CDECL wined3d_swapchain_state_is_windowed(const struct wined3d_swapchain_state *state)
{
TRACE("state %p.\n", state);
return state->desc.windowed;
}
void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state)
{
heap_free(state);

View File

@ -291,6 +291,7 @@
@ cdecl wined3d_swapchain_state_create(ptr ptr ptr)
@ cdecl wined3d_swapchain_state_destroy(ptr)
@ cdecl wined3d_swapchain_state_is_windowed(ptr)
@ cdecl wined3d_swapchain_state_resize_target(ptr ptr)
@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr)

View File

@ -2806,6 +2806,7 @@ void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, H
HRESULT __cdecl wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
HWND window, struct wined3d_swapchain_state **state);
void __cdecl wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state);
BOOL __cdecl wined3d_swapchain_state_is_windowed(const struct wined3d_swapchain_state *state);
HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state,