diff --git a/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp b/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp index 6561b57a..824f41a3 100644 --- a/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp +++ b/OptiScaler/framegen/ffx/FSRFG_Dx12.cpp @@ -1129,7 +1129,7 @@ void FSRFG_Dx12::Deactivate() _uiCommandListResetted[fIndex] = false; } - ffxReturnCode_t result = FFX_API_RETURN_OK; + ffxReturnCode_t result = FFX_API_RETURN_ERROR; if (_fgContext != nullptr) { @@ -1140,13 +1140,14 @@ void FSRFG_Dx12::Deactivate() fgConfig.presentCallback = nullptr; fgConfig.HUDLessColor = FfxApiResource({}); - auto result = FfxApiProxy::D3D12_Configure(&_fgContext, &fgConfig.header); + result = FfxApiProxy::D3D12_Configure(&_fgContext, &fgConfig.header); if (result == FFX_API_RETURN_OK) _isActive = false; } else { + LOG_DEBUG("No context to deactivate, just set active to false"); _isActive = false; } diff --git a/OptiScaler/hooks/D3D11_Hooks.cpp b/OptiScaler/hooks/D3D11_Hooks.cpp index 75f2be98..bea31376 100644 --- a/OptiScaler/hooks/D3D11_Hooks.cpp +++ b/OptiScaler/hooks/D3D11_Hooks.cpp @@ -117,7 +117,7 @@ static HRESULT hkD3D11On12CreateDevice(IUnknown* pDevice, UINT Flags, const D3D_ ID3D11Device** ppDevice, ID3D11DeviceContext** ppImmediateContext, D3D_FEATURE_LEVEL* pChosenFeatureLevel) { - LOG_DEBUG("Caller: {}", Util::WhoIsTheCaller(_ReturnAddress())); + LOG_DEBUG("Caller: {}, Device: {:X}", Util::WhoIsTheCaller(_ReturnAddress()), (UINT64) pDevice); #ifdef ENABLE_DEBUG_LAYER_DX11 Flags |= D3D11_CREATE_DEVICE_DEBUG; diff --git a/OptiScaler/hooks/FG_Hooks.cpp b/OptiScaler/hooks/FG_Hooks.cpp index 72cc5420..4efafce4 100644 --- a/OptiScaler/hooks/FG_Hooks.cpp +++ b/OptiScaler/hooks/FG_Hooks.cpp @@ -892,6 +892,10 @@ HRESULT FGHooks::hkResizeBuffers1(IDXGISwapChain* This, UINT BufferCount, UINT W HRESULT result; + // Release menu render targets + if (Config::Instance()->OverlayMenu.value_or_default()) + MenuOverlayDx::CleanupRenderTarget(false, NULL); + // Release swapchain backbuffers to prevent errors when resizing if (State::Instance().activeFgOutput == FGOutput::XeFG) { @@ -1133,7 +1137,7 @@ HRESULT FGHooks::FGPresent(void* This, UINT SyncInterval, UINT Flags, const DXGI auto fg = State::Instance().currentFG; bool mutexUsed = false; - if (willPresent && fg != nullptr && fg->IsActive() && + if (willPresent && fg != nullptr && fg->IsActive() && !fg->IsPaused() && Config::Instance()->FGUseMutexForSwapchain.value_or_default() && fg->Mutex.getOwner() != 2) { LOG_TRACE("Waiting FG->Mutex 2, current: {}", fg->Mutex.getOwner()); @@ -1216,7 +1220,9 @@ HRESULT FGHooks::FGPresent(void* This, UINT SyncInterval, UINT Flags, const DXGI if (willPresent && !State::Instance().reflexLimitsFps && State::Instance().activeFgOutput != FGOutput::NoFG && !State::Instance().isRunningOnDXVK) - FrameLimit::sleep(fg != nullptr ? fg->IsActive() : false); + { + FrameLimit::sleep(fg != nullptr ? fg->IsActive() && !fg->IsPaused() : false); + } if (mutexUsed && fg != nullptr) { @@ -1224,6 +1230,8 @@ HRESULT FGHooks::FGPresent(void* This, UINT SyncInterval, UINT Flags, const DXGI fg->Mutex.unlockThis(2); } + LOG_DEBUG("Present finished"); + return result; }