1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 16:24:29 +01:00

[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.
This commit is contained in:
Chip Davis 2019-03-28 20:27:00 -05:00 committed by Philip Rebohle
parent 61adaa941d
commit d741bc47ef
2 changed files with 4 additions and 4 deletions

View File

@ -256,7 +256,7 @@ namespace dxvk {
if (PresentFlags & DXGI_PRESENT_TEST) if (PresentFlags & DXGI_PRESENT_TEST)
return S_OK; return S_OK;
std::lock_guard<std::mutex> lockWin(m_lockWindow); std::lock_guard<std::recursive_mutex> lockWin(m_lockWindow);
std::lock_guard<std::mutex> lockBuf(m_lockBuffer); std::lock_guard<std::mutex> lockBuf(m_lockBuffer);
// Higher values are not allowed according to the Microsoft documentation: // 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) { HRESULT STDMETHODCALLTYPE DxgiSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters) {
std::lock_guard<std::mutex> lock(m_lockWindow); std::lock_guard<std::recursive_mutex> lock(m_lockWindow);
if (pNewTargetParameters == nullptr) if (pNewTargetParameters == nullptr)
return DXGI_ERROR_INVALID_CALL; return DXGI_ERROR_INVALID_CALL;
@ -378,7 +378,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE DxgiSwapChain::SetFullscreenState( HRESULT STDMETHODCALLTYPE DxgiSwapChain::SetFullscreenState(
BOOL Fullscreen, BOOL Fullscreen,
IDXGIOutput* pTarget) { IDXGIOutput* pTarget) {
std::lock_guard<std::mutex> lock(m_lockWindow); std::lock_guard<std::recursive_mutex> lock(m_lockWindow);
if (m_descFs.Windowed && Fullscreen) if (m_descFs.Windowed && Fullscreen)
return this->EnterFullscreenMode(pTarget); return this->EnterFullscreenMode(pTarget);

View File

@ -168,7 +168,7 @@ namespace dxvk {
RECT rect = { 0, 0, 0, 0 }; RECT rect = { 0, 0, 0, 0 };
}; };
std::mutex m_lockWindow; std::recursive_mutex m_lockWindow;
std::mutex m_lockBuffer; std::mutex m_lockBuffer;
Com<IDXGIFactory> m_factory; Com<IDXGIFactory> m_factory;