1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[dxgi] Pass refresh rate to swap chains if latency control is enabled

This commit is contained in:
Philip Rebohle 2024-10-26 00:39:24 +02:00
parent 3514580452
commit 73f2638321
3 changed files with 9 additions and 1 deletions

View File

@ -91,6 +91,7 @@ namespace dxvk {
this->maxSharedMemory = VkDeviceSize(config.getOption<int32_t>("dxgi.maxSharedMemory", 0)) << 20;
this->maxFrameRate = config.getOption<int32_t>("dxgi.maxFrameRate", 0);
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
// Expose Nvidia GPUs properly if NvAPI is enabled in environment

View File

@ -49,6 +49,9 @@ namespace dxvk {
/// Limit frame rate
int32_t maxFrameRate;
/// Control frame latency
int32_t maxFrameLatency;
/// Sync interval. Overrides the value
/// passed to IDXGISwapChain::Present.
int32_t syncInterval;

View File

@ -1003,7 +1003,11 @@ namespace dxvk {
m_frameRateSyncInterval = SyncInterval;
m_frameRateRefresh = 0.0f;
if (SyncInterval > 1 && wsi::isWindow(m_window)) {
// Frame latency control can only work on windowed or borderless swap
// chains if the presenter is aware of the display refresh rate
UINT minSyncInterval = (m_factory->GetOptions()->maxFrameLatency < 0 && !m_is_d3d12) ? 0 : 1;
if (SyncInterval > minSyncInterval && wsi::isWindow(m_window)) {
wsi::WsiMode mode = { };
if (wsi::getCurrentDisplayMode(wsi::getWindowMonitor(m_window), &mode)) {