From bb9ec0a469c2ec3eeb8d33e8388cca2bd63f69b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lewandowski?= <49685661+FakeMichau@users.noreply.github.com> Date: Sat, 14 Jun 2025 15:36:03 +0200 Subject: [PATCH] Avoid double sleep with the fps cap (#521) --- OptiScaler/hooks/wrapped_swapchain.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/OptiScaler/hooks/wrapped_swapchain.cpp b/OptiScaler/hooks/wrapped_swapchain.cpp index 29fa0dce..83c0a1fd 100644 --- a/OptiScaler/hooks/wrapped_swapchain.cpp +++ b/OptiScaler/hooks/wrapped_swapchain.cpp @@ -202,13 +202,17 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain4::Present(UINT SyncInterval, UIN HRESULT result; if (!(Flags & DXGI_PRESENT_TEST || Flags & DXGI_PRESENT_RESTART) && RenderTrig != nullptr) + { result = RenderTrig(m_pReal, SyncInterval, Flags, nullptr, Device, Handle, UWP); - else - result = m_pReal->Present(SyncInterval, Flags); - // When Reflex can't be used to limit, sleep in present - if (!State::Instance().reflexLimitsFps) - FrameLimit::sleep(); + // When Reflex can't be used to limit, sleep in present + if (!State::Instance().reflexLimitsFps) + FrameLimit::sleep(); + } + else + { + result = m_pReal->Present(SyncInterval, Flags); + } return result; }