1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 04:54:15 +01:00

[dxgi] Allow changing refresh rate even without ALLOW_MODE_SWITCH

Matches Windows behaviour, entering fullscreen state will only prevent
us from changing the display resolution if the flag is not set.
This commit is contained in:
Philip Rebohle 2024-06-12 17:31:31 +02:00
parent 018db92342
commit 336c9b6acc

View File

@ -460,8 +460,6 @@ namespace dxvk {
return E_FAIL;
}
// If the swap chain allows it, change the display mode
if (m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)
ChangeDisplayMode(output.ptr(), &newDisplayMode);
wsi::updateFullscreenWindow(m_monitor, m_window, false);
@ -672,9 +670,6 @@ namespace dxvk {
}
}
const bool modeSwitch = m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
if (modeSwitch) {
DXGI_MODE_DESC1 displayMode = { };
displayMode.Width = m_desc.Width;
displayMode.Height = m_desc.Height;
@ -689,12 +684,13 @@ namespace dxvk {
Logger::err("DXGI: EnterFullscreenMode: Failed to change display mode");
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
}
}
// Update swap chain description
m_descFs.Windowed = FALSE;
// Move the window so that it covers the entire output
bool modeSwitch = (m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH) != 0u;
DXGI_OUTPUT_DESC desc;
output->GetDesc(&desc);
@ -764,7 +760,12 @@ namespace dxvk {
pOutput->GetDesc(&outputDesc);
DXGI_MODE_DESC1 preferredMode = *pDisplayMode;
DXGI_MODE_DESC1 selectedMode;
DXGI_MODE_DESC1 selectedMode = { };
if (!(m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)) {
preferredMode.Width = 0;
preferredMode.Height = 0;
}
if (preferredMode.Format == DXGI_FORMAT_UNKNOWN)
preferredMode.Format = m_desc.Format;