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)