Separate out DLSS from DLSSD + extra related (#205)

This commit is contained in:
Michał Lewandowski
2025-02-11 20:33:24 +03:00
committed by GitHub
parent 8852540e12
commit c1399c63b9
5 changed files with 101 additions and 116 deletions
+76 -17
View File
@@ -692,7 +692,7 @@ void MenuCommon::AddResourceBarrier(std::string name, CustomOptional<int32_t, B>
}
template <HasDefaultValue B>
void MenuCommon::AddRenderPreset(std::string name, CustomOptional<uint32_t, B>* value)
void MenuCommon::AddDLSSRenderPreset(std::string name, CustomOptional<uint32_t, B>* value)
{
const char* presets[] = { "DEFAULT", "PRESET A", "PRESET B", "PRESET C", "PRESET D", "PRESET E", "PRESET F", "PRESET G",
"PRESET H", "PRESET I", "PRESET J", "PRESET K", "PRESET L", "PRESET M", "PRESET N", "PRESET O",
@@ -728,6 +728,43 @@ void MenuCommon::AddRenderPreset(std::string name, CustomOptional<uint32_t, B>*
*value = 0x00FFFFFF;
}
template <HasDefaultValue B>
void MenuCommon::AddDLSSDRenderPreset(std::string name, CustomOptional<uint32_t, B>* value)
{
const char* presets[] = { "DEFAULT", "PRESET A", "PRESET B", "PRESET C", "PRESET D", "PRESET E", "PRESET F", "PRESET G",
"PRESET H", "PRESET I", "PRESET J", "PRESET K", "PRESET L", "PRESET M", "PRESET N", "PRESET O",
"Latest" };
const std::string presetsDesc[] = { "Whatever the game uses",
"CNN 1",
"CNN 2",
"CNN 3",
"Transformers",
"Transformers 2",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Latest supported by the dll"
};
if (value->value_or_default() == 0x00FFFFFF)
*value = 16;
PopulateCombo(name, value, presets, presetsDesc, std::size(presets));
// Value for latest preset
if (value->value_or_default() == 16)
*value = 0x00FFFFFF;
}
template <HasDefaultValue B>
void MenuCommon::PopulateCombo(std::string name, CustomOptional<uint32_t, B>* value, const char* names[], const std::string desc[], int length, const uint8_t disabledMask[], bool firstAsDefault) {
int selected = value->value_or(0);
@@ -1959,16 +1996,21 @@ bool MenuCommon::RenderMenu()
if ((Config::Instance()->DLSSEnabled.value_or_default() && currentBackend == "dlss" && State::Instance().currentFeature->Version().major > 2) ||
State::Instance().currentFeature->Name() == "DLSSD")
{
ImGui::SeparatorText("DLSS Settings");
const bool usesDlssd = State::Instance().currentFeature->Name() == "DLSSD";
auto overridden = (State::Instance().dlssPresetsOverriddenExternally && currentBackend == "dlss") || (State::Instance().dlssdPresetsOverriddenExternally && State::Instance().currentFeature->Name() == "DLSSD");
if (usesDlssd)
ImGui::SeparatorText("DLSSD Settings");
else
ImGui::SeparatorText("DLSS Settings");
auto overridden = usesDlssd ? State::Instance().dlssdPresetsOverriddenExternally : State::Instance().dlssPresetsOverriddenExternally;
if (overridden) {
ImGui::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Presets are overridden externally");
ShowHelpMarker("This usually happens due to using tools\n"
"such as Nvidia App or Nvidia Inspector");
"such as Nvidia App or Nvidia Inspector");
ImGui::Text("Selecting setting below will disable that external override\n"
"but you need to Save INI and restart the game");
"but you need to Save INI and restart the game");
ImGui::Spacing();
}
@@ -1976,19 +2018,23 @@ bool MenuCommon::RenderMenu()
if (bool pOverride = Config::Instance()->RenderPresetOverride.value_or_default(); ImGui::Checkbox("Render Presets Override", &pOverride))
Config::Instance()->RenderPresetOverride = pOverride;
ShowHelpMarker("Each render preset has it strengths and weaknesses\n"
"Override to potentially improve image quality");
"Override to potentially improve image quality");
ImGui::BeginDisabled(!Config::Instance()->RenderPresetOverride.value_or_default() || overridden);
ImGui::PushItemWidth(135.0 * Config::Instance()->MenuScale.value_or_default());
AddRenderPreset("Override Preset", &Config::Instance()->RenderPresetForAll);
if (usesDlssd)
AddDLSSDRenderPreset("Override Preset", &Config::Instance()->RenderPresetForAll);
else
AddDLSSRenderPreset("Override Preset", &Config::Instance()->RenderPresetForAll);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, 6.0f);
if (ImGui::Button("Apply Changes"))
{
if (State::Instance().currentFeature->Name() == "DLSSD")
if (usesDlssd)
State::Instance().newBackend = "dlssd";
else
State::Instance().newBackend = currentBackend;
@@ -2000,7 +2046,7 @@ bool MenuCommon::RenderMenu()
ImGui::Spacing();
if (ImGui::CollapsingHeader("Advanced DLSS Settings"))
if (ImGui::CollapsingHeader(usesDlssd ? "Advanced DLSSD Settings" : "Advanced DLSS Settings"))
{
ImGui::Spacing();
bool appIdOverride = Config::Instance()->UseGenericAppIdWithDlss.value_or_default();
@@ -2008,18 +2054,31 @@ bool MenuCommon::RenderMenu()
Config::Instance()->UseGenericAppIdWithDlss = appIdOverride;
ShowHelpMarker("Use generic appid with NGX\n"
"Fixes OptiScaler preset override not working with certain games\n"
"Requires a game restart.");
"Fixes OptiScaler preset override not working with certain games\n"
"Requires a game restart.");
ImGui::BeginDisabled(!Config::Instance()->RenderPresetOverride.value_or_default() || overridden);
ImGui::Spacing();
ImGui::PushItemWidth(135.0 * Config::Instance()->MenuScale.value_or_default());
AddRenderPreset("DLAA Preset", &Config::Instance()->RenderPresetDLAA);
AddRenderPreset("UltraQ Preset", &Config::Instance()->RenderPresetUltraQuality);
AddRenderPreset("Quality Preset", &Config::Instance()->RenderPresetQuality);
AddRenderPreset("Balanced Preset", &Config::Instance()->RenderPresetBalanced);
AddRenderPreset("Perf Preset", &Config::Instance()->RenderPresetPerformance);
AddRenderPreset("UltraP Preset", &Config::Instance()->RenderPresetUltraPerformance);
if (usesDlssd)
{
AddDLSSDRenderPreset("DLAA Preset", &Config::Instance()->RenderPresetDLAA);
AddDLSSDRenderPreset("UltraQ Preset", &Config::Instance()->RenderPresetUltraQuality);
AddDLSSDRenderPreset("Quality Preset", &Config::Instance()->RenderPresetQuality);
AddDLSSDRenderPreset("Balanced Preset", &Config::Instance()->RenderPresetBalanced);
AddDLSSDRenderPreset("Perf Preset", &Config::Instance()->RenderPresetPerformance);
AddDLSSDRenderPreset("UltraP Preset", &Config::Instance()->RenderPresetUltraPerformance);
}
else
{
AddDLSSRenderPreset("DLAA Preset", &Config::Instance()->RenderPresetDLAA);
AddDLSSRenderPreset("UltraQ Preset", &Config::Instance()->RenderPresetUltraQuality);
AddDLSSRenderPreset("Quality Preset", &Config::Instance()->RenderPresetQuality);
AddDLSSRenderPreset("Balanced Preset", &Config::Instance()->RenderPresetBalanced);
AddDLSSRenderPreset("Perf Preset", &Config::Instance()->RenderPresetPerformance);
AddDLSSRenderPreset("UltraP Preset", &Config::Instance()->RenderPresetUltraPerformance);
}
ImGui::PopItemWidth();
ImGui::EndDisabled();
}
+3 -1
View File
@@ -120,7 +120,9 @@ private:
template <HasDefaultValue B>
static void AddResourceBarrier(std::string name, CustomOptional<int32_t, B>* value);
template <HasDefaultValue B>
static void AddRenderPreset(std::string name, CustomOptional<uint32_t, B>* value);
static void AddDLSSRenderPreset(std::string name, CustomOptional<uint32_t, B>* value);
template<HasDefaultValue B>
static void AddDLSSDRenderPreset(std::string name, CustomOptional<uint32_t, B>* value);
template <HasDefaultValue B>
static void PopulateCombo(std::string name, CustomOptional<uint32_t, B>* value, const char* names[], const std::string desc[], int length, const uint8_t disabledMask[] = nullptr, bool firstAsDefault = true);
+12 -50
View File
@@ -188,23 +188,12 @@ void DLSSFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
uint32_t RenderPresetPerformance = 0;
uint32_t RenderPresetUltraPerformance = 0;
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, &RenderPresetDLAA) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.DLAA", &RenderPresetDLAA);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, &RenderPresetUltraQuality) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraQuality", &RenderPresetUltraQuality);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, &RenderPresetQuality) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Quality", &RenderPresetQuality);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, &RenderPresetBalanced) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Balanced", &RenderPresetBalanced);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, &RenderPresetPerformance) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Performance", &RenderPresetPerformance);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, &RenderPresetUltraPerformance) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraPerformance", &RenderPresetUltraPerformance);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, &RenderPresetDLAA);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, &RenderPresetUltraQuality);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, &RenderPresetQuality);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, &RenderPresetBalanced);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, &RenderPresetPerformance);
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, &RenderPresetUltraPerformance);
if (Config::Instance()->RenderPresetOverride.value_or_default())
{
@@ -224,36 +213,12 @@ void DLSSFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
LOG_DEBUG("Preset_UltraPerformance {}", RenderPresetUltraPerformance);
}
if (RenderPresetDLAA < 0 || RenderPresetDLAA > 15)
RenderPresetDLAA = 0;
if (RenderPresetUltraQuality < 0 || RenderPresetUltraQuality > 15)
RenderPresetUltraQuality = 0;
if (RenderPresetQuality < 0 || RenderPresetQuality > 15)
RenderPresetQuality = 0;
if (RenderPresetBalanced < 0 || RenderPresetBalanced > 15)
RenderPresetBalanced = 0;
if (RenderPresetPerformance < 0 || RenderPresetPerformance > 15)
RenderPresetPerformance = 0;
if (RenderPresetUltraPerformance < 0 || RenderPresetUltraPerformance > 15)
RenderPresetUltraPerformance = 0;
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, RenderPresetDLAA);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, RenderPresetUltraQuality);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, RenderPresetQuality);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, RenderPresetBalanced);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, RenderPresetPerformance);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, RenderPresetUltraPerformance);
InParameters->Set("RayReconstruction.Hint.Render.Preset.DLAA", RenderPresetDLAA);
InParameters->Set("RayReconstruction.Hint.Render.Preset.UltraQuality", RenderPresetUltraQuality);
InParameters->Set("RayReconstruction.Hint.Render.Preset.Quality", RenderPresetQuality);
InParameters->Set("RayReconstruction.Hint.Render.Preset.Balanced", RenderPresetBalanced);
InParameters->Set("RayReconstruction.Hint.Render.Preset.Performance", RenderPresetPerformance);
InParameters->Set("RayReconstruction.Hint.Render.Preset.UltraPerformance", RenderPresetUltraPerformance);
}
UINT perfQ = NVSDK_NGX_PerfQuality_Value_Balanced;
@@ -272,11 +237,10 @@ void DLSSFeature::ReadVersion()
PFN_NVSDK_NGX_GetSnippetVersion _GetSnippetVersion = nullptr;
if (!Config::Instance()->NVNGX_DLSS_Library.has_value())
{
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction("nvngx_dlss.dll", "NVSDK_NGX_GetSnippetVersion");
}
else
if (!State::Instance().NGX_OTA_Dlss.empty())
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction(State::Instance().NGX_OTA_Dlss.c_str(), "NVSDK_NGX_GetSnippetVersion");
if (!_GetSnippetVersion && Config::Instance()->NVNGX_DLSS_Library.has_value())
{
std::filesystem::path dlssPath(Config::Instance()->NVNGX_DLSS_Library.value());
@@ -284,10 +248,8 @@ void DLSSFeature::ReadVersion()
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction(dlssPath.filename().string().c_str(), "NVSDK_NGX_GetSnippetVersion");
}
if (_GetSnippetVersion == nullptr && !State::Instance().NGX_OTA_Dlss.empty())
{
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction(State::Instance().NGX_OTA_Dlss.c_str(), "NVSDK_NGX_GetSnippetVersion");
}
if (!_GetSnippetVersion)
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction("nvngx_dlss.dll", "NVSDK_NGX_GetSnippetVersion");
if (_GetSnippetVersion != nullptr)
{
@@ -286,5 +286,3 @@ DLSSFeatureDx12::~DLSSFeatureDx12()
if (RCAS != nullptr && RCAS.get() != nullptr)
RCAS.reset();
}
+10 -46
View File
@@ -179,23 +179,12 @@ void DLSSDFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
uint32_t RenderPresetPerformance = 0;
uint32_t RenderPresetUltraPerformance = 0;
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, &RenderPresetDLAA) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.DLAA", &RenderPresetDLAA);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, &RenderPresetUltraQuality) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraQuality", &RenderPresetUltraQuality);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, &RenderPresetQuality) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Quality", &RenderPresetQuality);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, &RenderPresetBalanced) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Balanced", &RenderPresetBalanced);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, &RenderPresetPerformance) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.Performance", &RenderPresetPerformance);
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, &RenderPresetUltraPerformance) != NVSDK_NGX_Result_Success)
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraPerformance", &RenderPresetUltraPerformance);
InParameters->Get("RayReconstruction.Hint.Render.Preset.DLAA", &RenderPresetDLAA);
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraQuality", &RenderPresetUltraQuality);
InParameters->Get("RayReconstruction.Hint.Render.Preset.Quality", &RenderPresetQuality);
InParameters->Get("RayReconstruction.Hint.Render.Preset.Balanced", &RenderPresetBalanced);
InParameters->Get("RayReconstruction.Hint.Render.Preset.Performance", &RenderPresetPerformance);
InParameters->Get("RayReconstruction.Hint.Render.Preset.UltraPerformance", &RenderPresetUltraPerformance);
if (Config::Instance()->RenderPresetOverride.value_or_default())
{
@@ -215,30 +204,6 @@ void DLSSDFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
LOG_DEBUG("Preset_UltraPerformance {}", RenderPresetUltraPerformance);
}
if (RenderPresetDLAA < 0 || RenderPresetDLAA > 15)
RenderPresetDLAA = 0;
if (RenderPresetUltraQuality < 0 || RenderPresetUltraQuality > 15)
RenderPresetUltraQuality = 0;
if (RenderPresetQuality < 0 || RenderPresetQuality > 15)
RenderPresetQuality = 0;
if (RenderPresetBalanced < 0 || RenderPresetBalanced > 15)
RenderPresetBalanced = 0;
if (RenderPresetPerformance < 0 || RenderPresetPerformance > 15)
RenderPresetPerformance = 0;
if (RenderPresetUltraPerformance < 0 || RenderPresetUltraPerformance > 15)
RenderPresetUltraPerformance = 0;
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, RenderPresetDLAA);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, RenderPresetUltraQuality);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, RenderPresetQuality);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, RenderPresetBalanced);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, RenderPresetPerformance);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, RenderPresetUltraPerformance);
InParameters->Set("RayReconstruction.Hint.Render.Preset.DLAA", RenderPresetDLAA);
InParameters->Set("RayReconstruction.Hint.Render.Preset.UltraQuality", RenderPresetUltraQuality);
InParameters->Set("RayReconstruction.Hint.Render.Preset.Quality", RenderPresetQuality);
@@ -272,12 +237,11 @@ void DLSSDFeature::ReadVersion()
{
PFN_NVSDK_NGX_GetSnippetVersion _GetSnippetVersion = nullptr;
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction("nvngx_dlssd.dll", "NVSDK_NGX_GetSnippetVersion");
if (_GetSnippetVersion == nullptr && !State::Instance().NGX_OTA_Dlssd.empty())
{
if (!State::Instance().NGX_OTA_Dlssd.empty())
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction(State::Instance().NGX_OTA_Dlssd.c_str(), "NVSDK_NGX_GetSnippetVersion");
}
if (!_GetSnippetVersion)
_GetSnippetVersion = (PFN_NVSDK_NGX_GetSnippetVersion)DetourFindFunction("nvngx_dlssd.dll", "NVSDK_NGX_GetSnippetVersion");
if (_GetSnippetVersion != nullptr)
{