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

[dxgi] Enable frame rate limit for SyncInterval > 1 in windowed mode

This commit is contained in:
Philip Rebohle 2024-10-02 00:13:58 +02:00 committed by Philip Rebohle
parent bf9dfc77ce
commit 89ebabd8fd
2 changed files with 22 additions and 0 deletions

View File

@ -997,6 +997,27 @@ namespace dxvk {
if (m_presenter2 == nullptr)
return;
// Engage the frame limiter with large sync intervals even in windowed
// mode since we want to avoid double-presenting to the swap chain.
if (SyncInterval != m_frameRateSyncInterval && m_descFs.Windowed) {
m_frameRateSyncInterval = SyncInterval;
m_frameRateRefresh = 0.0f;
if (SyncInterval > 1 && wsi::isWindow(m_window)) {
wsi::WsiMode mode = { };
if (wsi::getCurrentDisplayMode(wsi::getWindowMonitor(m_window), &mode)) {
if (mode.refreshRate.numerator && mode.refreshRate.denominator) {
m_frameRateRefresh = double(mode.refreshRate.numerator)
/ double(mode.refreshRate.denominator);
}
}
}
} else if (!m_descFs.Windowed) {
// Reset tracking when in fullscreen mode
m_frameRateSyncInterval = 0;
}
// Use a negative number to indicate that the limiter should only
// be engaged if the target frame rate is actually exceeded
double frameRate = std::max(m_frameRateOption, 0.0);

View File

@ -199,6 +199,7 @@ namespace dxvk {
double m_frameRateOption = 0.0;
double m_frameRateRefresh = 0.0;
double m_frameRateLimit = 0.0;
uint32_t m_frameRateSyncInterval = 0u;
bool m_is_d3d12;
DXGI_COLOR_SPACE_TYPE m_colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;