diff --git a/OptiScaler/hudfix/Hudfix_Dx12.cpp b/OptiScaler/hudfix/Hudfix_Dx12.cpp index a9d23a9a..510c99a4 100644 --- a/OptiScaler/hudfix/Hudfix_Dx12.cpp +++ b/OptiScaler/hudfix/Hudfix_Dx12.cpp @@ -668,7 +668,7 @@ bool Hudfix_Dx12::CheckForHudless(std::string callerName, ID3D12GraphicsCommandL //_commandQueue->ExecuteCommandLists(1, cmdLists); _skipHudlessChecks = true; - //DispatchFG(true); + DispatchFG(true); return true; diff --git a/OptiScaler/hudfix/Hudfix_Dx12.h b/OptiScaler/hudfix/Hudfix_Dx12.h index 7dde2ecf..4ca1daa3 100644 --- a/OptiScaler/hudfix/Hudfix_Dx12.h +++ b/OptiScaler/hudfix/Hudfix_Dx12.h @@ -85,6 +85,8 @@ private: // Check _captureCounter for current frame static bool CheckCapture(); + static void DispatchFG(bool useHudless); + static int GetIndex(); inline static IID streamlineRiid{}; @@ -120,5 +122,4 @@ public: // Reset frame counters static void ResetCounters(); - static void DispatchFG(bool useHudless); }; \ No newline at end of file diff --git a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp index 46e29c83..57475d82 100644 --- a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp +++ b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp @@ -972,19 +972,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom LOG_DEBUG("InFeatureHandle is null"); return NVSDK_NGX_Result_FAIL_FeatureNotFound; } - else - { - LOG_DEBUG("Handle: {0}", InFeatureHandle->Id); - } - auto handleId = InFeatureHandle->Id; - - if (!InCmdList) + if (InCmdList == nullptr) { LOG_ERROR("InCmdList is null!!!"); return NVSDK_NGX_Result_Fail; } + LOG_DEBUG("Handle: {}, CmdList: {:X}", InFeatureHandle->Id, (size_t)InCmdList); + auto handleId = InFeatureHandle->Id; + if (handleId < DLSS_MOD_ID_OFFSET) { if (Config::Instance()->DLSSEnabled.value_or_default() && NVNGXProxy::D3D12_EvaluateFeature() != nullptr) @@ -1505,7 +1502,6 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom } } - // FG Prepare ID3D12Resource* output = nullptr; if (InParameters->Get(NVSDK_NGX_Parameter_Output, &output) != NVSDK_NGX_Result_Success) diff --git a/OptiScaler/resource_tracking/ResTrack_dx12.cpp b/OptiScaler/resource_tracking/ResTrack_dx12.cpp index b63a92c5..a21836be 100644 --- a/OptiScaler/resource_tracking/ResTrack_dx12.cpp +++ b/OptiScaler/resource_tracking/ResTrack_dx12.cpp @@ -981,36 +981,19 @@ void ResTrack_Dx12::hkExecuteCommandLists(ID3D12CommandQueue* This, UINT NumComm for (size_t i = 0; i < NumCommandLists; i++) { + LOG_DEBUG_ONLY("cmdlist[{}]: {:X}", i, (size_t)ppCommandLists[i]); + if (ppCommandLists[i] == _commandList) { LOG_DEBUG("Hudless cmdlist"); This->Signal(State::Instance().currentFG->GetHudlessFence(), State::Instance().currentFG->FrameCount()); - - if (_upscalerCommandList == nullptr) - { - LOG_DEBUG("Upscaler cmdlist is nullptr, dispatching FG"); - Hudfix_Dx12::DispatchFG(true); - } - else - { - LOG_DEBUG("Upscaler cmdlist is not nullptr, waiting for it!"); - _dispatchAfterUpscale = true; - } - _commandList = nullptr; } - else if (ppCommandLists[i] == _upscalerCommandList) + + if (ppCommandLists[i] == _upscalerCommandList) { LOG_DEBUG("Upscaler cmdlist"); This->Signal(State::Instance().currentFG->GetCopyFence(), State::Instance().currentFG->FrameCount()); - - if (_dispatchAfterUpscale) - { - LOG_DEBUG("Upscaler cmdlist, dispatching FG"); - Hudfix_Dx12::DispatchFG(true); - _dispatchAfterUpscale = false; - } - _upscalerCommandList = nullptr; } } @@ -1853,6 +1836,17 @@ void ResTrack_Dx12::hkDrawIndexedInstanced(ID3D12GraphicsCommandList* This, UINT void ResTrack_Dx12::hkExecuteBundle(ID3D12GraphicsCommandList* This, ID3D12GraphicsCommandList* pCommandList) { o_ExecuteBundle(This, pCommandList); + + if (pCommandList == _commandList) + { + LOG_DEBUG("Hudless cmdlist"); + _commandList = This; + } + else if (pCommandList == _upscalerCommandList) + { + LOG_DEBUG("Upscaler cmdlist"); + _upscalerCommandList = This; + } } void ResTrack_Dx12::hkDispatch(ID3D12GraphicsCommandList* This, UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ) @@ -2189,8 +2183,8 @@ void ResTrack_Dx12::ClearPossibleHudless() _rcActive = false; _cmdList = false; - _upscalerCommandList = nullptr; - _commandList = nullptr; + //_upscalerCommandList = nullptr; + //_commandList = nullptr; } @@ -2201,6 +2195,7 @@ void ResTrack_Dx12::PresentDone() void ResTrack_Dx12::SetUpscalerCmdList(ID3D12GraphicsCommandList* cmdList) { + LOG_DEBUG("cmdList: {:X}", (size_t)cmdList); _upscalerCommandList = cmdList; } diff --git a/OptiScaler/resource_tracking/ResTrack_dx12.h b/OptiScaler/resource_tracking/ResTrack_dx12.h index fcd1434b..8756d400 100644 --- a/OptiScaler/resource_tracking/ResTrack_dx12.h +++ b/OptiScaler/resource_tracking/ResTrack_dx12.h @@ -287,8 +287,6 @@ private: inline static ID3D12GraphicsCommandList* _commandList = nullptr; inline static ID3D12GraphicsCommandList* _upscalerCommandList = nullptr; - inline static bool _dispatchAfterUpscale = false; - static bool IsHudFixActive();