More fixes to Dx11wDx12

This commit is contained in:
cdozdil
2025-05-06 10:52:23 +03:00
parent da20b454c2
commit 5aea5d7e2d
4 changed files with 160 additions and 107 deletions
@@ -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, &params);
ffxresult = ffxFsr2ContextDispatch(&_context, &params);
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<Menu_Dx11>(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<Menu_Dx11>(GetForegroundWindow(), Device);
// }
//}
evalResult = true;
} while (false);
_frameCount++;
Dx12CommandQueue->Signal(Dx12Fence, _frameCount);
return true;
return evalResult;
}
FSR2FeatureDx11on12::~FSR2FeatureDx11on12()
@@ -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, &params);
ffxresult = Fsr212::ffxFsr2ContextDispatch212(&_context, &params);
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<Menu_Dx11>(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<Menu_Dx11>(GetForegroundWindow(), Device);
// }
//}
_frameCount++;
Dx12CommandQueue->Signal(Dx12Fence, _frameCount);
return true;
return evalResult;
}
FSR2FeatureDx11on12_212::~FSR2FeatureDx11on12_212()
@@ -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, &params.header);
ffxresult = FfxApiProxy::D3D12_Dispatch()(&_context, &params.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<Menu_Dx11>(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<Menu_Dx11>(GetForegroundWindow(), Device);
// }
//}
evalResult = true;
} while (false);
_frameCount++;
Dx12CommandQueue->Signal(Dx12Fence, _frameCount);
return true;
return evalResult;
}
bool FSR31FeatureDx11on12::InitFSR3(const NVSDK_NGX_Parameter* InParameters)
@@ -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<Menu_Dx11>(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<Menu_Dx11>(GetForegroundWindow(), Device);
// }
//}
_frameCount++;
Dx12CommandQueue->Signal(Dx12Fence, _frameCount);
return true;
return evalResult;
}
XeSSFeatureDx11on12::~XeSSFeatureDx11on12()