mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-05-06 01:30:44 +00:00
improved logging options
added scaling ratio
This commit is contained in:
+12
-11
@@ -28,22 +28,23 @@ void Config::Reload()
|
||||
if (LoggingEnabled.value_or(false))
|
||||
{
|
||||
LogLevel = readInt("Log", "LogLevel");
|
||||
|
||||
LogToConsole = readBool("Log", "LogToConsole");
|
||||
LogToFile = readBool("Log", "LogToFile");
|
||||
|
||||
if (!LogToConsole.value_or(false))
|
||||
OpenConsole = readBool("Log", "OpenConsole");
|
||||
|
||||
LogFileName = readString("Log", "LogFile");
|
||||
|
||||
if (!LogFileName.has_value())
|
||||
{
|
||||
LogFileName = readString("Log", "LogFile");
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
auto str = std::format("{:%d%m%Y_%H%M%OS}", now);
|
||||
|
||||
if (!LogFileName.has_value())
|
||||
{
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
auto str = std::format("{:%d%m%Y_%H%M%OS}", now);
|
||||
auto path = Util::DllPath().parent_path();
|
||||
auto logFile = path.string() + "/log_xess_" + str + ".log";
|
||||
|
||||
auto path = Util::DllPath().parent_path();
|
||||
auto logFile = path.string() + "/log_xess_" + str + ".log";
|
||||
|
||||
LogFileName = logFile;
|
||||
}
|
||||
LogFileName = logFile;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,7 +19,9 @@ public:
|
||||
|
||||
//Logging
|
||||
std::optional<bool> LoggingEnabled;
|
||||
std::optional<bool> LogToFile;
|
||||
std::optional<bool> LogToConsole;
|
||||
std::optional<bool> OpenConsole;
|
||||
std::optional<int> LogLevel;
|
||||
std::optional<std::string> LogFileName;
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
<IncludePath>$(SolutionDir)external\simpleini;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\vulkan\include;$(SolutionDir)external\ffx-sdk\sdk\include;$(SolutionDir)external\fmt\include;$(SolutionDir)external\spdlog\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)external\xess\lib;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>nvngx</TargetName>
|
||||
<OutDir>F:\Games\Deep Rock Galactic\FSD\Binaries\Win64\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)external\simpleini;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\vulkan\include;$(SolutionDir)external\ffx-sdk\sdk\include;$(SolutionDir)external\fmt\include;$(SolutionDir)external\spdlog\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
|
||||
|
||||
@@ -44,6 +44,7 @@ inline NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_DLSS_GetOptimalSettingsCallback(NVS
|
||||
unsigned int Height;
|
||||
unsigned int OutWidth;
|
||||
unsigned int OutHeight;
|
||||
float scalingRatio = 0.0f;
|
||||
int PerfQualityValue;
|
||||
|
||||
if (InParams->Get(NVSDK_NGX_Parameter_Width, &Width) != NVSDK_NGX_Result_Success)
|
||||
@@ -64,6 +65,7 @@ inline NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_DLSS_GetOptimalSettingsCallback(NVS
|
||||
if (QualityRatio.has_value()) {
|
||||
OutHeight = (unsigned int)((float)Height / QualityRatio.value());
|
||||
OutWidth = (unsigned int)((float)Width / QualityRatio.value());
|
||||
scalingRatio = 1.0f / QualityRatio.value();
|
||||
}
|
||||
else {
|
||||
spdlog::debug("NVSDK_NGX_DLSS_GetOptimalSettingsCallback Quality: {0}", PerfQualityValue);
|
||||
@@ -73,30 +75,37 @@ inline NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_DLSS_GetOptimalSettingsCallback(NVS
|
||||
case NVSDK_NGX_PerfQuality_Value_UltraPerformance:
|
||||
OutHeight = (unsigned int)((float)Height / 3.0);
|
||||
OutWidth = (unsigned int)((float)Width / 3.0);
|
||||
scalingRatio = 0.33333333f;
|
||||
break;
|
||||
case NVSDK_NGX_PerfQuality_Value_MaxPerf:
|
||||
OutHeight = (unsigned int)((float)Height / 2.0);
|
||||
OutWidth = (unsigned int)((float)Width / 2.0);
|
||||
scalingRatio = 0.5f;
|
||||
break;
|
||||
case NVSDK_NGX_PerfQuality_Value_Balanced:
|
||||
OutHeight = (unsigned int)((float)Height / 1.699115044247788);
|
||||
OutWidth = (unsigned int)((float)Width / 1.699115044247788);
|
||||
scalingRatio = 0.58854167f;
|
||||
break;
|
||||
case NVSDK_NGX_PerfQuality_Value_MaxQuality:
|
||||
OutHeight = (unsigned int)((float)Height / 1.5);
|
||||
OutWidth = (unsigned int)((float)Width / 1.5);
|
||||
scalingRatio = 0.66666667f;
|
||||
break;
|
||||
case NVSDK_NGX_PerfQuality_Value_UltraQuality:
|
||||
OutHeight = (unsigned int)((float)Height / 1.299932295192959);
|
||||
OutWidth = (unsigned int)((float)Width / 1.299932295192959);
|
||||
scalingRatio = 0.76927083f;
|
||||
break;
|
||||
default:
|
||||
OutHeight = (unsigned int)((float)Height / 1.699115044247788);
|
||||
OutWidth = (unsigned int)((float)Width / 1.699115044247788);
|
||||
scalingRatio = 0.58854167f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InParams->Set(NVSDK_NGX_Parameter_Scale, scalingRatio);
|
||||
InParams->Set(NVSDK_NGX_Parameter_OutWidth, OutWidth);
|
||||
InParams->Set(NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, OutWidth);
|
||||
InParams->Set(NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, Width);
|
||||
@@ -105,6 +114,11 @@ inline NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_DLSS_GetOptimalSettingsCallback(NVS
|
||||
InParams->Set(NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, Height);
|
||||
InParams->Set(NVSDK_NGX_Parameter_SizeInBytes, 1920 * 1080 * 31);
|
||||
|
||||
InParams->Set(NVSDK_NGX_EParameter_Scale, scalingRatio);
|
||||
InParams->Set(NVSDK_NGX_EParameter_OutWidth, OutWidth);
|
||||
InParams->Set(NVSDK_NGX_EParameter_OutHeight, OutHeight);
|
||||
InParams->Set(NVSDK_NGX_EParameter_SizeInBytes, 1920 * 1080 * 31);
|
||||
|
||||
spdlog::debug("EvaluateRenderScale end: in-> {0}x{1} out-> {2}x{3}", Width, Height, OutWidth, OutHeight);
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
@@ -308,7 +322,7 @@ private:
|
||||
|
||||
if (k == m_values.end())
|
||||
{
|
||||
spdlog::warn("NGXParameters::getT('{0}', FAIL)", key);
|
||||
spdlog::debug("NGXParameters::getT('{0}', FAIL)", key);
|
||||
return NVSDK_NGX_Result_Fail;
|
||||
};
|
||||
|
||||
|
||||
+35
-10
@@ -1,8 +1,6 @@
|
||||
#include "pch.h"
|
||||
#include "spdlog/sinks/basic_file_sink.h"
|
||||
#include "spdlog/sinks/stdout_sinks.h"
|
||||
|
||||
std::shared_ptr<spdlog::logger> logger = nullptr;
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
bool InitializeConsole()
|
||||
{
|
||||
@@ -56,20 +54,47 @@ void PrepareLogger()
|
||||
|
||||
if (config.LoggingEnabled.value_or(false))
|
||||
{
|
||||
if (config.LogToConsole.value_or(false) && InitializeConsole())
|
||||
logger = spdlog::stdout_logger_mt("xess");
|
||||
else
|
||||
logger = spdlog::basic_logger_mt("xess", config.LogFileName.value());
|
||||
if (config.OpenConsole.value_or(false))
|
||||
InitializeConsole();
|
||||
|
||||
logger->set_pattern("[%H:%M:%S.%f] [%L] %v");
|
||||
logger->set_level((spdlog::level::level_enum)config.LogLevel.value_or(2));
|
||||
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
|
||||
console_sink->set_level(spdlog::level::level_enum::info);
|
||||
console_sink->set_pattern("[XeSS] [%H:%M:%S.%f] [%L] %v");
|
||||
|
||||
spdlog::set_default_logger(logger);
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(config.LogFileName.value(), true);
|
||||
file_sink->set_level((spdlog::level::level_enum)config.LogLevel.value_or(2));
|
||||
file_sink->set_pattern("[%H:%M:%S.%f] [%L] %v");
|
||||
|
||||
std::shared_ptr<spdlog::logger> shared_logger = nullptr;
|
||||
|
||||
if (config.LogToConsole.value_or(true) && config.LogToFile.value_or(false))
|
||||
{
|
||||
spdlog::logger logger("multi_sink", { console_sink, file_sink });
|
||||
shared_logger = std::make_shared<spdlog::logger>(logger);
|
||||
}
|
||||
else if (config.LogToFile.value_or(false))
|
||||
{
|
||||
spdlog::logger logger("file_sink", { file_sink });
|
||||
shared_logger = std::make_shared<spdlog::logger>(logger);
|
||||
}
|
||||
else if (config.LogToConsole.value_or(true))
|
||||
{
|
||||
spdlog::logger logger("console_sink", { console_sink });
|
||||
shared_logger = std::make_shared<spdlog::logger>(logger);
|
||||
}
|
||||
|
||||
shared_logger->set_level(spdlog::level::level_enum::trace);
|
||||
spdlog::set_default_logger(shared_logger);
|
||||
}
|
||||
}
|
||||
catch (const spdlog::spdlog_ex& ex)
|
||||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
|
||||
auto logger = spdlog::stdout_color_mt("xess");
|
||||
logger->set_pattern("[%H:%M:%S.%f] [%L] %v");
|
||||
logger->set_level((spdlog::level::level_enum)2);
|
||||
spdlog::set_default_logger(logger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ LoggingEnabled=auto
|
||||
;Log file, if undefined log_xess_xxxx.log file in current folder
|
||||
;LogFile=./CyberXess.log
|
||||
|
||||
;Verbosity level of logs
|
||||
;Verbosity level of file logs
|
||||
; 0 = Trace
|
||||
; 1 = Debug
|
||||
; 2 = Info
|
||||
@@ -16,9 +16,15 @@ LoggingEnabled=auto
|
||||
; Default 2 = Info
|
||||
LogLevel=auto
|
||||
|
||||
;Log to console window instead of file - Default false
|
||||
;Log to console (Log level is always 2 (Info) for performance reasons) - Default true
|
||||
LogToConsole=auto
|
||||
|
||||
;Log to file - Default false
|
||||
LogToFile=auto
|
||||
|
||||
;Open console window for logs - Default false
|
||||
OpenConsole=auto
|
||||
|
||||
[XeSS]
|
||||
; Delays creation of XeSS Context to first frame - Default true
|
||||
DelayedInit=auto
|
||||
@@ -40,12 +46,12 @@ BuildPipelines=auto
|
||||
[CAS]
|
||||
;Enables CAS shapening - Default false
|
||||
Enabled=auto
|
||||
;Override DLSS sharpness paramater - Default false
|
||||
;Override DLSS sharpness paramater with fixed shapness value - Default false
|
||||
OverrideSharpness=auto
|
||||
;Strength of sharpening, value range between 0.0 and 1.0 - Default 0.4
|
||||
Sharpness=auto
|
||||
;Color space conversion for input and output
|
||||
;Looks like some games will need it (Alan Wake 2?)
|
||||
;Looks like some games might need it (Alan Wake 2?)
|
||||
;
|
||||
;Valid values are;
|
||||
; 0 = FFX_CAS_COLOR_SPACE_LINEAR -> Linear color space, will do nothing.
|
||||
@@ -108,6 +114,6 @@ QualityRatioUltraPerformance=auto
|
||||
; You can enable and test if it fix or break something
|
||||
; Default false
|
||||
DisableReactiveMask=auto
|
||||
; Resource barrier fix for rainbow colors on AMD cards
|
||||
; Resource barrier fix for rainbow colors on AMD cards (Mostly UE games)
|
||||
; Default false
|
||||
ColorResourceBarrier=auto
|
||||
Reference in New Issue
Block a user