dlss preset stuff

This commit is contained in:
cdozdil
2024-08-04 22:39:44 +03:00
parent db24fb4dda
commit 7eeffd962c
6 changed files with 57 additions and 20 deletions
+31
View File
@@ -18,6 +18,11 @@ static inline bool isInteger(const std::string& str, int& value) {
return (iss >> value) && iss.eof();
}
static inline bool isUInt(const std::string& str, uint32_t& value) {
std::istringstream iss(str);
return (iss >> value) && iss.eof();
}
static inline bool isFloat(const std::string& str, float& value) {
std::istringstream iss(str);
return (iss >> value) && iss.eof();
@@ -690,6 +695,32 @@ std::optional<int> Config::readInt(std::string section, std::string key)
}
}
std::optional<uint32_t> Config::readUInt(std::string section, std::string key)
{
auto value = readString(section, key);
try
{
uint32_t result;
if (value.has_value() && isUInt(value.value(), result))
return result;
return std::nullopt;
}
catch (const std::bad_optional_access&) // missing or auto value
{
return std::nullopt;
}
catch (const std::invalid_argument&) // invalid float string for std::stof
{
return std::nullopt;
}
catch (const std::out_of_range&) // out// out of range for 32 bit float
{
return std::nullopt;
}
}
std::optional<bool> Config::readBool(std::string section, std::string key)
{
auto value = readString(section, key, true);
+7 -6
View File
@@ -48,12 +48,12 @@ public:
std::optional<std::wstring> DLSSLibrary;
std::optional<std::wstring> NVNGX_DLSS_Library;
std::optional<bool> RenderPresetOverride;
std::optional<int> RenderPresetDLAA;
std::optional<int> RenderPresetUltraQuality;
std::optional<int> RenderPresetQuality;
std::optional<int> RenderPresetBalanced;
std::optional<int> RenderPresetPerformance;
std::optional<int> RenderPresetUltraPerformance;
std::optional<uint32_t> RenderPresetDLAA;
std::optional<uint32_t> RenderPresetUltraQuality;
std::optional<uint32_t> RenderPresetQuality;
std::optional<uint32_t> RenderPresetBalanced;
std::optional<uint32_t> RenderPresetPerformance;
std::optional<uint32_t> RenderPresetUltraPerformance;
// CAS
std::optional<bool> RcasEnabled;
@@ -222,5 +222,6 @@ private:
std::optional<std::string> readString(std::string section, std::string key, bool lowercase = false);
std::optional<float> readFloat(std::string section, std::string key);
std::optional<int> readInt(std::string section, std::string key);
std::optional<uint32_t> readUInt(std::string section, std::string key);
std::optional<bool> readBool(std::string section, std::string key);
};
+12 -6
View File
@@ -179,12 +179,12 @@ void DLSSFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
LOG_INFO("Render Size: {}x{}, Target Size: {}x{}, Display Size: {}x{}", RenderWidth(), RenderHeight(), TargetWidth(), TargetHeight(), DisplayWidth(), DisplayHeight());
unsigned int RenderPresetDLAA = 0;
unsigned int RenderPresetUltraQuality = 0;
unsigned int RenderPresetQuality = 0;
unsigned int RenderPresetBalanced = 0;
unsigned int RenderPresetPerformance = 0;
unsigned int RenderPresetUltraPerformance = 0;
uint32_t RenderPresetDLAA = 0;
uint32_t RenderPresetUltraQuality = 0;
uint32_t RenderPresetQuality = 0;
uint32_t RenderPresetBalanced = 0;
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);
@@ -253,6 +253,12 @@ void DLSSFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
LOG_DEBUG("Preset_Performance {}", RenderPresetPerformance);
InParameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, RenderPresetUltraPerformance);
LOG_DEBUG("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);
LOG_FUNC_RESULT(0);
}
@@ -10,7 +10,6 @@ private:
protected:
public:
bool Init(VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, VkCommandBuffer InCmdList, PFN_vkGetInstanceProcAddr InGIPA, PFN_vkGetDeviceProcAddr InGDPA, NVSDK_NGX_Parameter* InParameters) override;
bool Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter* InParameters) override;
+6 -6
View File
@@ -170,12 +170,12 @@ void DLSSDFeature::ProcessInitParams(NVSDK_NGX_Parameter* InParameters)
InParameters->Set(NVSDK_NGX_Parameter_OutWidth, TargetWidth());
InParameters->Set(NVSDK_NGX_Parameter_OutHeight, TargetHeight());
unsigned int RenderPresetDLAA = 0;
unsigned int RenderPresetUltraQuality = 0;
unsigned int RenderPresetQuality = 0;
unsigned int RenderPresetBalanced = 0;
unsigned int RenderPresetPerformance = 0;
unsigned int RenderPresetUltraPerformance = 0;
uint32_t RenderPresetDLAA = 0;
uint32_t RenderPresetUltraQuality = 0;
uint32_t RenderPresetQuality = 0;
uint32_t RenderPresetBalanced = 0;
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);
+1 -1
View File
@@ -761,7 +761,7 @@ public:
}
}
static void AddRenderPreset(std::string name, std::optional<int>* value)
static void AddRenderPreset(std::string name, std::optional<uint32_t>* value)
{
const char* presets[] = { "DEFAULT", "PRESET A", "PRESET B", "PRESET C", "PRESET D", "PRESET E", "PRESET F", "PRESET G" };
const char* presetsDesc[] = { "Whatever the game uses",