mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-09-26 15:26:17 +00:00
Merge branch 'master' of https://github.com/cdozdil/OptiScaler
This commit is contained in:
@@ -296,6 +296,7 @@ copy NUL "$(SolutionDir)x64\Release\a\!! EXTRACT ALL FILES TO GAME FOLDER !!" /Y
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="inputs\FfxApi_Vk.h" />
|
||||
<ClInclude Include="inputs\NVNGX_DLSS.h" />
|
||||
<ClInclude Include="menu\font\Hack_Compressed.h" />
|
||||
<ClInclude Include="menu\menu_base.h" />
|
||||
<ClInclude Include="misc\FrameLimit.h" />
|
||||
|
||||
@@ -383,6 +383,9 @@
|
||||
<ClInclude Include="FSR4Upgrade.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inputs\NVNGX_DLSS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Config.cpp">
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <deque>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
typedef enum API
|
||||
{
|
||||
@@ -94,7 +95,7 @@ public:
|
||||
bool reflexShowWarning = false;
|
||||
|
||||
// for realtime changes
|
||||
bool changeBackend = false;
|
||||
ankerl::unordered_dense::map <unsigned int, bool> changeBackend;
|
||||
std::string newBackend = "";
|
||||
|
||||
// XeSS debug stuff
|
||||
|
||||
@@ -681,7 +681,7 @@ static Fsr212::FfxErrorCode ffxFsr20ContextDispatch_Dx12(Fsr212::FfxFsr2Context*
|
||||
|
||||
// HACK, DLSS thinks it's using dynamic res here and errors out when changing quality
|
||||
if (evalResult == NVSDK_NGX_Result_Fail && State::Instance().currentFeature->Name() == "DLSS")
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handle->Id] = true;
|
||||
|
||||
LOG_ERROR("evalResult: {:X}", (UINT)evalResult);
|
||||
return Fsr212::FFX_ERROR_BACKEND_API_ERROR;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
template <typename FeatureType>
|
||||
struct ContextData {
|
||||
std::unique_ptr<FeatureType> feature;
|
||||
NVSDK_NGX_Parameter* createParams = nullptr;
|
||||
int changeBackendCounter = 0;
|
||||
};
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "NVNGX_Parameter.h"
|
||||
#include "proxies/NVNGX_Proxy.h"
|
||||
#include "NVNGX_DLSS.h"
|
||||
|
||||
#include "upscalers/dlss/DLSSFeature_Dx11.h"
|
||||
#include "upscalers/dlssd/DLSSDFeature_Dx11.h"
|
||||
@@ -15,15 +16,13 @@
|
||||
#include "upscalers/fsr31/FSR31Feature_Dx11On12.h"
|
||||
#include "upscalers/xess/XeSSFeature_Dx11.h"
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
#include "hooks/HooksDx.h"
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
|
||||
inline ID3D11Device* D3D11Device = nullptr;
|
||||
static inline ankerl::unordered_dense::map <unsigned int, std::unique_ptr<IFeature_Dx11>> Dx11Contexts;
|
||||
static inline NVSDK_NGX_Parameter* createParams;
|
||||
static inline int changeBackendCounter = 0;
|
||||
static ankerl::unordered_dense::map<unsigned int, ContextData<IFeature_Dx11>> Dx11Contexts;
|
||||
static inline int evalCounter = 0;
|
||||
static inline bool shutdown = false;
|
||||
|
||||
@@ -194,8 +193,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_Shutdown()
|
||||
|
||||
for (auto const& [key, val] : Dx11Contexts)
|
||||
{
|
||||
if (val)
|
||||
NVSDK_NGX_D3D11_ReleaseFeature(val->Handle());
|
||||
if (val.feature)
|
||||
NVSDK_NGX_D3D11_ReleaseFeature(val.feature->Handle());
|
||||
}
|
||||
|
||||
Dx11Contexts.clear();
|
||||
@@ -382,16 +381,17 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
|
||||
if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "xess")
|
||||
{
|
||||
Dx11Contexts[handleId] = std::make_unique<XeSSFeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<XeSSFeatureDx11>(handleId, InParameters);
|
||||
|
||||
|
||||
if (!Dx11Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx11Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new XeSS with Dx12 feature, Fallback to FSR2.2!");
|
||||
|
||||
Dx11Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx11Contexts.erase(it);
|
||||
Dx11Contexts[handleId].feature.reset();
|
||||
Dx11Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx11Contexts.erase(it);
|
||||
|
||||
Config::Instance()->Dx11Upscaler = "fsr22";
|
||||
}
|
||||
@@ -405,15 +405,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
{
|
||||
if (Config::Instance()->DLSSEnabled.value_or_default())
|
||||
{
|
||||
Dx11Contexts[handleId] = std::make_unique<DLSSFeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<DLSSFeatureDx11>(handleId, InParameters);
|
||||
|
||||
if (!Dx11Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx11Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new DLSS feature, Fallback to FSR2.2!");
|
||||
|
||||
Dx11Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx11Contexts.erase(it);
|
||||
Dx11Contexts[handleId].feature.reset();
|
||||
Dx11Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx11Contexts.erase(it);
|
||||
|
||||
Config::Instance()->Dx11Upscaler = "fsr22";
|
||||
}
|
||||
@@ -430,15 +431,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
|
||||
if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr31_12")
|
||||
{
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11on12>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11on12>(handleId, InParameters);
|
||||
|
||||
if (!Dx11Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx11Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new FSR 3.1 feature, Fallback to FSR2.2!");
|
||||
|
||||
Dx11Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx11Contexts.erase(it);
|
||||
Dx11Contexts[handleId].feature.reset();
|
||||
Dx11Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx11Contexts.erase(it);
|
||||
|
||||
Config::Instance()->Dx11Upscaler = "fsr22";
|
||||
}
|
||||
@@ -451,36 +453,36 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr22_12")
|
||||
{
|
||||
LOG_INFO("creating new FSR 2.2.1 with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11on12>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11on12>(handleId, InParameters);
|
||||
}
|
||||
else if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr21_12")
|
||||
{
|
||||
LOG_INFO("creating new FSR 2.1.2 with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11on12_212>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11on12_212>(handleId, InParameters);
|
||||
}
|
||||
else if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr22")
|
||||
{
|
||||
LOG_INFO("creating new native FSR 2.2.1 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11>(handleId, InParameters);
|
||||
}
|
||||
else if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr31")
|
||||
{
|
||||
LOG_INFO("creating new native FSR 3.1.0 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11>(handleId, InParameters);
|
||||
}
|
||||
//else if (Config::Instance()->Dx11Upscaler.value_or(defaultUpscaler) == "fsr304")
|
||||
//{
|
||||
// LOG_INFO("creating new native FSR 3.1.0 feature");
|
||||
// Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11>(handleId, InParameters);
|
||||
// Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11>(handleId, InParameters);
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<DLSSDFeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<DLSSDFeatureDx11>(handleId, InParameters);
|
||||
}
|
||||
|
||||
auto deviceContext = Dx11Contexts[handleId].get();
|
||||
auto deviceContext = Dx11Contexts[handleId].feature.get();
|
||||
*OutHandle = deviceContext->Handle();
|
||||
|
||||
if (!D3D11Device)
|
||||
@@ -508,7 +510,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
LOG_ERROR("CreateFeature failed");
|
||||
|
||||
State::Instance().newBackend = "fsr22";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
@@ -539,7 +541,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
if (!shutdown)
|
||||
LOG_INFO("releasing feature with id {0}", handleId);
|
||||
|
||||
if (auto deviceContext = Dx11Contexts[handleId].get(); deviceContext != nullptr)
|
||||
if (auto deviceContext = Dx11Contexts[handleId].feature.get(); deviceContext != nullptr)
|
||||
{
|
||||
if (!shutdown)
|
||||
{
|
||||
@@ -553,7 +555,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
State::Instance().currentFeature = nullptr;
|
||||
}
|
||||
|
||||
Dx11Contexts[handleId].reset();
|
||||
Dx11Contexts[handleId].feature.reset();
|
||||
auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx11Contexts.erase(it);
|
||||
|
||||
@@ -652,40 +654,41 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
|
||||
IFeature_Dx11* deviceContext = nullptr;
|
||||
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[handleId])
|
||||
{
|
||||
if (State::Instance().newBackend == "" || (!Config::Instance()->DLSSEnabled.value_or_default() && State::Instance().newBackend == "dlss"))
|
||||
State::Instance().newBackend = Config::Instance()->Dx11Upscaler.value_or_default();
|
||||
|
||||
changeBackendCounter++;
|
||||
Dx11Contexts[handleId].changeBackendCounter++;
|
||||
|
||||
// first release everything
|
||||
if (changeBackendCounter == 1)
|
||||
if (Dx11Contexts[handleId].changeBackendCounter == 1)
|
||||
{
|
||||
if (Dx11Contexts.contains(handleId))
|
||||
if (Dx11Contexts.contains(handleId) && Dx11Contexts[handleId].feature != nullptr)
|
||||
{
|
||||
LOG_INFO("changing backend to {0}", State::Instance().newBackend);
|
||||
|
||||
auto dc = Dx11Contexts[handleId].get();
|
||||
auto dc = Dx11Contexts[handleId].feature.get();
|
||||
|
||||
if (State::Instance().newBackend != "dlssd" && State::Instance().newBackend != "dlss")
|
||||
createParams = GetNGXParameters("OptiDx11");
|
||||
Dx11Contexts[handleId].createParams = GetNGXParameters("OptiDx11");
|
||||
else
|
||||
createParams = InParameters;
|
||||
Dx11Contexts[handleId].createParams = InParameters;
|
||||
|
||||
createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
Dx11Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
|
||||
LOG_TRACE("sleeping before reset of current feature for 1000ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
|
||||
Dx11Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx11Contexts.erase(it);
|
||||
Dx11Contexts[handleId].feature.reset();
|
||||
Dx11Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx11Contexts.begin(), Dx11Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx11Contexts.erase(it);
|
||||
|
||||
State::Instance().currentFeature = nullptr;
|
||||
}
|
||||
@@ -694,75 +697,75 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
LOG_ERROR("can't find handle {0} in Dx11Contexts!", handleId);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
|
||||
if (createParams != nullptr)
|
||||
if (Dx11Contexts[handleId].createParams != nullptr)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(Dx11Contexts[handleId].createParams);
|
||||
Dx11Contexts[handleId].createParams = nullptr;
|
||||
}
|
||||
|
||||
changeBackendCounter = 0;
|
||||
Dx11Contexts[handleId].changeBackendCounter = 0;
|
||||
}
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
if (changeBackendCounter == 2)
|
||||
if (Dx11Contexts[handleId].changeBackendCounter == 2)
|
||||
{
|
||||
// next frame prepare stuff
|
||||
if (State::Instance().newBackend == "xess")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "xess";
|
||||
LOG_INFO("creating new XeSS with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<XeSSFeatureDx11>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<XeSSFeatureDx11>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlss")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "dlss";
|
||||
LOG_INFO("creating new DLSS feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<DLSSFeatureDx11>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<DLSSFeatureDx11>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlssd")
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<DLSSDFeatureDx11>(handleId, InParameters);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<DLSSDFeatureDx11>(handleId, InParameters);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr21_12")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "fsr21_12";
|
||||
LOG_INFO("creating new FSR 2.1.2 with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11on12_212>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11on12_212>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr31_12")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "fsr31_12";
|
||||
LOG_INFO("creating new FSR 3.1 with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11on12>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11on12>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr22_12")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "fsr22_12";
|
||||
LOG_INFO("creating new FSR 2.2.1 with Dx12 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11on12>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11on12>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr22")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "fsr22";
|
||||
LOG_INFO("creating new native FSR 2.2.1 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR2FeatureDx11>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR2FeatureDx11>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr31")
|
||||
{
|
||||
Config::Instance()->Dx11Upscaler = "fsr31";
|
||||
LOG_INFO("creating new native FSR 3.1.0 feature");
|
||||
Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11>(handleId, createParams);
|
||||
Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11>(handleId, Dx11Contexts[handleId].createParams);
|
||||
}
|
||||
//else if (State::Instance().newBackend == "fsr304")
|
||||
//{
|
||||
// Config::Instance()->Dx11Upscaler = "fsr31";
|
||||
// LOG_INFO("creating new native FSR 3.1.0 feature");
|
||||
// Dx11Contexts[handleId] = std::make_unique<FSR31FeatureDx11>(handleId, createParams);
|
||||
// Dx11Contexts[handleId].feature = std::make_unique<FSR31FeatureDx11>(handleId, Dx11Contexts[handleId].createParams);
|
||||
//}
|
||||
|
||||
if (Config::Instance()->Dx11DelayedInit.value_or_default() &&
|
||||
@@ -775,10 +778,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
if (changeBackendCounter == 3)
|
||||
if (Dx11Contexts[handleId].changeBackendCounter == 3)
|
||||
{
|
||||
// then init and continue
|
||||
auto initResult = Dx11Contexts[handleId]->Init(D3D11Device, InDevCtx, createParams);
|
||||
auto initResult = Dx11Contexts[handleId].feature->Init(D3D11Device, InDevCtx, Dx11Contexts[handleId].createParams);
|
||||
|
||||
if (Config::Instance()->Dx11DelayedInit.value_or_default())
|
||||
{
|
||||
@@ -786,21 +789,21 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
|
||||
changeBackendCounter = 0;
|
||||
Dx11Contexts[handleId].changeBackendCounter = 0;
|
||||
|
||||
if (!initResult || !Dx11Contexts[handleId]->ModuleLoaded())
|
||||
if (!initResult || !Dx11Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("init failed with {0} feature", State::Instance().newBackend);
|
||||
|
||||
if (State::Instance().newBackend != "dlssd")
|
||||
{
|
||||
State::Instance().newBackend = "fsr22";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
return NVSDK_NGX_Result_Fail;
|
||||
}
|
||||
}
|
||||
@@ -809,26 +812,26 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
LOG_INFO("init successful for {0}, upscaler changed", State::Instance().newBackend);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
evalCounter = 0;
|
||||
}
|
||||
|
||||
// if opti nvparam release it
|
||||
int optiParam = 0;
|
||||
if (createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
if (Dx11Contexts[handleId].createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(Dx11Contexts[handleId].createParams);
|
||||
Dx11Contexts[handleId].createParams = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// if initial feature can't be inited
|
||||
State::Instance().currentFeature = Dx11Contexts[handleId].get();
|
||||
State::Instance().currentFeature = Dx11Contexts[handleId].feature.get();
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
deviceContext = Dx11Contexts[handleId].get();
|
||||
deviceContext = Dx11Contexts[handleId].feature.get();
|
||||
State::Instance().currentFeature = deviceContext;
|
||||
|
||||
if (deviceContext == nullptr)
|
||||
@@ -848,7 +851,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte
|
||||
if (!deviceContext->Evaluate(InDevCtx, InParameters) && !deviceContext->IsInited() && (deviceContext->Name() == "XeSS" || deviceContext->Name() == "DLSS" || deviceContext->Name() == "FSR3 w/Dx12"))
|
||||
{
|
||||
State::Instance().newBackend = "fsr22";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
}
|
||||
|
||||
InDevCtx->End(HooksDx::endQueries[nextFrameIndex]);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "NVNGX_Parameter.h"
|
||||
#include "proxies/NVNGX_Proxy.h"
|
||||
#include "DLSSG_Mod.h"
|
||||
#include "NVNGX_DLSS.h"
|
||||
|
||||
#include "upscalers/dlss/DLSSFeature_Dx12.h"
|
||||
#include "upscalers/dlssd/DLSSDFeature_Dx12.h"
|
||||
@@ -31,12 +32,11 @@ static UINT64 fgLastFrameTime = 0;
|
||||
static UINT64 fgLastFGFrame = 0;
|
||||
static UINT fgCallbackFrameIndex = 0;
|
||||
|
||||
static ankerl::unordered_dense::map <unsigned int, std::unique_ptr<IFeature_Dx12>> Dx12Contexts;
|
||||
static ankerl::unordered_dense::map<unsigned int, ContextData<IFeature_Dx12>> Dx12Contexts;
|
||||
|
||||
static ankerl::unordered_dense::map <ID3D12GraphicsCommandList*, ID3D12RootSignature*> computeSignatures;
|
||||
static ankerl::unordered_dense::map <ID3D12GraphicsCommandList*, ID3D12RootSignature*> graphicSignatures;
|
||||
static ID3D12Device* D3D12Device = nullptr;
|
||||
static NVSDK_NGX_Parameter* createParams = nullptr;
|
||||
static int changeBackendCounter = 0;
|
||||
static int evalCounter = 0;
|
||||
static std::wstring appDataPath = L".";
|
||||
static bool shutdown = false;
|
||||
@@ -197,7 +197,7 @@ static void UnhookAll()
|
||||
#pragma region DLSS Init Calls
|
||||
|
||||
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath,
|
||||
ID3D12Device* InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
|
||||
ID3D12Device* InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
|
||||
{
|
||||
LOG_FUNC();
|
||||
|
||||
@@ -310,7 +310,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApp
|
||||
}
|
||||
|
||||
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath,
|
||||
ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo, NVSDK_NGX_Version InSDKVersion)
|
||||
ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo, NVSDK_NGX_Version InSDKVersion)
|
||||
{
|
||||
LOG_FUNC();
|
||||
|
||||
@@ -350,7 +350,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init(unsigned long long InApplica
|
||||
}
|
||||
|
||||
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_ProjectID(const char* InProjectId, NVSDK_NGX_EngineType InEngineType,
|
||||
const char* InEngineVersion, const wchar_t* InApplicationDataPath, ID3D12Device* InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
|
||||
const char* InEngineVersion, const wchar_t* InApplicationDataPath, ID3D12Device* InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
|
||||
{
|
||||
LOG_FUNC();
|
||||
|
||||
@@ -396,7 +396,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_ProjectID(const char* InProj
|
||||
|
||||
// Not sure about this one, original nvngx does not export this method
|
||||
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_with_ProjectID(const char* InProjectId, NVSDK_NGX_EngineType InEngineType, const char* InEngineVersion,
|
||||
const wchar_t* InApplicationDataPath, ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo, NVSDK_NGX_Version InSDKVersion)
|
||||
const wchar_t* InApplicationDataPath, ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo, NVSDK_NGX_Version InSDKVersion)
|
||||
{
|
||||
LOG_FUNC();
|
||||
|
||||
@@ -429,8 +429,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Shutdown(void)
|
||||
inited = false;
|
||||
|
||||
for (auto const& [key, val] : Dx12Contexts) {
|
||||
if (val)
|
||||
NVSDK_NGX_D3D12_ReleaseFeature(val->Handle());
|
||||
if (val.feature)
|
||||
NVSDK_NGX_D3D12_ReleaseFeature(val.feature->Handle());
|
||||
}
|
||||
|
||||
Dx12Contexts.clear();
|
||||
@@ -690,15 +690,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
|
||||
if (upscalerChoice == 3)
|
||||
{
|
||||
Dx12Contexts[handleId] = std::make_unique<DLSSFeatureDx12>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<DLSSFeatureDx12>(handleId, InParameters);
|
||||
|
||||
if (!Dx12Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx12Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new DLSS feature, fallback to XeSS!");
|
||||
|
||||
Dx12Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx12Contexts.erase(it);
|
||||
Dx12Contexts[handleId].feature.reset();
|
||||
Dx12Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx12Contexts.erase(it);
|
||||
|
||||
upscalerChoice = 0;
|
||||
}
|
||||
@@ -711,15 +712,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
|
||||
if (upscalerChoice == 0)
|
||||
{
|
||||
Dx12Contexts[handleId] = std::make_unique<XeSSFeatureDx12>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<XeSSFeatureDx12>(handleId, InParameters);
|
||||
|
||||
if (!Dx12Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx12Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new XeSS feature, Fallback to FSR2.1!");
|
||||
|
||||
Dx12Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx12Contexts.erase(it);
|
||||
Dx12Contexts[handleId].feature.reset();
|
||||
Dx12Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx12Contexts.erase(it);
|
||||
|
||||
upscalerChoice = 2;
|
||||
}
|
||||
@@ -732,13 +734,13 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
|
||||
if (upscalerChoice == 4)
|
||||
{
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR31FeatureDx12>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR31FeatureDx12>(handleId, InParameters);
|
||||
|
||||
if (!Dx12Contexts[handleId]->ModuleLoaded())
|
||||
if (!Dx12Contexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new FSR 3.X feature, Fallback to FSR2.1!");
|
||||
|
||||
Dx12Contexts[handleId].reset();
|
||||
Dx12Contexts[handleId].feature.reset();
|
||||
auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx12Contexts.erase(it);
|
||||
|
||||
@@ -755,13 +757,13 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "fsr22";
|
||||
LOG_INFO("creating new FSR 2.2.1 feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR2FeatureDx12>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR2FeatureDx12>(handleId, InParameters);
|
||||
}
|
||||
else if (upscalerChoice == 2)
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "fsr21";
|
||||
LOG_INFO("creating new FSR 2.1.2 feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR2FeatureDx12_212>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR2FeatureDx12_212>(handleId, InParameters);
|
||||
}
|
||||
|
||||
// write back finel selected upscaler
|
||||
@@ -770,10 +772,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
else
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<DLSSDFeatureDx12>(handleId, InParameters);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<DLSSDFeatureDx12>(handleId, InParameters);
|
||||
}
|
||||
|
||||
auto deviceContext = Dx12Contexts[handleId].get();
|
||||
auto deviceContext = Dx12Contexts[handleId].feature.get();
|
||||
|
||||
if (*OutHandle == nullptr)
|
||||
*OutHandle = new NVSDK_NGX_Handle{ handleId };
|
||||
@@ -809,7 +811,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
{
|
||||
LOG_ERROR("CreateFeature failed, returning to FSR 2.1.2 upscaler");
|
||||
State::Instance().newBackend = "fsr21";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
}
|
||||
|
||||
if (Config::Instance()->RestoreComputeSignature.value_or_default() || Config::Instance()->RestoreGraphicSignature.value_or_default())
|
||||
@@ -885,7 +887,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
return DLSSGMod::D3D12_ReleaseFeature(InHandle);
|
||||
}
|
||||
|
||||
if (auto deviceContext = Dx12Contexts[handleId].get(); deviceContext != nullptr)
|
||||
if (auto deviceContext = Dx12Contexts[handleId].feature.get(); deviceContext != nullptr)
|
||||
{
|
||||
if (deviceContext == State::Instance().currentFeature)
|
||||
{
|
||||
@@ -893,7 +895,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
deviceContext->Shutdown();
|
||||
}
|
||||
|
||||
Dx12Contexts[handleId].reset();
|
||||
Dx12Contexts[handleId].feature.reset();
|
||||
auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx12Contexts.erase(it);
|
||||
}
|
||||
@@ -957,7 +959,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
}
|
||||
|
||||
auto handleId = InFeatureHandle->Id;
|
||||
if (Dx12Contexts[handleId] == nullptr) // prevent source api name flicker when dlssg is active
|
||||
if (Dx12Contexts[handleId].feature == nullptr) // prevent source api name flicker when dlssg is active
|
||||
State::Instance().setInputApiName = State::Instance().currentInputApiName;
|
||||
|
||||
if (State::Instance().setInputApiName.length() == 0)
|
||||
@@ -1158,17 +1160,17 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
IFeature_Dx12* deviceContext = nullptr;
|
||||
|
||||
// Change backend
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[handleId])
|
||||
{
|
||||
if (State::Instance().newBackend == "" || (!Config::Instance()->DLSSEnabled.value_or_default() && State::Instance().newBackend == "dlss"))
|
||||
State::Instance().newBackend = Config::Instance()->Dx12Upscaler.value_or_default();
|
||||
|
||||
changeBackendCounter++;
|
||||
Dx12Contexts[handleId].changeBackendCounter++;
|
||||
|
||||
LOG_INFO("changeBackend is true, counter: {0}", changeBackendCounter);
|
||||
LOG_INFO("changeBackend is true, counter: {0}", Dx12Contexts[handleId].changeBackendCounter);
|
||||
|
||||
// first release everything
|
||||
if (changeBackendCounter == 1)
|
||||
if (Dx12Contexts[handleId].changeBackendCounter == 1)
|
||||
{
|
||||
if (FrameGen_Dx12::fgIsActive)
|
||||
{
|
||||
@@ -1176,32 +1178,33 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
State::Instance().FGchanged = true;
|
||||
}
|
||||
|
||||
if (Dx12Contexts.contains(handleId))
|
||||
if (Dx12Contexts.contains(handleId) && Dx12Contexts[handleId].feature != nullptr)
|
||||
{
|
||||
LOG_INFO("changing backend to {0}", State::Instance().newBackend);
|
||||
|
||||
auto dc = Dx12Contexts[handleId].get();
|
||||
auto dc = Dx12Contexts[handleId].feature.get();
|
||||
|
||||
if (State::Instance().newBackend != "dlssd" && State::Instance().newBackend != "dlss")
|
||||
createParams = GetNGXParameters("OptiDx12");
|
||||
Dx12Contexts[handleId].createParams = GetNGXParameters("OptiDx12");
|
||||
else
|
||||
createParams = InParameters;
|
||||
Dx12Contexts[handleId].createParams = InParameters;
|
||||
|
||||
createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
Dx12Contexts[handleId].createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
|
||||
dc = nullptr;
|
||||
|
||||
LOG_DEBUG("sleeping before reset of current feature for 1000ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
|
||||
Dx12Contexts[handleId].reset();
|
||||
auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
Dx12Contexts.erase(it);
|
||||
Dx12Contexts[handleId].feature.reset();
|
||||
Dx12Contexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(Dx12Contexts.begin(), Dx12Contexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//Dx12Contexts.erase(it);
|
||||
|
||||
State::Instance().currentFeature = nullptr;
|
||||
|
||||
@@ -1212,22 +1215,22 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
LOG_ERROR("can't find handle {0} in Dx12Contexts!", handleId);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
|
||||
if (createParams != nullptr)
|
||||
if (Dx12Contexts[handleId].createParams != nullptr)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(Dx12Contexts[handleId].createParams);
|
||||
Dx12Contexts[handleId].createParams = nullptr;
|
||||
}
|
||||
|
||||
changeBackendCounter = 0;
|
||||
Dx12Contexts[handleId].changeBackendCounter = 0;
|
||||
}
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
// create new feature
|
||||
if (changeBackendCounter == 2)
|
||||
if (Dx12Contexts[handleId].changeBackendCounter == 2)
|
||||
{
|
||||
// backend selection
|
||||
// 0 : XeSS
|
||||
@@ -1242,40 +1245,40 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "fsr22";
|
||||
LOG_INFO("creating new FSR 2.2.1 feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR2FeatureDx12>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR2FeatureDx12>(handleId, Dx12Contexts[handleId].createParams);
|
||||
upscalerChoice = 1;
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr21")
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "fsr21";
|
||||
LOG_INFO("creating new FSR 2.1.2 feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR2FeatureDx12_212>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR2FeatureDx12_212>(handleId, Dx12Contexts[handleId].createParams);
|
||||
upscalerChoice = 2;
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlss")
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "dlss";
|
||||
LOG_INFO("creating new DLSS feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<DLSSFeatureDx12>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<DLSSFeatureDx12>(handleId, Dx12Contexts[handleId].createParams);
|
||||
upscalerChoice = 3;
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlssd")
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<DLSSDFeatureDx12>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<DLSSDFeatureDx12>(handleId, Dx12Contexts[handleId].createParams);
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr31")
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "fsr31";
|
||||
LOG_INFO("creating new FSR 3.X feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<FSR31FeatureDx12>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<FSR31FeatureDx12>(handleId, Dx12Contexts[handleId].createParams);
|
||||
upscalerChoice = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->Dx12Upscaler = "xess";
|
||||
LOG_INFO("creating new XeSS feature");
|
||||
Dx12Contexts[handleId] = std::make_unique<XeSSFeatureDx12>(handleId, createParams);
|
||||
Dx12Contexts[handleId].feature = std::make_unique<XeSSFeatureDx12>(handleId, Dx12Contexts[handleId].createParams);
|
||||
upscalerChoice = 0;
|
||||
}
|
||||
|
||||
@@ -1286,11 +1289,11 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
}
|
||||
|
||||
// init feature
|
||||
if (changeBackendCounter == 3)
|
||||
if (Dx12Contexts[handleId].changeBackendCounter == 3)
|
||||
{
|
||||
auto initResult = Dx12Contexts[handleId]->Init(D3D12Device, InCmdList, createParams);
|
||||
auto initResult = Dx12Contexts[handleId].feature->Init(D3D12Device, InCmdList, Dx12Contexts[handleId].createParams);
|
||||
|
||||
changeBackendCounter = 0;
|
||||
Dx12Contexts[handleId].changeBackendCounter = 0;
|
||||
|
||||
if (!initResult)
|
||||
{
|
||||
@@ -1316,7 +1319,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
State::Instance().newBackend = "dlssd";
|
||||
}
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
else
|
||||
@@ -1324,27 +1327,27 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
LOG_INFO("init successful for {0}, upscaler changed", State::Instance().newBackend);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
evalCounter = 0;
|
||||
}
|
||||
|
||||
// if opti nvparam release it
|
||||
int optiParam = 0;
|
||||
if (createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
if (Dx12Contexts[handleId].createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(Dx12Contexts[handleId].createParams);
|
||||
Dx12Contexts[handleId].createParams = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// if initial feature can't be inited
|
||||
State::Instance().currentFeature = Dx12Contexts[handleId].get();
|
||||
State::Instance().currentFeature = Dx12Contexts[handleId].feature.get();
|
||||
FrameGen_Dx12::fgTarget = 20;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
deviceContext = Dx12Contexts[handleId].get();
|
||||
deviceContext = Dx12Contexts[handleId].feature.get();
|
||||
|
||||
if (deviceContext == nullptr)
|
||||
{
|
||||
@@ -1356,7 +1359,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
|
||||
{
|
||||
LOG_WARN("InCmdList {0} is not inited, falling back to FSR 2.1.2", deviceContext->Name());
|
||||
State::Instance().newBackend = "fsr21";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#include "Util.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
#include "NVNGX_Parameter.h"
|
||||
#include "NVNGX_DLSS.h"
|
||||
#include "proxies/NVNGX_Proxy.h"
|
||||
#include "DLSSG_Mod.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "upscalers/fsr2/FSR2Feature_Vk.h"
|
||||
@@ -14,9 +16,8 @@
|
||||
|
||||
#include "hooks/HooksVk.h"
|
||||
|
||||
#include "NVNGX_Parameter.h"
|
||||
#include "proxies/NVNGX_Proxy.h"
|
||||
#include "DLSSG_Mod.h"
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
VkInstance vkInstance;
|
||||
VkPhysicalDevice vkPD;
|
||||
@@ -24,9 +25,7 @@ VkDevice vkDevice;
|
||||
PFN_vkGetInstanceProcAddr vkGIPA;
|
||||
PFN_vkGetDeviceProcAddr vkGDPA;
|
||||
|
||||
static inline ankerl::unordered_dense::map <unsigned int, std::unique_ptr<IFeature_Vk>> VkContexts;
|
||||
static inline NVSDK_NGX_Parameter* createParams = nullptr;
|
||||
static inline int changeBackendCounter = 0;
|
||||
static ankerl::unordered_dense::map<unsigned int, ContextData<IFeature_Vk>> VkContexts;
|
||||
static inline int evalCounter = 0;
|
||||
static inline bool shutdown = false;
|
||||
|
||||
@@ -536,15 +535,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice
|
||||
|
||||
if (upscalerChoice == 2)
|
||||
{
|
||||
VkContexts[handleId] = std::make_unique<DLSSFeatureVk>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<DLSSFeatureVk>(handleId, InParameters);
|
||||
|
||||
if (!VkContexts[handleId]->ModuleLoaded())
|
||||
if (!VkContexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new DLSS feature, fallback to XeSS!");
|
||||
|
||||
VkContexts[handleId].reset();
|
||||
auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
VkContexts.erase(it);
|
||||
VkContexts[handleId].feature.reset();
|
||||
VkContexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//VkContexts.erase(it);
|
||||
|
||||
upscalerChoice = 0;
|
||||
}
|
||||
@@ -557,15 +557,16 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice
|
||||
|
||||
if (upscalerChoice == 3)
|
||||
{
|
||||
VkContexts[handleId] = std::make_unique<FSR31FeatureVk>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR31FeatureVk>(handleId, InParameters);
|
||||
|
||||
if (!VkContexts[handleId]->ModuleLoaded())
|
||||
if (!VkContexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("can't create new FSR 3.X feature, Fallback to FSR2.1!");
|
||||
|
||||
VkContexts[handleId].reset();
|
||||
auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
VkContexts.erase(it);
|
||||
VkContexts[handleId].feature.reset();
|
||||
VkContexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//VkContexts.erase(it);
|
||||
|
||||
upscalerChoice = 0;
|
||||
}
|
||||
@@ -580,13 +581,13 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "fsr21";
|
||||
LOG_INFO("creating new FSR 2.1.2 feature");
|
||||
VkContexts[handleId] = std::make_unique<FSR2FeatureVk212>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR2FeatureVk212>(handleId, InParameters);
|
||||
}
|
||||
else if (upscalerChoice == 1)
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "fsr22";
|
||||
LOG_INFO("creating new FSR 2.2.1 feature");
|
||||
VkContexts[handleId] = std::make_unique<FSR2FeatureVk>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR2FeatureVk>(handleId, InParameters);
|
||||
}
|
||||
|
||||
// write back finel selected upscaler
|
||||
@@ -595,10 +596,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice
|
||||
else
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
VkContexts[handleId] = std::make_unique<DLSSDFeatureVk>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<DLSSDFeatureVk>(handleId, InParameters);
|
||||
}
|
||||
|
||||
auto deviceContext = VkContexts[handleId].get();
|
||||
auto deviceContext = VkContexts[handleId].feature.get();
|
||||
*OutHandle = deviceContext->Handle();
|
||||
|
||||
State::Instance().AutoExposure.reset();
|
||||
@@ -671,7 +672,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
if (!shutdown)
|
||||
LOG_INFO("releasing feature with id {0}", handleId);
|
||||
|
||||
if (auto deviceContext = VkContexts[handleId].get(); deviceContext)
|
||||
if (auto deviceContext = VkContexts[handleId].feature.get(); deviceContext)
|
||||
{
|
||||
if (deviceContext == State::Instance().currentFeature)
|
||||
{
|
||||
@@ -682,7 +683,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
vkDeviceWaitIdle(vkDevice);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
VkContexts[handleId].reset();
|
||||
VkContexts[handleId].feature.reset();
|
||||
auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
VkContexts.erase(it);
|
||||
}
|
||||
@@ -711,7 +712,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
}
|
||||
|
||||
auto handleId = InFeatureHandle->Id;
|
||||
if (VkContexts[handleId] == nullptr) // prevent source api name flicker when dlssg is active
|
||||
if (VkContexts[handleId].feature == nullptr) // prevent source api name flicker when dlssg is active
|
||||
State::Instance().setInputApiName = State::Instance().currentInputApiName;
|
||||
|
||||
if (State::Instance().setInputApiName.length() == 0)
|
||||
@@ -813,44 +814,45 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
|
||||
IFeature_Vk* deviceContext = nullptr;
|
||||
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[handleId])
|
||||
{
|
||||
if (State::Instance().newBackend == "" || (!Config::Instance()->DLSSEnabled.value_or_default() && State::Instance().newBackend == "dlss"))
|
||||
State::Instance().newBackend = Config::Instance()->VulkanUpscaler.value_or_default();
|
||||
|
||||
changeBackendCounter++;
|
||||
VkContexts[handleId].changeBackendCounter++;
|
||||
|
||||
LOG_INFO("changeBackend is true, counter: {0}", changeBackendCounter);
|
||||
LOG_INFO("changeBackend is true, counter: {0}", VkContexts[handleId].changeBackendCounter);
|
||||
|
||||
// first release everything
|
||||
if (changeBackendCounter == 1)
|
||||
if (VkContexts[handleId].changeBackendCounter == 1)
|
||||
{
|
||||
if (VkContexts.contains(handleId))
|
||||
if (VkContexts.contains(handleId) && VkContexts[handleId].feature != nullptr)
|
||||
{
|
||||
LOG_INFO("changing backend to {0}", State::Instance().newBackend);
|
||||
|
||||
auto dc = VkContexts[handleId].get();
|
||||
auto dc = VkContexts[handleId].feature.get();
|
||||
|
||||
if (State::Instance().newBackend != "dlssd" && State::Instance().newBackend != "dlss")
|
||||
createParams = GetNGXParameters("OptiVk");
|
||||
VkContexts[handleId].createParams = GetNGXParameters("OptiVk");
|
||||
else
|
||||
createParams = InParameters;
|
||||
VkContexts[handleId].createParams = InParameters;
|
||||
|
||||
createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, dc->GetFeatureFlags());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Width, dc->RenderWidth());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_Height, dc->RenderHeight());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutWidth, dc->DisplayWidth());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_OutHeight, dc->DisplayHeight());
|
||||
VkContexts[handleId].createParams->Set(NVSDK_NGX_Parameter_PerfQualityValue, dc->PerfQualityValue());
|
||||
|
||||
dc = nullptr;
|
||||
|
||||
LOG_DEBUG("sleeping before reset of current feature for 1000ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
|
||||
VkContexts[handleId].reset();
|
||||
auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
VkContexts.erase(it);
|
||||
VkContexts[handleId].feature.reset();
|
||||
VkContexts[handleId].feature = nullptr;
|
||||
//auto it = std::find_if(VkContexts.begin(), VkContexts.end(), [&handleId](const auto& p) { return p.first == handleId; });
|
||||
//VkContexts.erase(it);
|
||||
|
||||
State::Instance().currentFeature = nullptr;
|
||||
}
|
||||
@@ -859,21 +861,21 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
LOG_ERROR("can't find handle {0} in VkContexts!", handleId);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
|
||||
if (createParams != nullptr)
|
||||
if (VkContexts[handleId].createParams != nullptr)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(VkContexts[handleId].createParams);
|
||||
VkContexts[handleId].createParams = nullptr;
|
||||
}
|
||||
|
||||
changeBackendCounter = 0;
|
||||
VkContexts[handleId].changeBackendCounter = 0;
|
||||
}
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
if (changeBackendCounter == 2)
|
||||
if (VkContexts[handleId].changeBackendCounter == 2)
|
||||
{
|
||||
// backend selection
|
||||
// 0 : FSR2.1
|
||||
@@ -887,33 +889,33 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "fsr22";
|
||||
LOG_INFO("creating new FSR 2.2.1 feature");
|
||||
VkContexts[handleId] = std::make_unique<FSR2FeatureVk>(handleId, createParams);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR2FeatureVk>(handleId, VkContexts[handleId].createParams);
|
||||
upscalerChoice = 1;
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlss")
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "dlss";
|
||||
LOG_INFO("creating new DLSS feature");
|
||||
VkContexts[handleId] = std::make_unique<DLSSFeatureVk>(handleId, createParams);
|
||||
VkContexts[handleId].feature = std::make_unique<DLSSFeatureVk>(handleId, VkContexts[handleId].createParams);
|
||||
upscalerChoice = 2;
|
||||
}
|
||||
else if (State::Instance().newBackend == "fsr31")
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "fsr31";
|
||||
LOG_INFO("creating new FSR 3.X feature");
|
||||
VkContexts[handleId] = std::make_unique<FSR31FeatureVk>(handleId, createParams);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR31FeatureVk>(handleId, VkContexts[handleId].createParams);
|
||||
upscalerChoice = 3;
|
||||
}
|
||||
else if (State::Instance().newBackend == "dlssd")
|
||||
{
|
||||
LOG_INFO("creating new DLSSD feature");
|
||||
VkContexts[handleId] = std::make_unique<DLSSDFeatureVk>(handleId, InParameters);
|
||||
VkContexts[handleId].feature = std::make_unique<DLSSDFeatureVk>(handleId, InParameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::Instance()->VulkanUpscaler = "fsr21";
|
||||
LOG_INFO("creating new FSR 2.1.2 feature");
|
||||
VkContexts[handleId] = std::make_unique<FSR2FeatureVk212>(handleId, createParams);
|
||||
VkContexts[handleId].feature = std::make_unique<FSR2FeatureVk212>(handleId, VkContexts[handleId].createParams);
|
||||
upscalerChoice = 0;
|
||||
}
|
||||
|
||||
@@ -923,26 +925,26 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
if (changeBackendCounter == 3)
|
||||
if (VkContexts[handleId].changeBackendCounter == 3)
|
||||
{
|
||||
// next frame create context
|
||||
auto initResult = VkContexts[handleId]->Init(vkInstance, vkPD, vkDevice, InCmdList, vkGIPA, vkGDPA, createParams);
|
||||
auto initResult = VkContexts[handleId].feature->Init(vkInstance, vkPD, vkDevice, InCmdList, vkGIPA, vkGDPA, VkContexts[handleId].createParams);
|
||||
|
||||
changeBackendCounter = 0;
|
||||
VkContexts[handleId].changeBackendCounter = 0;
|
||||
|
||||
if (!initResult || !VkContexts[handleId]->ModuleLoaded())
|
||||
if (!initResult || !VkContexts[handleId].feature->ModuleLoaded())
|
||||
{
|
||||
LOG_ERROR("init failed with {0} feature", State::Instance().newBackend);
|
||||
|
||||
if (State::Instance().newBackend != "dlssd")
|
||||
{
|
||||
State::Instance().newBackend = "fsr21";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
}
|
||||
@@ -951,32 +953,32 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer
|
||||
LOG_INFO("init successful for {0}, upscaler changed", State::Instance().newBackend);
|
||||
|
||||
State::Instance().newBackend = "";
|
||||
State::Instance().changeBackend = false;
|
||||
State::Instance().changeBackend[handleId] = false;
|
||||
evalCounter = 0;
|
||||
}
|
||||
|
||||
// if opti nvparam release it
|
||||
int optiParam = 0;
|
||||
if (createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
if (VkContexts[handleId].createParams->Get("OptiScaler", &optiParam) == NVSDK_NGX_Result_Success && optiParam == 1)
|
||||
{
|
||||
free(createParams);
|
||||
createParams = nullptr;
|
||||
free(VkContexts[handleId].createParams);
|
||||
VkContexts[handleId].createParams = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// if initial feature can't be inited
|
||||
State::Instance().currentFeature = VkContexts[handleId].get();
|
||||
State::Instance().currentFeature = VkContexts[handleId].feature.get();
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
deviceContext = VkContexts[handleId].get();
|
||||
deviceContext = VkContexts[handleId].feature.get();
|
||||
State::Instance().currentFeature = deviceContext;
|
||||
|
||||
if (!deviceContext->IsInited() && Config::Instance()->VulkanUpscaler.value_or_default() != "fsr21")
|
||||
{
|
||||
State::Instance().newBackend = "fsr21";
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[handleId] = true;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
@@ -998,8 +1000,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_Shutdown(void)
|
||||
{
|
||||
shutdown = true;
|
||||
|
||||
for (auto const& [key, val] : VkContexts)
|
||||
NVSDK_NGX_VULKAN_ReleaseFeature(val->Handle());
|
||||
for (auto const& [key, val] : VkContexts) {
|
||||
if (val.feature)
|
||||
NVSDK_NGX_VULKAN_ReleaseFeature(val.feature->Handle());
|
||||
}
|
||||
|
||||
VkContexts.clear();
|
||||
|
||||
|
||||
@@ -1294,7 +1294,8 @@ bool MenuCommon::RenderMenu()
|
||||
Config::Instance()->DlssReactiveMaskBias.reset();
|
||||
}
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine(0.0f, 6.0f);
|
||||
@@ -1830,7 +1831,8 @@ bool MenuCommon::RenderMenu()
|
||||
{
|
||||
Config::Instance()->NetworkModel = n;
|
||||
State::Instance().newBackend = currentBackend;
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1890,7 +1892,8 @@ bool MenuCommon::RenderMenu()
|
||||
{
|
||||
Config::Instance()->Fsr3xIndex = _fsr3xIndex;
|
||||
State::Instance().newBackend = currentBackend;
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
|
||||
if (currentFeature->Version().patch > 0)
|
||||
@@ -2056,7 +2059,8 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
@@ -2373,7 +2377,8 @@ bool MenuCommon::RenderMenu()
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -2384,7 +2389,7 @@ bool MenuCommon::RenderMenu()
|
||||
if (currentFeature != nullptr)
|
||||
{
|
||||
ImGui::Text("Output Scaling is %s, target res: %dx%d", Config::Instance()->OutputScalingEnabled.value_or_default() ? "ENABLED" : "DISABLED",
|
||||
(uint32_t)(currentFeature->DisplayWidth() * _ssRatio), (uint32_t)(currentFeature->DisplayHeight() * _ssRatio));
|
||||
(uint32_t)(currentFeature->DisplayWidth() * _ssRatio), (uint32_t)(currentFeature->DisplayHeight() * _ssRatio));
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
@@ -2406,11 +2411,12 @@ bool MenuCommon::RenderMenu()
|
||||
if (currentBackend == "dlss" && State::Instance().currentFeature->Version().major < 3)
|
||||
{
|
||||
State::Instance().newBackend = currentBackend;
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
}
|
||||
ShowHelpMarker("Ignores the value sent by the game\n"
|
||||
"and uses the value set below");
|
||||
"and uses the value set below");
|
||||
|
||||
ImGui::BeginDisabled(!Config::Instance()->OverrideSharpness.value_or_default());
|
||||
|
||||
@@ -2429,9 +2435,9 @@ bool MenuCommon::RenderMenu()
|
||||
if (bool upOverride = Config::Instance()->UpscaleRatioOverrideEnabled.value_or_default(); ImGui::Checkbox("Ratio Override", &upOverride))
|
||||
Config::Instance()->UpscaleRatioOverrideEnabled = upOverride;
|
||||
ShowHelpMarker("Let's you override every upscaler preset\n"
|
||||
"with a value set below\n\n"
|
||||
"1.5x on a 1080p screen means internal resolution of 720p\n"
|
||||
"1080 / 1.5 = 720");
|
||||
"with a value set below\n\n"
|
||||
"1.5x on a 1080p screen means internal resolution of 720p\n"
|
||||
"1080 / 1.5 = 720");
|
||||
|
||||
ImGui::BeginDisabled(!Config::Instance()->UpscaleRatioOverrideEnabled.value_or_default());
|
||||
|
||||
@@ -2447,9 +2453,9 @@ bool MenuCommon::RenderMenu()
|
||||
if (bool qOverride = Config::Instance()->QualityRatioOverrideEnabled.value_or_default(); ImGui::Checkbox("Quality Override", &qOverride))
|
||||
Config::Instance()->QualityRatioOverrideEnabled = qOverride;
|
||||
ShowHelpMarker("Let's you override each preset's ratio individually\n"
|
||||
"Note that not every game supports every quality preset\n\n"
|
||||
"1.5x on a 1080p screen means internal resolution of 720p\n"
|
||||
"1080 / 1.5 = 720");
|
||||
"Note that not every game supports every quality preset\n\n"
|
||||
"1.5x on a 1080p screen means internal resolution of 720p\n"
|
||||
"1080 / 1.5 = 720");
|
||||
|
||||
ImGui::BeginDisabled(!Config::Instance()->QualityRatioOverrideEnabled.value_or_default());
|
||||
|
||||
@@ -2510,10 +2516,11 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ShowHelpMarker("Some Unreal Engine games need this\n"
|
||||
"Might fix colors, especially in dark areas");
|
||||
"Might fix colors, especially in dark areas");
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (bool hdr = Config::Instance()->HDR.value_or(false); ImGui::Checkbox("HDR", &hdr))
|
||||
@@ -2525,7 +2532,8 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ShowHelpMarker("Might help with purple hue in some games");
|
||||
|
||||
@@ -2548,7 +2556,8 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ShowHelpMarker("You shouldn't need to change it");
|
||||
|
||||
@@ -2562,7 +2571,8 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ShowHelpMarker("Fix for games that send motion data with preapplied jitter");
|
||||
|
||||
@@ -2582,10 +2592,11 @@ bool MenuCommon::RenderMenu()
|
||||
else
|
||||
State::Instance().newBackend = currentBackend;
|
||||
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
ShowHelpMarker("Mostly a fix for Unreal Engine games\n"
|
||||
"Top left part of the screen will be blurry");
|
||||
"Top left part of the screen will be blurry");
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto accessToReactiveMask = State::Instance().currentFeature->AccessToReactiveMask();
|
||||
@@ -2599,7 +2610,8 @@ bool MenuCommon::RenderMenu()
|
||||
if (currentBackend == "xess")
|
||||
{
|
||||
State::Instance().newBackend = currentBackend;
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2607,8 +2619,8 @@ bool MenuCommon::RenderMenu()
|
||||
|
||||
if (accessToReactiveMask)
|
||||
ShowHelpMarker("Allows the use of a reactive mask\n"
|
||||
"Keep in mind that a reactive mask sent to DLSS\n"
|
||||
"will not produce a good image in combination with FSR/XeSS");
|
||||
"Keep in mind that a reactive mask sent to DLSS\n"
|
||||
"will not produce a good image in combination with FSR/XeSS");
|
||||
else
|
||||
ShowHelpMarker("Option disabled because tha game doesn't provide a reactive mask");
|
||||
|
||||
@@ -2695,8 +2707,8 @@ bool MenuCommon::RenderMenu()
|
||||
Config::Instance()->ExtendedLimits = extendedLimits;
|
||||
|
||||
ShowHelpMarker("Extended sliders limit for quality presets\n\n"
|
||||
"Using this option changes resolution detection logic\n"
|
||||
"and might cause issues and crashes!");
|
||||
"Using this option changes resolution detection logic\n"
|
||||
"and might cause issues and crashes!");
|
||||
}
|
||||
|
||||
bool pcShaders = Config::Instance()->UsePrecompiledShaders.value_or_default();
|
||||
@@ -2704,7 +2716,8 @@ bool MenuCommon::RenderMenu()
|
||||
{
|
||||
Config::Instance()->UsePrecompiledShaders = pcShaders;
|
||||
State::Instance().newBackend = currentBackend;
|
||||
State::Instance().changeBackend = true;
|
||||
for (auto& singleChangeBackend : State::Instance().changeBackend)
|
||||
singleChangeBackend.second = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ bool IFeature_Dx11wDx12::ProcessDx11Textures(const NVSDK_NGX_Parameter* InParame
|
||||
{
|
||||
LOG_WARN("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ bool IFeature_Dx11wDx12::ProcessDx11Textures(const NVSDK_NGX_Parameter* InParame
|
||||
{
|
||||
LOG_WARN("bias mask not exist and it's enabled in config, it may cause problems!!");
|
||||
Config::Instance()->DisableReactiveMask.set_volatile_value(true);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -221,7 +221,7 @@ bool DLSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_NGX_P
|
||||
if (!OutputScaler->Dispatch(Device, InDeviceContext, OutputScaler->Buffer(), (ID3D11Texture2D*)paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ bool DLSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ bool DLSSDFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_NGX_
|
||||
if (!OutputScaler->Dispatch(Device, InDeviceContext, OutputScaler->Buffer(), (ID3D11Texture2D*)paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ bool DLSSDFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ bool FSR2FeatureDx11::Evaluate(ID3D11DeviceContext* InContext, NVSDK_NGX_Paramet
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, DisplayWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ bool FSR2FeatureDx11::Evaluate(ID3D11DeviceContext* InContext, NVSDK_NGX_Paramet
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -615,7 +615,7 @@ bool FSR2FeatureDx11::Evaluate(ID3D11DeviceContext* InContext, NVSDK_NGX_Paramet
|
||||
if (!OutputScaler->Dispatch(Device, InContext, OutputScaler->Buffer(), (ID3D11Texture2D*)paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N
|
||||
}
|
||||
|
||||
// AutoExposure is nullptr
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[Handle()->Id])
|
||||
{
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
@@ -384,7 +384,7 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N
|
||||
if (!OutputScaler->Dispatch(Dx12Device, Dx12CommandList, OutputScaler->Buffer(), dx11Out.Dx12Resource))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
|
||||
@@ -129,7 +129,7 @@ bool FSR2FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, TargetWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ bool FSR2FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +407,7 @@ bool FSR2FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ bool FSR2FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter* I
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ bool FSR2FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter* I
|
||||
{
|
||||
LOG_DEBUG("Bias mask not exist and its enabled in config, it may cause problems!!");
|
||||
Config::Instance()->DisableReactiveMask.set_volatile_value(true);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS
|
||||
}
|
||||
|
||||
// AutoExposure or ReactiveMask is nullptr
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[Handle()->Id])
|
||||
{
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
@@ -390,7 +390,7 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS
|
||||
if (!OutputScaler->Dispatch(Dx12Device, Dx12CommandList, OutputScaler->Buffer(), dx11Out.Dx12Resource))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
|
||||
@@ -130,7 +130,7 @@ bool FSR2FeatureDx12_212::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVS
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, TargetWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ bool FSR2FeatureDx12_212::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVS
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -410,7 +410,7 @@ bool FSR2FeatureDx12_212::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVS
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ bool FSR2FeatureVk212::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,7 @@ bool FSR2FeatureVk212::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter
|
||||
{
|
||||
LOG_DEBUG("Bias mask not exist and its enabled in config, it may cause problems!!");
|
||||
Config::Instance()->DisableReactiveMask.set_volatile_value(true);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ bool FSR31FeatureDx11::Evaluate(ID3D11DeviceContext* DeviceContext, NVSDK_NGX_Pa
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, DisplayWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ bool FSR31FeatureDx11::Evaluate(ID3D11DeviceContext* DeviceContext, NVSDK_NGX_Pa
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ bool FSR31FeatureDx11::Evaluate(ID3D11DeviceContext* DeviceContext, NVSDK_NGX_Pa
|
||||
if (!OutputScaler->Dispatch(Device, DeviceContext, OutputScaler->Buffer(), (ID3D11Texture2D*)paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_
|
||||
}
|
||||
|
||||
// AutoExposure or ReactiveMask is nullptr
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[Handle()->Id])
|
||||
{
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
@@ -426,7 +426,7 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_
|
||||
if (!OutputScaler->Dispatch(Dx12Device, Dx12CommandList, OutputScaler->Buffer(), dx11Out.Dx12Resource))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
|
||||
@@ -147,7 +147,7 @@ bool FSR31FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, TargetWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ bool FSR31FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ bool FSR31FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ bool FSR31FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter*
|
||||
{
|
||||
LOG_DEBUG("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ bool FSR31FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter*
|
||||
{
|
||||
LOG_DEBUG("Bias mask not exist and its enabled in config, it may cause problems!!");
|
||||
Config::Instance()->DisableReactiveMask.set_volatile_value(true);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_NGX_P
|
||||
LOG_DEBUG("ProcessDx11Textures complete!");
|
||||
|
||||
// AutoExposure or ReactiveMask is nullptr
|
||||
if (State::Instance().changeBackend)
|
||||
if (State::Instance().changeBackend[Handle()->Id])
|
||||
{
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
@@ -398,7 +398,7 @@ bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_NGX_P
|
||||
if (!OutputScaler->Dispatch(Dx12Device, Dx12CommandList, OutputScaler->Buffer(), dx11Out.Dx12Resource))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
|
||||
Dx12CommandList->Close();
|
||||
ID3D12CommandList* ppCommandLists[] = { Dx12CommandList };
|
||||
|
||||
@@ -137,7 +137,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
{
|
||||
LOG_WARN("MotionVectors MVWidth: {0}, DisplayWidth: {1}, Flag: {2} Disabling DisplaySizeMV!!", desc.Width, DisplayWidth(), displaySizeEnabled);
|
||||
State::Instance().DisplaySizeMV = false;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
{
|
||||
LOG_WARN("AutoExposure disabled but ExposureTexture is not exist, it may cause problems!!");
|
||||
State::Instance().AutoExposure = true;
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
{
|
||||
LOG_WARN("Bias mask not exist and its enabled in config, it may cause problems!!");
|
||||
Config::Instance()->DisableReactiveMask.set_volatile_value(true);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +363,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
|
||||
if (!OutputScaler->Dispatch(Device, InCommandList, OutputScaler->Buffer(), paramOutput))
|
||||
{
|
||||
Config::Instance()->OutputScalingEnabled.set_volatile_value(false);
|
||||
State::Instance().changeBackend = true;
|
||||
State::Instance().changeBackend[Handle()->Id] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user