From d741bc47eff4dfdb442a2fe6ee705a61425c3bdd Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Thu, 28 Mar 2019 20:27:00 -0500 Subject: [PATCH] [dxgi] Use a recursive mutex. Some games, like Final Fantasy XIV, call `SetFullscreenState()` again after the window is resized. When the resize itself was triggered by a `SetFullscreenState()` call, this will cause us to re-enter the mutex. --- src/dxgi/dxgi_swapchain.cpp | 6 +++--- src/dxgi/dxgi_swapchain.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 0b257d2c..3fd62c26 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -256,7 +256,7 @@ namespace dxvk { if (PresentFlags & DXGI_PRESENT_TEST) return S_OK; - std::lock_guard lockWin(m_lockWindow); + std::lock_guard lockWin(m_lockWindow); std::lock_guard lockBuf(m_lockBuffer); // Higher values are not allowed according to the Microsoft documentation: @@ -320,7 +320,7 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters) { - std::lock_guard lock(m_lockWindow); + std::lock_guard lock(m_lockWindow); if (pNewTargetParameters == nullptr) return DXGI_ERROR_INVALID_CALL; @@ -378,7 +378,7 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiSwapChain::SetFullscreenState( BOOL Fullscreen, IDXGIOutput* pTarget) { - std::lock_guard lock(m_lockWindow); + std::lock_guard lock(m_lockWindow); if (m_descFs.Windowed && Fullscreen) return this->EnterFullscreenMode(pTarget); diff --git a/src/dxgi/dxgi_swapchain.h b/src/dxgi/dxgi_swapchain.h index 8a91e691..cca94587 100644 --- a/src/dxgi/dxgi_swapchain.h +++ b/src/dxgi/dxgi_swapchain.h @@ -168,7 +168,7 @@ namespace dxvk { RECT rect = { 0, 0, 0, 0 }; }; - std::mutex m_lockWindow; + std::recursive_mutex m_lockWindow; std::mutex m_lockBuffer; Com m_factory;