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:
parent
5cf0783edb
commit
758dc805bb
@ -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");
|
||||
|
||||
@ -731,7 +743,7 @@ namespace dxvk {
|
||||
SetGammaControl(0, nullptr);
|
||||
ReleaseMonitorData();
|
||||
}
|
||||
|
||||
|
||||
// Restore internal state
|
||||
m_descFs.Windowed = TRUE;
|
||||
m_target = nullptr;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user