From 7f0bbb7e975ebde7e170dee0dd03a536079a0b2c Mon Sep 17 00:00:00 2001 From: FakeMichau <49685661+FakeMichau@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:00:54 +0200 Subject: [PATCH] Try to fix missing hudless in some cases Slopped. CheckForFrame can get called in the middle of resource tagging and that would trigger hudless to be assigned to an incorrect frame --- OptiScaler/framegen/nvngx/Nvngx_FFX.cpp | 3 ++- OptiScaler/inputs/FG/Streamline_Inputs_Dx12.cpp | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OptiScaler/framegen/nvngx/Nvngx_FFX.cpp b/OptiScaler/framegen/nvngx/Nvngx_FFX.cpp index d16a6acb..a7ff2ac8 100644 --- a/OptiScaler/framegen/nvngx/Nvngx_FFX.cpp +++ b/OptiScaler/framegen/nvngx/Nvngx_FFX.cpp @@ -463,9 +463,10 @@ NVSDK_NGX_Result Nvngx_FFX::D3D12_EvaluateFeature(ID3D12GraphicsCommandList* InC createFg.backBufferFormat = ffxApiGetSurfaceFormatDX12(backbuffer->GetDesc().Format); createFg.header.pNext = &backendDesc.header; + ffxCreateContextDescFrameGenerationHudless hudlessFormat {}; + if (hudlessFormatFfx != 0 && backbufferFormatFfx != hudlessFormatFfx) { - ffxCreateContextDescFrameGenerationHudless hudlessFormat {}; hudlessFormat.header.type = FFX_API_CREATE_CONTEXT_DESC_TYPE_FRAMEGENERATION_HUDLESS; hudlessFormat.hudlessBackBufferFormat = hudlessFormatFfx; diff --git a/OptiScaler/inputs/FG/Streamline_Inputs_Dx12.cpp b/OptiScaler/inputs/FG/Streamline_Inputs_Dx12.cpp index 1015c6e9..8c050c49 100644 --- a/OptiScaler/inputs/FG/Streamline_Inputs_Dx12.cpp +++ b/OptiScaler/inputs/FG/Streamline_Inputs_Dx12.cpp @@ -8,7 +8,11 @@ void Sl_Inputs_Dx12::CheckForFrame(IFGFeature_Dx12* fg, uint32_t frameId) { std::scoped_lock lock(_frameBoundaryMutex); - if (_isFrameFinished && _lastPresentFrameId == _currentFrameId && frameId == 0 && frameId != _currentFrameId) + const bool presentMarked = _isFrameFinished && _lastPresentFrameId == _currentFrameId; + const bool fgDispatched = + fg->IsActive() && !fg->IsPaused() && fg->IsDispatched() && fg->FrameCount() == _currentFrameId; + + if ((presentMarked || fgDispatched) && frameId == 0 && _currentFrameId != 0) { LOG_DEBUG("1> CheckForFrame: frameId={}, currentFrameId={}, lastPresentFrameId={}, isFrameFinished={}", frameId, _currentFrameId, _lastPresentFrameId, _isFrameFinished); @@ -17,12 +21,7 @@ void Sl_Inputs_Dx12::CheckForFrame(IFGFeature_Dx12* fg, uint32_t frameId) fg->StartNewFrame(); _currentIndex = fg->GetIndex(); - - if (frameId != 0) - _currentFrameId = frameId; - else - _currentFrameId = _lastPresentFrameId + 1; - + _currentFrameId++; _frameIdIndex[_currentIndex] = _currentFrameId; } else if (frameId != 0 && frameId > _currentFrameId)