1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxgi] Prevent recursive fullscreen mode change.

This commit is contained in:
Paul Gofman 2024-09-05 20:58:01 -06:00 committed by Philip Rebohle
parent 5cf0783edb
commit 758dc805bb
3 changed files with 25 additions and 2 deletions

View File

@ -658,6 +658,12 @@ namespace dxvk {
HRESULT DxgiSwapChain::EnterFullscreenMode(IDXGIOutput1* pTarget) {
if (m_ModeChangeInProgress) {
Logger::warn("Nested EnterFullscreenMode");
return DXGI_STATUS_MODE_CHANGE_IN_PROGRESS;
}
scoped_bool in_progress(m_ModeChangeInProgress);
Com<IDXGIOutput1> output = pTarget;
if (!wsi::isWindow(m_window))
@ -718,6 +724,12 @@ namespace dxvk {
HRESULT DxgiSwapChain::LeaveFullscreenMode() {
if (m_ModeChangeInProgress) {
Logger::warn("Nested LeaveFullscreenMode");
return DXGI_STATUS_MODE_CHANGE_IN_PROGRESS;
}
scoped_bool in_progress(m_ModeChangeInProgress);
if (FAILED(RestoreDisplayMode(m_monitor)))
Logger::warn("DXGI: LeaveFullscreenMode: Failed to restore display mode");

View File

@ -184,6 +184,7 @@ namespace dxvk {
DXGI_SWAP_CHAIN_DESC1 m_desc;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC m_descFs;
UINT m_presentId;
bool m_ModeChangeInProgress = false;
Com<IDXGIVkSwapChain> m_presenter;
Com<IDXGIVkSwapChain1> m_presenter1;

View File

@ -43,4 +43,14 @@ namespace dxvk {
return duration.count() / refreshPeriod.count();
}
struct scoped_bool {
scoped_bool(bool &v) : m_val(v) {
m_val = true;
}
~scoped_bool() {
m_val = false;
}
bool& m_val;
};
}