From d6448a79642c514221d1c06526d2f9684e9f87ea Mon Sep 17 00:00:00 2001 From: cdozdil Date: Fri, 7 Nov 2025 02:08:42 +0300 Subject: [PATCH] Use much simpler frames presented logic to fix Cp77 frame counter --- OptiScaler/hooks/Streamline_Hooks.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/OptiScaler/hooks/Streamline_Hooks.cpp b/OptiScaler/hooks/Streamline_Hooks.cpp index 9fff6ff1..79772c00 100644 --- a/OptiScaler/hooks/Streamline_Hooks.cpp +++ b/OptiScaler/hooks/Streamline_Hooks.cpp @@ -611,31 +611,27 @@ sl::Result StreamlineHooks::hkslDLSSGGetState(const sl::ViewportHandle& viewport auto result = o_slDLSSGGetState(viewport, state, options); - LOG_DEBUG("DLSSG State Status: {}, numFramesActuallyPresented: {}", magic_enum::enum_name(state.status), - state.numFramesActuallyPresented); - auto& s = State::Instance(); auto fg = s.currentFG; - static UINT64 lastFrameCount = 0; - if (fg != nullptr) { state.estimatedVRAMUsageInBytes = 256 * 1024 * 1024; auto fc = s.frameCount; - if (lastFrameCount == 0) - state.numFramesActuallyPresented = 1; + if (fg->IsActive() && !fg->IsPaused()) + state.numFramesActuallyPresented = 2; else - state.numFramesActuallyPresented = static_cast(fc - lastFrameCount); - - lastFrameCount = fc; + state.numFramesActuallyPresented = 1; state.lastPresentInputsProcessingCompletionFenceValue = fg->FrameCount(); state.numFramesToGenerateMax = 1; } + LOG_DEBUG("Status: {}, numFramesActuallyPresented: {}", magic_enum::enum_name(state.status), + state.numFramesActuallyPresented); + return result; }