From 28f48f9fdcfbe5d542f26ee58ffec19ee6df1c40 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 16 Jun 2023 16:05:38 +0200 Subject: [PATCH] [dxgi] Initialize output refresh counts with non-zero values Matches Windows behaviour. --- src/dxgi/dxgi_output.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dxgi/dxgi_output.cpp b/src/dxgi/dxgi_output.cpp index fd44f29f..f948c7a8 100644 --- a/src/dxgi/dxgi_output.cpp +++ b/src/dxgi/dxgi_output.cpp @@ -672,7 +672,17 @@ namespace dxvk { // blank one to get something sane here. NormalizeDisplayMetadata(m_monitorInfo->DefaultColorSpace() != DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709, m_metadata); + auto refreshPeriod = computeRefreshPeriod( + activeWsiMode.refreshRate.numerator, + activeWsiMode.refreshRate.denominator); + monitorData.FrameStats.SyncQPCTime.QuadPart = dxvk::high_resolution_clock::get_counter(); + monitorData.FrameStats.SyncRefreshCount = computeRefreshCount( + dxvk::high_resolution_clock::time_point(), + dxvk::high_resolution_clock::get_time_from_counter(monitorData.FrameStats.SyncQPCTime.QuadPart), + refreshPeriod); + + monitorData.FrameStats.PresentRefreshCount = monitorData.FrameStats.SyncRefreshCount; monitorData.GammaCurve.Scale = { 1.0f, 1.0f, 1.0f }; monitorData.GammaCurve.Offset = { 0.0f, 0.0f, 0.0f }; monitorData.LastMode = ConvertDisplayMode(activeWsiMode);