mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-28 17:16:46 +00:00
fix for arc dx11 this time
automatic motion vector size configuration
This commit is contained in:
@@ -188,13 +188,11 @@ bool FSR2FeatureDx11::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureDx11::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureDx11::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
@@ -277,6 +275,26 @@ bool FSR2FeatureDx11::Evaluate(ID3D11DeviceContext* InContext, const NVSDK_NGX_P
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11::Evaluate MotionVectors exist..");
|
||||
params.motionVectors = ffxGetResourceDX11(&_context, paramVelocity, (wchar_t*)L"FSR2_MotionVectors");
|
||||
|
||||
if (!Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
((ID3D11Texture2D*)paramVelocity)->GetDesc(&desc);
|
||||
bool lowResMV = desc.Width == params.renderSize.width;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11,30 +11,10 @@ bool FSR2FeatureDx11on12::Init(ID3D11Device* InDevice, ID3D11DeviceContext* InCo
|
||||
if (IsInited())
|
||||
return true;
|
||||
|
||||
if (!BaseInit(InDevice, InContext, InParameters))
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12::Init BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
Device = InDevice;
|
||||
DeviceContext = InContext;
|
||||
|
||||
spdlog::debug("FSR2FeatureDx11on12::Init calling InitFSR2");
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12::Init Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitFSR2(InParameters))
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12::Init InitFSR2 fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
_baseInit = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -43,6 +23,39 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, const N
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12::Evaluate");
|
||||
|
||||
if (!_baseInit)
|
||||
{
|
||||
if (!BaseInit(Device, InDeviceContext, InParameters))
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12::Evaluate BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
_baseInit = true;
|
||||
|
||||
spdlog::debug("FSR2FeatureDx11on12::Evaluate calling InitFSR2");
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12::Evaluate Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitFSR2(InParameters))
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12::Evaluate InitFSR2 fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
|
||||
spdlog::trace("FSR2FeatureDx11on12::Evaluate sleeping after FSRContext creation for 1500ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
}
|
||||
|
||||
if (!IsInited())
|
||||
return false;
|
||||
|
||||
@@ -117,6 +130,25 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, const N
|
||||
_hasTM = params.reactive.resource != nullptr;
|
||||
_hasOutput = params.output.resource != nullptr;
|
||||
|
||||
if (_hasMV && !Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = dx11Mv.Dx12Resource->GetDesc();
|
||||
bool lowResMV = desc.Width == params.renderSize.width;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11on12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11on12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
float MVScaleX = 1.0f;
|
||||
@@ -347,13 +379,11 @@ bool FSR2FeatureDx11on12::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureDx11on12::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureDx11on12::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class FSR2FeatureDx11on12 : public FSR2Feature, public IFeature_Dx11wDx12
|
||||
{
|
||||
private:
|
||||
bool _baseInit = false;
|
||||
|
||||
protected:
|
||||
bool InitFSR2(const NVSDK_NGX_Parameter* InParameters);
|
||||
|
||||
@@ -95,6 +95,33 @@ bool FSR2FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N
|
||||
ResourceBarrier(InCommandList, paramVelocity,
|
||||
(D3D12_RESOURCE_STATES)Config::Instance()->MVResourceBarrier.value(),
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
else if (Config::Instance()->NVNGX_Engine == NVSDK_NGX_ENGINE_TYPE_UNREAL)
|
||||
{
|
||||
Config::Instance()->MVResourceBarrier = (int)D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||
|
||||
ResourceBarrier(InCommandList, paramVelocity,
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
if (!Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = paramVelocity->GetDesc();
|
||||
bool lowResMV = desc.Width == params.renderSize.width;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
|
||||
params.motionVectors = ffxGetResourceDX12(&_context, paramVelocity, (wchar_t*)L"FSR2_MotionVectors", FFX_RESOURCE_STATE_COMPUTE_READ);
|
||||
}
|
||||
@@ -444,13 +471,11 @@ bool FSR2FeatureDx12::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureDx12::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureDx12::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,11 @@ bool FSR2FeatureVk::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureVk::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureVk::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,30 +11,10 @@ bool FSR2FeatureDx11on12_212::Init(ID3D11Device* InDevice, ID3D11DeviceContext*
|
||||
if (IsInited())
|
||||
return true;
|
||||
|
||||
if (!BaseInit(InDevice, InContext, InParameters))
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12_212::Init BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
Device = InDevice;
|
||||
DeviceContext = InContext;
|
||||
|
||||
spdlog::debug("FSR2FeatureDx11on12_212::Init calling InitFSR2");
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12_212::Init Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitFSR2(InParameters))
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12_212::Init InitFSR2 fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
_baseInit = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -43,6 +23,39 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, con
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12_212::Evaluate");
|
||||
|
||||
if (!_baseInit)
|
||||
{
|
||||
if (!BaseInit(Device, InDeviceContext, InParameters))
|
||||
{
|
||||
spdlog::debug("FSR2FeatureDx11on12_212::Init BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
_baseInit = true;
|
||||
|
||||
spdlog::debug("FSR2FeatureDx11on12_212::Init calling InitFSR2");
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12_212::Init Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitFSR2(InParameters))
|
||||
{
|
||||
spdlog::error("FSR2FeatureDx11on12_212::Init InitFSR2 fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
|
||||
spdlog::trace("FSR2FeatureDx11on12_212::Evaluate sleeping after FSRContext creation for 1500ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
}
|
||||
|
||||
if (!IsInited())
|
||||
return false;
|
||||
|
||||
@@ -115,6 +128,25 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, con
|
||||
_hasTM = params.reactive.resource != nullptr;
|
||||
_hasOutput = params.output.resource != nullptr;
|
||||
|
||||
if (_hasMV && !Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = dx11Mv.Dx12Resource->GetDesc();
|
||||
bool lowResMV = desc.Width == params.renderSize.width;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11on12_212::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx11on12_212::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
float MVScaleX = 1.0f;
|
||||
@@ -343,13 +375,11 @@ bool FSR2FeatureDx11on12_212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= Fsr212::FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureDx11on12_212::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureDx11on12_212::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class FSR2FeatureDx11on12_212 : public FSR2Feature212, public IFeature_Dx11wDx12
|
||||
{
|
||||
private:
|
||||
bool _baseInit = false;
|
||||
|
||||
protected:
|
||||
bool InitFSR2(const NVSDK_NGX_Parameter* InParameters);
|
||||
|
||||
@@ -71,10 +71,7 @@ bool FSR2FeatureDx12_212::Evaluate(ID3D12GraphicsCommandList* InCommandList, con
|
||||
else if (Config::Instance()->NVNGX_Engine == NVSDK_NGX_ENGINE_TYPE_UNREAL)
|
||||
{
|
||||
Config::Instance()->ColorResourceBarrier = (int)D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
|
||||
ResourceBarrier(InCommandList, paramColor,
|
||||
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
ResourceBarrier(InCommandList, paramColor, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
params.color = Fsr212::ffxGetResourceDX12_212(&_context, paramColor, (wchar_t*)L"FSR2_Color", Fsr212::FFX_RESOURCE_STATE_COMPUTE_READ);
|
||||
@@ -94,9 +91,31 @@ bool FSR2FeatureDx12_212::Evaluate(ID3D12GraphicsCommandList* InCommandList, con
|
||||
spdlog::debug("FSR2FeatureDx12_212::Evaluate MotionVectors exist..");
|
||||
|
||||
if (Config::Instance()->MVResourceBarrier.has_value())
|
||||
ResourceBarrier(InCommandList, paramVelocity,
|
||||
(D3D12_RESOURCE_STATES)Config::Instance()->MVResourceBarrier.value(),
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
ResourceBarrier(InCommandList, paramVelocity, (D3D12_RESOURCE_STATES)Config::Instance()->MVResourceBarrier.value(), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
else if (Config::Instance()->NVNGX_Engine == NVSDK_NGX_ENGINE_TYPE_UNREAL)
|
||||
{
|
||||
Config::Instance()->MVResourceBarrier = (int)D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||
ResourceBarrier(InCommandList, paramVelocity, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
if (!Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = paramVelocity->GetDesc();
|
||||
bool lowResMV = desc.Width == params.renderSize.width;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx12_212::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("FSR2FeatureDx12_212::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
|
||||
params.motionVectors = Fsr212::ffxGetResourceDX12_212(&_context, paramVelocity, (wchar_t*)L"FSR2_MotionVectors", Fsr212::FFX_RESOURCE_STATE_COMPUTE_READ);
|
||||
}
|
||||
@@ -452,13 +471,11 @@ bool FSR2FeatureDx12_212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= Fsr212::FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureDx12_212::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureDx12_212::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,11 @@ bool FSR2FeatureVk212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
_contextDesc.flags |= Fsr212::FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS;
|
||||
spdlog::info("FSR2FeatureVk212::InitFSR2 xessParams.initFlags (!LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("FSR2FeatureVk212::InitFSR2 xessParams.initFlags (LowResMV) {0:b}", _contextDesc.flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,13 +103,11 @@ bool XeSSFeature::InitXeSS(ID3D12Device* device, const NVSDK_NGX_Parameter* InPa
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(!LowRes))
|
||||
{
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
xessParams.initFlags |= XESS_INIT_FLAG_HIGH_RES_MV;
|
||||
spdlog::info("XeSSFeature::InitXeSS xessParams.initFlags (!LowResMV) {0:b}", xessParams.initFlags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
spdlog::info("XeSSFeature::InitXeSS xessParams.initFlags (LowResMV) {0:b}", xessParams.initFlags);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,36 +19,10 @@ bool XeSSFeatureDx11::Init(ID3D11Device* InDevice, ID3D11DeviceContext* InContex
|
||||
if (IsInited())
|
||||
return true;
|
||||
|
||||
if (!BaseInit(InDevice, InContext, InParameters))
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Init BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
Device = InDevice;
|
||||
DeviceContext = InContext;
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Init Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
spdlog::debug("XeSSFeatureDx11::Init calling InitXeSS");
|
||||
|
||||
if (!InitXeSS(Dx12on11Device, InParameters))
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Init InitXeSS fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
{
|
||||
spdlog::debug("XeSSFeatureDx11::Init Create Imgui!");
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
}
|
||||
|
||||
spdlog::trace("XeSSFeatureDx11::Init sleeping after XeSSContext creation for 500ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
_baseInit = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -57,6 +31,42 @@ bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, const NVSDK
|
||||
{
|
||||
spdlog::debug("XeSSFeatureDx11::Evaluate");
|
||||
|
||||
if (!_baseInit)
|
||||
{
|
||||
if (!BaseInit(Device, InDeviceContext, InParameters))
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Evaluate BaseInit failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
_baseInit = true;
|
||||
|
||||
if (Dx12on11Device == nullptr)
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Evaluate Dx12on11Device is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
spdlog::debug("XeSSFeatureDx11::Evaluate calling InitXeSS");
|
||||
|
||||
if (!InitXeSS(Dx12on11Device, InParameters))
|
||||
{
|
||||
spdlog::error("XeSSFeatureDx11::Evaluate InitXeSS fail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Imgui == nullptr || Imgui.get() == nullptr)
|
||||
{
|
||||
spdlog::debug("XeSSFeatureDx11::Evaluate Create Imgui!");
|
||||
Imgui = std::make_unique<Imgui_Dx11>(GetForegroundWindow(), Device);
|
||||
}
|
||||
|
||||
spdlog::trace("XeSSFeatureDx11::Evaluate sleeping after XeSSContext creation for 1500ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||
|
||||
OUT_DS = std::make_unique<DS_Dx12>("Output Downsample", Dx12on11Device);
|
||||
}
|
||||
|
||||
if (!IsInited() || !_xessContext)
|
||||
return false;
|
||||
|
||||
@@ -185,6 +195,25 @@ bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, const NVSDK
|
||||
params.pResponsivePixelMaskTexture = dx11Tm.Dx12Resource;
|
||||
_hasTM = params.pResponsivePixelMaskTexture != nullptr;
|
||||
|
||||
if (_hasMV && !Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = dx11Mv.Dx12Resource->GetDesc();
|
||||
bool lowResMV = desc.Width == params.inputWidth;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("XeSSFeatureDx11::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("XeSSFeatureDx11::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
|
||||
spdlog::debug("XeSSFeatureDx11::Evaluate Textures -> params complete!");
|
||||
|
||||
float MVScaleX;
|
||||
|
||||
@@ -7,6 +7,7 @@ class XeSSFeatureDx11 : public XeSSFeature, public IFeature_Dx11wDx12
|
||||
{
|
||||
private:
|
||||
ID3D12Resource* _outBuffer;
|
||||
bool _baseInit = false;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -142,6 +142,25 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
if (_hasMV && !Config::Instance()->DisplayResolution.has_value())
|
||||
{
|
||||
auto desc = params.pVelocityTexture->GetDesc();
|
||||
bool lowResMV = desc.Width == params.inputWidth;
|
||||
|
||||
if (Config::Instance()->DisplayResolution.value_or(false) && lowResMV)
|
||||
{
|
||||
spdlog::warn("XeSSFeatureDx12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = false;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
else if (!Config::Instance()->DisplayResolution.value_or(false) && !lowResMV)
|
||||
{
|
||||
spdlog::warn("XeSSFeatureDx12::Evaluate MotionVectors size and feature init config not matching!!");
|
||||
Config::Instance()->DisplayResolution = true;
|
||||
Config::Instance()->changeBackend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user