From fdbe7dbe7bceb1c548cfc25ae4091ba929f51f24 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Sat, 20 Sep 2025 22:13:46 +0300 Subject: [PATCH] Fix activate deactivate loop --- OptiScaler/framegen/IFGFeature.h | 4 ++-- OptiScaler/framegen/ffx/FSRFG_Dx12.cpp | 4 +++- OptiScaler/framegen/xefg/XeFG_Dx12.cpp | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OptiScaler/framegen/IFGFeature.h b/OptiScaler/framegen/IFGFeature.h index bb91cd3e..fa703bfd 100644 --- a/OptiScaler/framegen/IFGFeature.h +++ b/OptiScaler/framegen/IFGFeature.h @@ -68,8 +68,8 @@ class IFGFeature std::optional _interpolationTop[BUFFER_COUNT]; UINT _reset[BUFFER_COUNT] = {}; - UINT64 _frameCount = 0; - UINT64 _lastDispatchedFrame = -1; + UINT64 _frameCount = 1; + UINT64 _lastDispatchedFrame = 0; UINT64 _willDispatchFrame = 0; bool _isActive = false; diff --git a/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp b/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp index c6501fd5..e9b38c15 100644 --- a/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp +++ b/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp @@ -397,7 +397,7 @@ void* FSRFG_Dx12::SwapchainContext() void FSRFG_Dx12::DestroyFGContext() { - _frameCount = 0; + _frameCount = 1; _lastDispatchedFrame = 0; _willDispatchFrame = 0; @@ -692,6 +692,8 @@ void FSRFG_Dx12::Deactivate() if (result == FFX_API_RETURN_OK) _isActive = false; + _lastDispatchedFrame = 0; + LOG_INFO("D3D12_Configure Enabled: false, result: {} ({})", magic_enum::enum_name((FfxApiReturnCodes) result), (UINT) result); } diff --git a/OptiScaler/framegen/xefg/XeFG_Dx12.cpp b/OptiScaler/framegen/xefg/XeFG_Dx12.cpp index 6cda63da..40fa2833 100644 --- a/OptiScaler/framegen/xefg/XeFG_Dx12.cpp +++ b/OptiScaler/framegen/xefg/XeFG_Dx12.cpp @@ -425,6 +425,8 @@ void XeFG_Dx12::Deactivate() if (result == XEFG_SWAPCHAIN_RESULT_SUCCESS) _isActive = false; + _lastDispatchedFrame = 0; + LOG_INFO("SetEnabled: false, result: {} ({})", magic_enum::enum_name(result), (UINT) result); } }