mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[dxgi] Notify presenter about display mode changes
This commit is contained in:
parent
e281eee795
commit
6044e63eb0
@ -365,8 +365,10 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the swap chain allows it, change the display mode
|
// If the swap chain allows it, change the display mode
|
||||||
if (m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)
|
if (m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH) {
|
||||||
ChangeDisplayMode(output.ptr(), pNewTargetParameters);
|
ChangeDisplayMode(output.ptr(), pNewTargetParameters);
|
||||||
|
NotifyModeChange(m_monitor, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// Resize and reposition the window to
|
// Resize and reposition the window to
|
||||||
DXGI_OUTPUT_DESC desc;
|
DXGI_OUTPUT_DESC desc;
|
||||||
@ -622,6 +624,7 @@ namespace dxvk {
|
|||||||
ReleaseMonitorData();
|
ReleaseMonitorData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotifyModeChange(m_monitor, FALSE);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,6 +645,8 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore internal state
|
// Restore internal state
|
||||||
|
HMONITOR monitor = m_monitor;
|
||||||
|
|
||||||
m_descFs.Windowed = TRUE;
|
m_descFs.Windowed = TRUE;
|
||||||
m_monitor = nullptr;
|
m_monitor = nullptr;
|
||||||
m_target = nullptr;
|
m_target = nullptr;
|
||||||
@ -667,6 +672,7 @@ namespace dxvk {
|
|||||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||||
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
NotifyModeChange(monitor, TRUE);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,5 +781,28 @@ namespace dxvk {
|
|||||||
if (m_monitorInfo != nullptr)
|
if (m_monitorInfo != nullptr)
|
||||||
m_monitorInfo->ReleaseMonitorData();
|
m_monitorInfo->ReleaseMonitorData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxgiSwapChain::NotifyModeChange(
|
||||||
|
HMONITOR hMonitor,
|
||||||
|
BOOL Windowed) {
|
||||||
|
DEVMODEW devMode = { };
|
||||||
|
devMode.dmSize = sizeof(devMode);
|
||||||
|
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
||||||
|
|
||||||
|
if (GetMonitorDisplayMode(hMonitor, ENUM_CURRENT_SETTINGS, &devMode)) {
|
||||||
|
DXGI_MODE_DESC displayMode = { };
|
||||||
|
displayMode.Width = devMode.dmPelsWidth;
|
||||||
|
displayMode.Height = devMode.dmPelsHeight;
|
||||||
|
displayMode.RefreshRate = { devMode.dmDisplayFrequency, 1 };
|
||||||
|
displayMode.Format = m_desc.Format;
|
||||||
|
displayMode.ScanlineOrdering = m_descFs.ScanlineOrdering;
|
||||||
|
displayMode.Scaling = m_descFs.Scaling;
|
||||||
|
m_presenter->NotifyModeChange(Windowed, &displayMode);
|
||||||
|
} else {
|
||||||
|
Logger::warn("Failed to query current display mode");
|
||||||
|
m_presenter->NotifyModeChange(Windowed, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,10 @@ namespace dxvk {
|
|||||||
DXGI_VK_MONITOR_DATA** ppData);
|
DXGI_VK_MONITOR_DATA** ppData);
|
||||||
|
|
||||||
void ReleaseMonitorData();
|
void ReleaseMonitorData();
|
||||||
|
|
||||||
|
void NotifyModeChange(
|
||||||
|
HMONITOR hMonitor,
|
||||||
|
BOOL Windowed);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user