diff --git a/OptiScaler/upscalers/fsr2/FSR2Feature_Dx11On12.cpp b/OptiScaler/upscalers/fsr2/FSR2Feature_Dx11On12.cpp index 88966d59..3f1bea80 100644 --- a/OptiScaler/upscalers/fsr2/FSR2Feature_Dx11On12.cpp +++ b/OptiScaler/upscalers/fsr2/FSR2Feature_Dx11On12.cpp @@ -165,6 +165,8 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N params.commandList = ffxGetCommandListDX12(cmdList); + auto ffxresult = FFX_ERROR_INVALID_ARGUMENT; + do { @@ -270,7 +272,7 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N params.preExposure = 1.0f; LOG_DEBUG("Dispatch!!"); - auto ffxresult = ffxFsr2ContextDispatch(&_context, ¶ms); + ffxresult = ffxFsr2ContextDispatch(&_context, ¶ms); if (ffxresult != FFX_OK) { @@ -341,39 +343,50 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N Dx12CommandQueue->ExecuteCommandLists(1, ppCommandLists); Dx12CommandQueue->Signal(dx12FenceTextureCopy, _fenceValue); - if (!CopyBackOutput()) + auto evalResult = false; + + do { - LOG_ERROR("Can't copy output texture back!"); - return false; - } + if (ffxresult != FFX_OK) + break; - // imgui - legacy menu disabled for now - //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) - //{ - // if (Imgui != nullptr && Imgui.get() != nullptr) - // { - // LOG_DEBUG("Apply Imgui"); + if (!CopyBackOutput()) + { + LOG_ERROR("Can't copy output texture back!"); + break; + } - // if (Imgui->IsHandleDifferent()) - // { - // LOG_DEBUG("Imgui handle different, reset()!"); - // std::this_thread::sleep_for(std::chrono::milliseconds(250)); - // Imgui.reset(); - // } - // else - // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); - // } - // else - // { - // if (Imgui == nullptr || Imgui.get() == nullptr) - // Imgui = std::make_unique(GetForegroundWindow(), Device); - // } - //} + // imgui - legacy menu disabled for now + //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) + //{ + // if (Imgui != nullptr && Imgui.get() != nullptr) + // { + // LOG_DEBUG("Apply Imgui"); + + // if (Imgui->IsHandleDifferent()) + // { + // LOG_DEBUG("Imgui handle different, reset()!"); + // std::this_thread::sleep_for(std::chrono::milliseconds(250)); + // Imgui.reset(); + // } + // else + // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); + // } + // else + // { + // if (Imgui == nullptr || Imgui.get() == nullptr) + // Imgui = std::make_unique(GetForegroundWindow(), Device); + // } + //} + + evalResult = true; + + } while (false); _frameCount++; Dx12CommandQueue->Signal(Dx12Fence, _frameCount); - return true; + return evalResult; } FSR2FeatureDx11on12::~FSR2FeatureDx11on12() diff --git a/OptiScaler/upscalers/fsr2_212/FSR2Feature_Dx11On12_212.cpp b/OptiScaler/upscalers/fsr2_212/FSR2Feature_Dx11On12_212.cpp index ea99a820..02780a81 100644 --- a/OptiScaler/upscalers/fsr2_212/FSR2Feature_Dx11On12_212.cpp +++ b/OptiScaler/upscalers/fsr2_212/FSR2Feature_Dx11On12_212.cpp @@ -165,6 +165,8 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS params.commandList = Fsr212::ffxGetCommandListDX12_212(cmdList); + auto ffxresult = Fsr212::FFX_ERROR_INVALID_ALIGNMENT; + do { if (!ProcessDx11Textures(InParameters)) @@ -273,7 +275,7 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS params.preExposure = 1.0f; LOG_DEBUG("Dispatch!!"); - auto ffxresult = Fsr212::ffxFsr2ContextDispatch212(&_context, ¶ms); + ffxresult = Fsr212::ffxFsr2ContextDispatch212(&_context, ¶ms); if (ffxresult != Fsr212::FFX_OK) { @@ -345,39 +347,51 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS Dx12CommandQueue->ExecuteCommandLists(1, ppCommandLists); Dx12CommandQueue->Signal(dx12FenceTextureCopy, _fenceValue); - if (!CopyBackOutput()) + auto evalResult = false; + + do { - LOG_ERROR("Can't copy output texture back!"); - return false; - } + if (ffxresult != Fsr212::FFX_OK) + break; - // imgui - legacy menu disabled for now - //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) - //{ - // if (Imgui != nullptr && Imgui.get() != nullptr) - // { - // LOG_DEBUG("Apply Imgui"); + if (!CopyBackOutput()) + { + LOG_ERROR("Can't copy output texture back!"); + break; + } + + // imgui - legacy menu disabled for now + //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) + //{ + // if (Imgui != nullptr && Imgui.get() != nullptr) + // { + // LOG_DEBUG("Apply Imgui"); + + // if (Imgui->IsHandleDifferent()) + // { + // LOG_DEBUG("Imgui handle different, reset()!"); + // std::this_thread::sleep_for(std::chrono::milliseconds(250)); + // Imgui.reset(); + // } + // else + // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); + // } + // else + // { + // if (Imgui == nullptr || Imgui.get() == nullptr) + // Imgui = std::make_unique(GetForegroundWindow(), Device); + // } + //} + + evalResult = true; + + } while (false); - // if (Imgui->IsHandleDifferent()) - // { - // LOG_DEBUG("Imgui handle different, reset()!"); - // std::this_thread::sleep_for(std::chrono::milliseconds(250)); - // Imgui.reset(); - // } - // else - // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); - // } - // else - // { - // if (Imgui == nullptr || Imgui.get() == nullptr) - // Imgui = std::make_unique(GetForegroundWindow(), Device); - // } - //} _frameCount++; Dx12CommandQueue->Signal(Dx12Fence, _frameCount); - return true; + return evalResult; } FSR2FeatureDx11on12_212::~FSR2FeatureDx11on12_212() diff --git a/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp b/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp index b7ef1dce..2d2df813 100644 --- a/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp +++ b/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp @@ -189,6 +189,8 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_ params.commandList = cmdList; + ffxReturnCode_t ffxresult = FFX_API_RETURN_ERROR; + do { if (!ProcessDx11Textures(InParameters)) @@ -320,7 +322,7 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_ params.upscaleSize.height *= Config::Instance()->OutputScalingMultiplier.value_or_default(); LOG_DEBUG("Dispatch!!"); - auto ffxresult = FfxApiProxy::D3D12_Dispatch()(&_context, ¶ms.header); + ffxresult = FfxApiProxy::D3D12_Dispatch()(&_context, ¶ms.header); if (ffxresult != FFX_API_RETURN_OK) @@ -393,39 +395,50 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_ Dx12CommandQueue->ExecuteCommandLists(1, ppCommandLists); Dx12CommandQueue->Signal(dx12FenceTextureCopy, _fenceValue); - if (!CopyBackOutput()) + auto evalResult = false; + + do { - LOG_ERROR("Can't copy output texture back!"); - return false; - } + if (ffxresult != FFX_API_RETURN_OK) + break; - // imgui - legacy menu disabled for now - //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) - //{ - // if (Imgui != nullptr && Imgui.get() != nullptr) - // { - // LOG_DEBUG("Apply Imgui"); + if (!CopyBackOutput()) + { + LOG_ERROR("Can't copy output texture back!"); + break; + } - // if (Imgui->IsHandleDifferent()) - // { - // LOG_DEBUG("Imgui handle different, reset()!"); - // std::this_thread::sleep_for(std::chrono::milliseconds(250)); - // Imgui.reset(); - // } - // else - // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); - // } - // else - // { - // if (Imgui == nullptr || Imgui.get() == nullptr) - // Imgui = std::make_unique(GetForegroundWindow(), Device); - // } - //} + // imgui - legacy menu disabled for now + //if (!Config::Instance()->OverlayMenu.value_or_default() && _frameCount > 30) + //{ + // if (Imgui != nullptr && Imgui.get() != nullptr) + // { + // LOG_DEBUG("Apply Imgui"); + + // if (Imgui->IsHandleDifferent()) + // { + // LOG_DEBUG("Imgui handle different, reset()!"); + // std::this_thread::sleep_for(std::chrono::milliseconds(250)); + // Imgui.reset(); + // } + // else + // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); + // } + // else + // { + // if (Imgui == nullptr || Imgui.get() == nullptr) + // Imgui = std::make_unique(GetForegroundWindow(), Device); + // } + //} + + evalResult = true; + + } while (false); _frameCount++; Dx12CommandQueue->Signal(Dx12Fence, _frameCount); - return true; + return evalResult; } bool FSR31FeatureDx11on12::InitFSR3(const NVSDK_NGX_Parameter* InParameters) diff --git a/OptiScaler/upscalers/xess/XeSSFeature_Dx11on12.cpp b/OptiScaler/upscalers/xess/XeSSFeature_Dx11on12.cpp index f25361f1..4a9cbc2c 100644 --- a/OptiScaler/upscalers/xess/XeSSFeature_Dx11on12.cpp +++ b/OptiScaler/upscalers/xess/XeSSFeature_Dx11on12.cpp @@ -341,39 +341,52 @@ bool XeSSFeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N Dx12CommandQueue->ExecuteCommandLists(1, ppCommandLists); Dx12CommandQueue->Signal(dx12FenceTextureCopy, _fenceValue); - if (!CopyBackOutput()) + auto evalResult = false; + + do { - LOG_ERROR("Can't copy output texture back!"); - return false; - } + if (xessResult != XESS_RESULT_SUCCESS) + break; + + if (!CopyBackOutput()) + { + LOG_ERROR("Can't copy output texture back!"); + break; + } + + // imgui - legacy menu disabled for now + //if (!Config::Instance()->OverlayMenu.value_or(true) && _frameCount > 30) + //{ + // if (Imgui != nullptr && Imgui.get() != nullptr) + // { + // LOG_DEBUG("Apply Imgui"); + + // if (Imgui->IsHandleDifferent()) + // { + // LOG_DEBUG("Imgui handle different, reset()!"); + // std::this_thread::sleep_for(std::chrono::milliseconds(250)); + // Imgui.reset(); + // } + // else + // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); + // } + // else + // { + // if (Imgui == nullptr || Imgui.get() == nullptr) + // Imgui = std::make_unique(GetForegroundWindow(), Device); + // } + //} + + evalResult = true; + + } while (false); - // imgui - legacy menu disabled for now - //if (!Config::Instance()->OverlayMenu.value_or(true) && _frameCount > 30) - //{ - // if (Imgui != nullptr && Imgui.get() != nullptr) - // { - // LOG_DEBUG("Apply Imgui"); - // if (Imgui->IsHandleDifferent()) - // { - // LOG_DEBUG("Imgui handle different, reset()!"); - // std::this_thread::sleep_for(std::chrono::milliseconds(250)); - // Imgui.reset(); - // } - // else - // Imgui->Render(InDeviceContext, paramOutput[_frameCount % 2]); - // } - // else - // { - // if (Imgui == nullptr || Imgui.get() == nullptr) - // Imgui = std::make_unique(GetForegroundWindow(), Device); - // } - //} _frameCount++; Dx12CommandQueue->Signal(Dx12Fence, _frameCount); - return true; + return evalResult; } XeSSFeatureDx11on12::~XeSSFeatureDx11on12()