From 548b29ef04e63f739d512531428c321fbbb816ac Mon Sep 17 00:00:00 2001 From: cdozdil Date: Tue, 7 May 2024 16:27:54 +0300 Subject: [PATCH] more dlss options added --- OptiScaler/Config.cpp | 25 + OptiScaler/Config.h | 7 + OptiScaler/backends/dlss/DLSSFeature.cpp | 174 +++++- OptiScaler/backends/dlss/DLSSFeature.h | 2 +- OptiScaler/backends/dlss/DLSSFeature_Dx12.cpp | 148 ++++- OptiScaler/backends/dlss/DLSSFeature_Dx12.h | 7 +- OptiScaler/imgui/Imgui_Base.cpp | 541 ++++++++++-------- nvngx.ini | 20 +- 8 files changed, 645 insertions(+), 279 deletions(-) diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index 226168c3..46c305ca 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -28,6 +28,31 @@ bool Config::Reload() // DLSS DLSSLibrary = readString("DLSS", "LibraryPath"); + RenderPresetOverride = readBool("DLSS", "RenderPresetOverride"); + RenderPresetDLAA = readInt("DLSS", "RenderPresetDLAA"); + RenderPresetUltraQuality = readInt("DLSS", "RenderPresetUltraQuality"); + RenderPresetQuality = readInt("DLSS", "RenderPresetQuality"); + RenderPresetBalanced = readInt("DLSS", "RenderPresetBalanced"); + RenderPresetPerformance = readInt("DLSS", "RenderPresetPerformance"); + RenderPresetUltraPerformance = readInt("DLSS", "RenderPresetUltraPerformance"); + + if (RenderPresetDLAA.has_value() && (RenderPresetDLAA.value() < 0 || RenderPresetDLAA.value() > 7)) + RenderPresetDLAA.reset(); + + if (RenderPresetUltraQuality.has_value() && (RenderPresetUltraQuality.value() < 0 || RenderPresetUltraQuality.value() > 7)) + RenderPresetUltraQuality.reset(); + + if (RenderPresetQuality.has_value() && (RenderPresetQuality.value() < 0 || RenderPresetQuality.value() > 7)) + RenderPresetQuality.reset(); + + if (RenderPresetBalanced.has_value() && (RenderPresetBalanced.value() < 0 || RenderPresetBalanced.value() > 7)) + RenderPresetBalanced.reset(); + + if (RenderPresetPerformance.has_value() && (RenderPresetPerformance.value() < 0 || RenderPresetPerformance.value() > 7)) + RenderPresetPerformance.reset(); + + if (RenderPresetUltraPerformance.has_value() && (RenderPresetUltraPerformance.value() < 0 || RenderPresetUltraPerformance.value() > 7)) + RenderPresetUltraPerformance.reset(); // logging LoggingEnabled = readBool("Log", "LoggingEnabled"); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 4caedf05..f6aa965c 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -46,6 +46,13 @@ public: //DLSS std::optional DLSSLibrary; + std::optional RenderPresetOverride; + std::optional RenderPresetDLAA; + std::optional RenderPresetUltraQuality; + std::optional RenderPresetQuality; + std::optional RenderPresetBalanced; + std::optional RenderPresetPerformance; + std::optional RenderPresetUltraPerformance; // CAS std::optional CasEnabled; diff --git a/OptiScaler/backends/dlss/DLSSFeature.cpp b/OptiScaler/backends/dlss/DLSSFeature.cpp index 1dae92f9..5371eccd 100644 --- a/OptiScaler/backends/dlss/DLSSFeature.cpp +++ b/OptiScaler/backends/dlss/DLSSFeature.cpp @@ -392,8 +392,21 @@ void DLSSFeature::ProcessEvaluateParams(const NVSDK_NGX_Parameter* InParameters) if (InParameters->Get(NVSDK_NGX_Parameter_Jitter_Offset_Y, &floatValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_Jitter_Offset_Y, floatValue); - if (InParameters->Get(NVSDK_NGX_Parameter_Sharpness, &floatValue) == NVSDK_NGX_Result_Success) + // override sharpness + if (Config::Instance()->OverrideSharpness.value_or(false) && !(Config::Instance()->Api == NVNGX_DX12 && Config::Instance()->CasEnabled.value_or(false))) + { + auto sharpness = Config::Instance()->Sharpness.value_or(0.3f); + Parameters->Set(NVSDK_NGX_Parameter_Sharpness, sharpness); + } + // cas enabled + else if (Config::Instance()->Api == NVNGX_DX12 && Config::Instance()->CasEnabled.value_or(false)) + Parameters->Set(NVSDK_NGX_Parameter_Sharpness, 0.0f); + // dlss value + else if (InParameters->Get(NVSDK_NGX_Parameter_Sharpness, &floatValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_Sharpness, floatValue); + // fallback + else + Parameters->Set(NVSDK_NGX_Parameter_Sharpness, 0.0f); if (InParameters->Get(NVSDK_NGX_Parameter_Reset, &intValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_Reset, intValue); @@ -480,29 +493,152 @@ void DLSSFeature::ProcessInitParams(const NVSDK_NGX_Parameter* InParameters) if (InParameters->Get(NVSDK_NGX_Parameter_VisibilityNodeMask, &uintValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_VisibilityNodeMask, uintValue); - if (InParameters->Get(NVSDK_NGX_Parameter_Width, &uintValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_Width, uintValue); - - if (InParameters->Get(NVSDK_NGX_Parameter_Height, &uintValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_Height, uintValue); - - if (InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &uintValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_OutWidth, uintValue); - - if (InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &uintValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_OutHeight, uintValue); - - if (InParameters->Get(NVSDK_NGX_Parameter_PerfQualityValue, &intValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_PerfQualityValue, intValue); - - if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, &intValue) == NVSDK_NGX_Result_Success) - Parameters->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, intValue); - if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, &intValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, intValue); if (InParameters->Get(NVSDK_NGX_Parameter_RTXValue, &intValue) == NVSDK_NGX_Result_Success) Parameters->Set(NVSDK_NGX_Parameter_RTXValue, intValue); + + // Create flags ----------------------------- + unsigned int featureFlags = 0; + + bool isHdr = false; + bool mvLowRes = false; + bool mvJittered = false; + bool depthInverted = false; + bool sharpening = false; + bool autoExposure = false; + + if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, &uintValue) == NVSDK_NGX_Result_Success) + { + isHdr = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_IsHDR) > 0; + mvLowRes = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_MVLowRes) > 0; + mvJittered = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_MVJittered) > 0; + depthInverted = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_DepthInverted) > 0; + sharpening = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_DoSharpening) > 0; + autoExposure = (uintValue & NVSDK_NGX_DLSS_Feature_Flags_AutoExposure) > 0; + } + + if (Config::Instance()->DepthInverted.value_or(depthInverted)) + { + Config::Instance()->DepthInverted = true; + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_DepthInverted; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (DepthInverted) {0:b}", featureFlags); + } + + if (Config::Instance()->AutoExposure.value_or(autoExposure)) + { + Config::Instance()->AutoExposure = true; + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_AutoExposure; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (AutoExposure) {0:b}", featureFlags); + } + else + { + Config::Instance()->AutoExposure = false; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (!AutoExposure) {0:b}", featureFlags); + } + + if (!Config::Instance()->HDR.value_or(isHdr)) + { + Config::Instance()->HDR = true; + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_IsHDR; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (HDR) {0:b}", featureFlags); + } + else + { + Config::Instance()->HDR = false; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (!HDR) {0:b}", featureFlags); + } + + if (Config::Instance()->JitterCancellation.value_or(mvJittered)) + { + Config::Instance()->JitterCancellation = true; + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_MVJittered; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (JitterCancellation) {0:b}", featureFlags); + } + + if (Config::Instance()->DisplayResolution.value_or(!mvLowRes)) + { + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_MVLowRes; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (!LowResMV) {0:b}", featureFlags); + } + else + { + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (LowResMV) {0:b}", featureFlags); + } + + if (Config::Instance()->OverrideSharpness.value_or(sharpening) && !(Config::Instance()->Api == NVNGX_DX12 && Config::Instance()->CasEnabled.value_or(false))) + { + featureFlags |= NVSDK_NGX_DLSS_Feature_Flags_DoSharpening; + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (Sharpenin) {0:b}", featureFlags); + } + else + { + spdlog::info("DLSSFeature::ProcessInitParams featureFlags (!Sharpenin) {0:b}", featureFlags); + } + + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, featureFlags); + + // Resolution ----------------------------- + if (Config::Instance()->SuperSamplingEnabled.value_or(false) && !Config::Instance()->DisplayResolution.value_or(false)) + { + float ssMulti = Config::Instance()->SuperSamplingMultiplier.value_or(1.5f); + + if (ssMulti < 0.5f) + { + ssMulti = 0.5f; + Config::Instance()->SuperSamplingMultiplier = ssMulti; + } + else if (ssMulti > 3.0f) + { + ssMulti = 3.0f; + Config::Instance()->SuperSamplingMultiplier = ssMulti; + } + + _targetWidth = DisplayWidth() * ssMulti; + _targetHeight = DisplayHeight() * ssMulti; + } + else + { + _targetWidth = DisplayWidth(); + _targetHeight = DisplayHeight(); + } + + Parameters->Set(NVSDK_NGX_Parameter_Width, RenderWidth()); + Parameters->Set(NVSDK_NGX_Parameter_Height, RenderHeight()); + Parameters->Set(NVSDK_NGX_Parameter_OutWidth, TargetWidth()); + Parameters->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; + + 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(false)) + { + RenderPresetDLAA = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetDLAA); + RenderPresetUltraQuality = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetUltraQuality); + RenderPresetQuality = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetQuality); + RenderPresetBalanced = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetBalanced); + RenderPresetPerformance = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetPerformance); + RenderPresetUltraPerformance = Config::Instance()->RenderPresetDLAA.value_or(RenderPresetUltraPerformance); + } + + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA, RenderPresetDLAA); + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality, RenderPresetUltraQuality); + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality, RenderPresetQuality); + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced, RenderPresetBalanced); + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance, RenderPresetPerformance); + Parameters->Set(NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance, RenderPresetUltraPerformance); } void DLSSFeature::GetFeatureCommonInfo(NVSDK_NGX_FeatureCommonInfo* fcInfo) diff --git a/OptiScaler/backends/dlss/DLSSFeature.h b/OptiScaler/backends/dlss/DLSSFeature.h index 0dda7fd6..77c68760 100644 --- a/OptiScaler/backends/dlss/DLSSFeature.h +++ b/OptiScaler/backends/dlss/DLSSFeature.h @@ -7,7 +7,7 @@ class DLSSFeature : public virtual IFeature { private: - feature_version _version = { 1, 0, 0 }; + feature_version _version = { 0, 0, 0 }; inline static HMODULE _nvngx = nullptr; protected: diff --git a/OptiScaler/backends/dlss/DLSSFeature_Dx12.cpp b/OptiScaler/backends/dlss/DLSSFeature_Dx12.cpp index 3c13e17a..855db2c9 100644 --- a/OptiScaler/backends/dlss/DLSSFeature_Dx12.cpp +++ b/OptiScaler/backends/dlss/DLSSFeature_Dx12.cpp @@ -130,12 +130,71 @@ bool DLSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N } NVSDK_NGX_Result nvResult; - ID3D12Resource* paramOutput; if (_EvaluateFeature != nullptr) { + if (Config::Instance()->changeCAS) + { + if (CAS != nullptr && CAS.get() != nullptr) + { + spdlog::trace("DLSSFeatureDx12::Evaluate sleeping before CAS.reset() for 250ms"); + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + CAS.reset(); + } + else + { + Config::Instance()->changeCAS = false; + spdlog::trace("DLSSFeatureDx12::Evaluate sleeping before CAS creation for 250ms"); + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + CAS = std::make_unique(Device, TargetWidth(), TargetHeight(), Config::Instance()->CasColorSpaceConversion.value_or(0)); + } + } + ProcessEvaluateParams(InParameters); + ID3D12Resource* paramOutput = nullptr; + ID3D12Resource* setBuffer = nullptr; + + bool useSS = Config::Instance()->SuperSamplingEnabled.value_or(false) && !Config::Instance()->DisplayResolution.value_or(false); + + Parameters->Get(NVSDK_NGX_Parameter_Output, ¶mOutput); + + // supersampling + if (useSS) + { + OUT_DS->Scale = (float)TargetWidth() / (float)DisplayWidth(); + + if (OUT_DS->CreateBufferResource(Device, paramOutput, TargetWidth(), TargetHeight(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS)) + { + OUT_DS->SetBufferState(InCommandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + setBuffer = OUT_DS->Buffer(); + } + else + setBuffer = paramOutput; + } + else + setBuffer = paramOutput; + + // CAS sharpness & preperation + auto sharpness = GetSharpness(InParameters); + + if (!Config::Instance()->changeCAS && Config::Instance()->CasEnabled.value_or(false) && sharpness > 0.0f && + CAS != nullptr && CAS.get() != nullptr && + CAS->CreateBufferResource(Device, setBuffer, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)) + { + CAS->SetBufferState(InCommandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + + setBuffer = CAS->Buffer(); + } + // sharpness override + else if (Config::Instance()->OverrideSharpness.value_or(false)) + { + sharpness = Config::Instance()->Sharpness.value_or(0.3); + Parameters->Set(NVSDK_NGX_Parameter_Sharpness, sharpness); + } + + Parameters->Set(NVSDK_NGX_Parameter_Output, setBuffer); + nvResult = _EvaluateFeature(InCommandList, _p_dlssHandle, Parameters, NULL); if (nvResult != NVSDK_NGX_Result_Success) @@ -143,6 +202,63 @@ bool DLSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N spdlog::error("DLSSFeatureDx12::Evaluate _EvaluateFeature result: {0:X}", (unsigned int)nvResult); return false; } + + // Apply CAS + if (!Config::Instance()->changeCAS && Config::Instance()->CasEnabled.value_or(false) && sharpness > 0.0f && CAS != nullptr && CAS.get() != nullptr && CAS->Buffer() != nullptr) + { + ResourceBarrier(InCommandList, setBuffer, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); + CAS->SetBufferState(InCommandList, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); + + if (useSS) + { + if (!CAS->Dispatch(InCommandList, sharpness, setBuffer, OUT_DS->Buffer())) + { + Config::Instance()->CasEnabled = false; + return true; + } + } + else + { + if (!CAS->Dispatch(InCommandList, sharpness, setBuffer, paramOutput)) + { + Config::Instance()->CasEnabled = false; + return true; + } + } + } + + // Downsampling + if (useSS) + { + spdlog::debug("XeSSFeatureDx12::Evaluate downscaling output..."); + OUT_DS->SetBufferState(InCommandList, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); + + if (!OUT_DS->Dispatch(Device, InCommandList, OUT_DS->Buffer(), paramOutput)) + { + Config::Instance()->SuperSamplingEnabled = false; + Config::Instance()->changeBackend = true; + return true; + } + } + + // imgui + if (_frameCount > 20 && Parameters->Get(NVSDK_NGX_Parameter_Output, ¶mOutput) == NVSDK_NGX_Result_Success) + { + if (Imgui != nullptr && Imgui.get() != nullptr) + { + if (Imgui->IsHandleDifferent()) + { + Imgui.reset(); + } + else + Imgui->Render(InCommandList, paramOutput); + } + else + { + if (Imgui == nullptr || Imgui.get() == nullptr) + Imgui = std::make_unique(GetForegroundWindow(), Device); + } + } } else { @@ -150,25 +266,6 @@ bool DLSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N return false; } - // imgui - if (_frameCount > 20 && Parameters->Get(NVSDK_NGX_Parameter_Output, ¶mOutput) == NVSDK_NGX_Result_Success) - { - if (Imgui != nullptr && Imgui.get() != nullptr) - { - if (Imgui->IsHandleDifferent()) - { - Imgui.reset(); - } - else - Imgui->Render(InCommandList, paramOutput); - } - else - { - if (Imgui == nullptr || Imgui.get() == nullptr) - Imgui = std::make_unique(GetForegroundWindow(), Device); - } - } - _frameCount++; return true; @@ -237,3 +334,14 @@ DLSSFeatureDx12::~DLSSFeatureDx12() if (_ReleaseFeature != nullptr) _ReleaseFeature(_p_dlssHandle); } + +float DLSSFeatureDx12::GetSharpness(const NVSDK_NGX_Parameter* InParameters) +{ + if (Config::Instance()->OverrideSharpness.value_or(false)) + return Config::Instance()->Sharpness.value_or(0.3); + + float sharpness = 0.0f; + InParameters->Get(NVSDK_NGX_Parameter_Sharpness, &sharpness); + + return sharpness; +} diff --git a/OptiScaler/backends/dlss/DLSSFeature_Dx12.h b/OptiScaler/backends/dlss/DLSSFeature_Dx12.h index 3933ed72..e9a2a5e8 100644 --- a/OptiScaler/backends/dlss/DLSSFeature_Dx12.h +++ b/OptiScaler/backends/dlss/DLSSFeature_Dx12.h @@ -1,6 +1,7 @@ #pragma once -#include "../IFeature_Dx12.h" #include "DLSSFeature.h" +#include "../IFeature_Dx12.h" +#include "../../cas/CAS_Dx12.h" #include typedef NVSDK_NGX_Result(*PFN_NVSDK_NGX_D3D12_Init_Ext)(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath, ID3D12Device* InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo); @@ -27,6 +28,10 @@ private: inline static PFN_NVSDK_NGX_D3D12_CreateFeature _CreateFeature = nullptr; inline static PFN_NVSDK_NGX_D3D12_ReleaseFeature _ReleaseFeature = nullptr; inline static PFN_NVSDK_NGX_D3D12_EvaluateFeature _EvaluateFeature = nullptr; + + std::unique_ptr CAS = nullptr; + + float GetSharpness(const NVSDK_NGX_Parameter* InParameters); protected: diff --git a/OptiScaler/imgui/Imgui_Base.cpp b/OptiScaler/imgui/Imgui_Base.cpp index d4bb1270..14878664 100644 --- a/OptiScaler/imgui/Imgui_Base.cpp +++ b/OptiScaler/imgui/Imgui_Base.cpp @@ -37,6 +37,8 @@ bool imguiSizeUpdate = true; bool _isVisible = false; WNDPROC _oWndProc = nullptr; +#pragma region "Hooks & WndProc" + LRESULT WINAPI hkSendMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { if (_isVisible && Msg == 0x0020) @@ -157,6 +159,10 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) if (msg == WM_KEYDOWN && wParam == VK_HOME) // && (GetKeyState(VK_SHIFT) & 0x8000)) { _isVisible = !_isVisible; + + if (!_isVisible) + showMipmapCalcWindow = false; + io.MouseDrawCursor = _isVisible; io.WantCaptureKeyboard = _isVisible; io.WantCaptureMouse = _isVisible; @@ -220,6 +226,8 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) return CallWindowProc(_oWndProc, hWnd, msg, wParam, lParam); } +#pragma endregion + std::string GetBackendName(std::string* code) { if (*code == "fsr21") @@ -358,7 +366,7 @@ void AddVulkanBackends(std::string* code, std::string* name) void AddResourceBarrier(std::string name, std::optional* value) { - const char* states[] = { "Auto", "COMMON", "VERTEX_AND_CONSTANT_BUFFER", "INDEX_BUFFER", "RENDER_TARGET", "UNORDERED_ACCESS", "DEPTH_WRITE", + const char* states[] = { "AUTO", "COMMON", "VERTEX_AND_CONSTANT_BUFFER", "INDEX_BUFFER", "RENDER_TARGET", "UNORDERED_ACCESS", "DEPTH_WRITE", "DEPTH_READ", "NON_PIXEL_SHADER_RESOURCE", "PIXEL_SHADER_RESOURCE", "STREAM_OUT", "INDIRECT_ARGUMENT", "COPY_DEST", "COPY_SOURCE", "RESOLVE_DEST", "RESOLVE_SOURCE", "RAYTRACING_ACCELERATION_STRUCTURE", "SHADING_RATE_SOURCE", "GENERIC_READ", "ALL_SHADER_RESOURCE", "PRESENT", "PREDICATION", "VIDEO_DECODE_READ", "VIDEO_DECODE_WRITE", "VIDEO_PROCESS_READ", "VIDEO_PROCESS_WRITE", "VIDEO_ENCODE_READ", @@ -395,6 +403,41 @@ void AddResourceBarrier(std::string name, std::optional* value) } } +void AddRenderPreset(std::string name, std::optional* value) +{ + const char* presets[] = { "DEFAULT", "PRESET A", "PRESET B", "PRESET C", "PRESET D", "PRESET E", "PRESET F", "PRESET G" }; + + int selected = value->value_or(0); + + const char* selectedName = ""; + + for (int n = 0; n < 8; n++) + { + if (n == selected) + { + selectedName = presets[n]; + break; + } + } + + if (ImGui::BeginCombo(name.c_str(), selectedName)) + { + if (ImGui::Selectable(presets[0], !value->has_value())) + value->reset(); + + for (int n = 1; n < 8; n++) + { + if (ImGui::Selectable(presets[n], selected == n)) + { + if (n != selected) + *value = n; + } + } + + ImGui::EndCombo(); + } +} + void Imgui_Base::RenderMenu() { ImGuiIO const& io = ImGui::GetIO(); (void)io; @@ -484,221 +527,314 @@ void Imgui_Base::RenderMenu() if (ImGui::Button("Revert")) Config::Instance()->newBackend = ""; - // Dx11 - ImGui::SeparatorText("Dx11 with Dx12 Settings"); + // DYNAMIC PROPERTIES ----------------------------- - ImGui::BeginDisabled(Config::Instance()->Api != NVNGX_DX11 || - (Config::Instance()->Api == NVNGX_DX11 && Config::Instance()->Dx11Upscaler.value_or("fsr22") == "fsr22")); - - const char* sync[] = { "No Syncing", "Fence", "Fence + Event", "Fence + Flush", "Fence + Flush + Event", "Only Query" }; - - const char* selectedSync = sync[Config::Instance()->TextureSyncMethod.value_or(1)]; - - if (ImGui::BeginCombo("Input Sync", selectedSync)) + // Dx11 with Dx12 + if (Config::Instance()->Api == NVNGX_DX11 && Config::Instance()->Dx11Upscaler.value_or("fsr22") != "fsr22") { - for (int n = 0; n < 6; n++) + ImGui::SeparatorText("Dx11 with Dx12 Settings"); + + const char* sync[] = { "No Syncing", "Fence", "Fence + Event", "Fence + Flush", "Fence + Flush + Event", "Only Query" }; + + const char* selectedSync = sync[Config::Instance()->TextureSyncMethod.value_or(1)]; + + if (ImGui::BeginCombo("Input Sync", selectedSync)) { - if (ImGui::Selectable(sync[n], (Config::Instance()->TextureSyncMethod.value_or(1) == n))) - Config::Instance()->TextureSyncMethod = n; + for (int n = 0; n < 6; n++) + { + if (ImGui::Selectable(sync[n], (Config::Instance()->TextureSyncMethod.value_or(1) == n))) + Config::Instance()->TextureSyncMethod = n; + } + + ImGui::EndCombo(); } - ImGui::EndCombo(); - } + const char* sync2[] = { "No Syncing", "Fence", "Fence + Event", "Fence + Flush", "Fence + Flush + Event", "Only Query" }; - const char* sync2[] = { "No Syncing", "Fence", "Fence + Event", "Fence + Flush", "Fence + Flush + Event", "Only Query" }; + selectedSync = sync2[Config::Instance()->CopyBackSyncMethod.value_or(5)]; - selectedSync = sync2[Config::Instance()->CopyBackSyncMethod.value_or(5)]; - - if (ImGui::BeginCombo("Output Sync", selectedSync)) - { - for (int n = 0; n < 6; n++) + if (ImGui::BeginCombo("Output Sync", selectedSync)) { - if (ImGui::Selectable(sync2[n], (Config::Instance()->CopyBackSyncMethod.value_or(5) == n))) - Config::Instance()->CopyBackSyncMethod = n; + for (int n = 0; n < 6; n++) + { + if (ImGui::Selectable(sync2[n], (Config::Instance()->CopyBackSyncMethod.value_or(5) == n))) + Config::Instance()->CopyBackSyncMethod = n; + } + + ImGui::EndCombo(); } - ImGui::EndCombo(); + if (bool afterDx12 = Config::Instance()->SyncAfterDx12.value_or(true); ImGui::Checkbox("Sync After Dx12", &afterDx12)) + { + Config::Instance()->SyncAfterDx12 = afterDx12; + } } - if (bool afterDx12 = Config::Instance()->SyncAfterDx12.value_or(true); ImGui::Checkbox("Sync After Dx12", &afterDx12)) - { - Config::Instance()->SyncAfterDx12 = afterDx12; - } - - - ImGui::EndDisabled(); - // UPSCALER SPECIFIC ----------------------------- - // XeSS - ImGui::BeginDisabled(currentBackend != "xess"); - ImGui::SeparatorText("XeSS Settings"); - const char* models[] = { "KPSS", "SPLAT", "MODEL_3", "MODEL_4", "MODEL_5", "MODEL_6" }; - auto configModes = Config::Instance()->NetworkModel.value_or(0); - - if (configModes < 0 || configModes > 5) - configModes = 0; - - const char* selectedModel = models[configModes]; - - if (ImGui::BeginCombo("Network Models", selectedModel)) + // XeSS ----------------------------- + if (currentBackend == "xess") { - for (int n = 0; n < 6; n++) + ImGui::SeparatorText("XeSS Settings"); + + const char* models[] = { "KPSS", "SPLAT", "MODEL_3", "MODEL_4", "MODEL_5", "MODEL_6" }; + auto configModes = Config::Instance()->NetworkModel.value_or(0); + + if (configModes < 0 || configModes > 5) + configModes = 0; + + const char* selectedModel = models[configModes]; + + if (ImGui::BeginCombo("Network Models", selectedModel)) { - if (ImGui::Selectable(models[n], (Config::Instance()->NetworkModel.value_or(0) == n))) + for (int n = 0; n < 6; n++) { - Config::Instance()->NetworkModel = n; - Config::Instance()->changeBackend = true; + if (ImGui::Selectable(models[n], (Config::Instance()->NetworkModel.value_or(0) == n))) + { + Config::Instance()->NetworkModel = n; + Config::Instance()->changeBackend = true; + } } + + ImGui::EndCombo(); } - ImGui::EndCombo(); - } + if (bool dbg = Config::Instance()->xessDebug; ImGui::Checkbox("Dump (Shift+Del)", &dbg)) + Config::Instance()->xessDebug = dbg; - if (bool cas = Config::Instance()->CasEnabled.value_or(false); ImGui::Checkbox("CAS", &cas)) - { - Config::Instance()->CasEnabled = cas; - Config::Instance()->changeCAS = true; - } + ImGui::SameLine(0.0f, 6.0f); + int dbgCount = Config::Instance()->xessDebugFrames; - ImGui::SameLine(0.0f, 6.0f); - if (bool dbg = Config::Instance()->xessDebug; ImGui::Checkbox("Dump (Shift+Del)", &dbg)) - Config::Instance()->xessDebug = dbg; - - ImGui::SameLine(0.0f, 6.0f); - int dbgCount = Config::Instance()->xessDebugFrames; - - ImGui::PushItemWidth(85.0); - if (ImGui::InputInt("frames", &dbgCount)) - { - if (dbgCount < 4) - dbgCount = 4; - else if (dbgCount > 999) - dbgCount = 999; - - Config::Instance()->xessDebugFrames = dbgCount; - } - - ImGui::PopItemWidth(); - - ImGui::BeginDisabled(!Config::Instance()->CasEnabled.value_or(false)); - - const char* cs[] = { "LINEAR", "GAMMA20", "GAMMA22", "SRGB_OUTPUT", "SRGB_INPUT_OUTPUT" }; - auto configCs = Config::Instance()->CasColorSpaceConversion.value_or(0); - - if (configCs < 0) - configCs = 0; - else if (configCs > 4) - configCs = 4; - - const char* selectedCs = cs[configCs]; - - if (ImGui::BeginCombo("Color Space", selectedCs)) - { - for (int n = 0; n < 5; n++) + ImGui::PushItemWidth(85.0); + if (ImGui::InputInt("frames", &dbgCount)) { - if (ImGui::Selectable(cs[n], (Config::Instance()->CasColorSpaceConversion.value_or(0) == n))) - { - Config::Instance()->CasColorSpaceConversion = n; - Config::Instance()->changeCAS = true; - } + if (dbgCount < 4) + dbgCount = 4; + else if (dbgCount > 999) + dbgCount = 999; + + Config::Instance()->xessDebugFrames = dbgCount; } - ImGui::EndCombo(); + ImGui::PopItemWidth(); } - ImGui::EndDisabled(); - - ImGui::EndDisabled(); - // FSR ----------------- - ImGui::BeginDisabled(currentBackend == "xess"); - ImGui::SeparatorText("FSR Settings"); - - bool useVFov = Config::Instance()->FsrVerticalFov.has_value() || !Config::Instance()->FsrHorizontalFov.has_value(); - - float vfov; - float hfov; - - vfov = Config::Instance()->FsrVerticalFov.value_or(60.0f); - hfov = Config::Instance()->FsrHorizontalFov.value_or(90.0f); - - if (ImGui::RadioButton("Use Vert. Fov", useVFov)) + if (currentBackend.rfind("fsr", 0) == 0) { - Config::Instance()->FsrHorizontalFov.reset(); - useVFov = true; + ImGui::SeparatorText("FSR Settings"); + + bool useVFov = Config::Instance()->FsrVerticalFov.has_value() || !Config::Instance()->FsrHorizontalFov.has_value(); + + float vfov; + float hfov; + + vfov = Config::Instance()->FsrVerticalFov.value_or(60.0f); + hfov = Config::Instance()->FsrHorizontalFov.value_or(90.0f); + + if (ImGui::RadioButton("Use Vert. Fov", useVFov)) + { + Config::Instance()->FsrHorizontalFov.reset(); + useVFov = true; + } + + ImGui::SameLine(0.0f, 6.0f); + + if (ImGui::RadioButton("Use Horz. Fov", !useVFov)) + { + Config::Instance()->FsrVerticalFov.reset(); + useVFov = false; + } + + ImGui::BeginDisabled(!useVFov); + + if (ImGui::SliderFloat("Vert. FOV", &vfov, 0.0f, 180.0f, "%.1f", ImGuiSliderFlags_NoRoundToFormat)) + Config::Instance()->FsrVerticalFov = vfov; + + ImGui::EndDisabled(); + + ImGui::BeginDisabled(useVFov); + + if (ImGui::SliderFloat("Horz. FOV", &hfov, 0.0f, 180.0f, "%.1f", ImGuiSliderFlags_NoRoundToFormat)) + Config::Instance()->FsrHorizontalFov = hfov; + + ImGui::EndDisabled(); } - ImGui::SameLine(); - - if (ImGui::RadioButton("Use Horz. Fov", !useVFov)) + // DLSS ----------------- + if (currentBackend == "dlss") { - Config::Instance()->FsrVerticalFov.reset(); - useVFov = false; + ImGui::SeparatorText("DLSS Settings"); + + + if (bool pOverride = Config::Instance()->RenderPresetOverride.value_or(false); ImGui::Checkbox("Render Presets Override", &pOverride)) + Config::Instance()->RenderPresetOverride = pOverride; + + ImGui::SameLine(0.0f, 6.0f); + + if (ImGui::Button("Apply Changes")) + Config::Instance()->changeBackend = true; + + AddRenderPreset("DLAA", &Config::Instance()->RenderPresetDLAA); + AddRenderPreset("Ultra Quality", &Config::Instance()->RenderPresetUltraQuality); + AddRenderPreset("Quality", &Config::Instance()->RenderPresetQuality); + AddRenderPreset("Balanced", &Config::Instance()->RenderPresetBalanced); + AddRenderPreset("Performance", &Config::Instance()->RenderPresetPerformance); + AddRenderPreset("Ultra Performance", &Config::Instance()->RenderPresetUltraPerformance); } - ImGui::BeginDisabled(!useVFov); + // CAS ----------------- + if (Config::Instance()->Api == NVNGX_DX12 && currentBackend.rfind("fsr", 0)) + { + ImGui::SeparatorText("CAS Settings"); - if (ImGui::SliderFloat("Vert. FOV", &vfov, 0.0f, 180.0f, "%.1f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->FsrVerticalFov = vfov; + if (bool cas = Config::Instance()->CasEnabled.value_or(false); ImGui::Checkbox("CAS", &cas)) + { + Config::Instance()->CasEnabled = cas; - ImGui::EndDisabled(); + if (currentBackend == "dlss") + Config::Instance()->changeBackend = true; + else + Config::Instance()->changeCAS = true; + } - ImGui::BeginDisabled(useVFov); + ImGui::BeginDisabled(!Config::Instance()->CasEnabled.value_or(false)); - if (ImGui::SliderFloat("Horz. FOV", &hfov, 0.0f, 180.0f, "%.1f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->FsrHorizontalFov = hfov; + const char* cs[] = { "LINEAR", "GAMMA20", "GAMMA22", "SRGB_OUTPUT", "SRGB_INPUT_OUTPUT" }; + auto configCs = Config::Instance()->CasColorSpaceConversion.value_or(0); - ImGui::EndDisabled(); + if (configCs < 0) + configCs = 0; + else if (configCs > 4) + configCs = 4; - ImGui::EndDisabled(); + const char* selectedCs = cs[configCs]; + + if (ImGui::BeginCombo("Color Space", selectedCs)) + { + for (int n = 0; n < 5; n++) + { + if (ImGui::Selectable(cs[n], (Config::Instance()->CasColorSpaceConversion.value_or(0) == n))) + { + Config::Instance()->CasColorSpaceConversion = n; + Config::Instance()->changeCAS = true; + } + } + + ImGui::EndCombo(); + } + + ImGui::EndDisabled(); + } // SUPERSAMPLING ----------------------------- - ImGui::SeparatorText("Supersampling"); - - bool isXess12 = (Config::Instance()->Dx12Upscaler.value_or("xess") == "xess" || Config::Instance()->Dx11Upscaler.value_or("fsr22") == "xess") && - Config::Instance()->CurrentFeature->Version().major <= 1 && Config::Instance()->CurrentFeature->Version().minor <= 2; - - float defaultRatio = 2.5f; - - if (ssRatio == 0.0f) + if (Config::Instance()->Api == NVNGX_DX12 || + (Config::Instance()->Api == NVNGX_DX11 && Config::Instance()->Dx11Upscaler.value_or("fsr22") != "fsr22" && Config::Instance()->Dx11Upscaler.value_or("fsr22") != "dlss")) { - ssRatio = Config::Instance()->SuperSamplingMultiplier.value_or(defaultRatio); - ssEnabled = Config::Instance()->SuperSamplingEnabled.value_or(false); + ImGui::SeparatorText("Supersampling"); + + float defaultRatio = 2.5f; + + if (ssRatio == 0.0f) + { + ssRatio = Config::Instance()->SuperSamplingMultiplier.value_or(defaultRatio); + ssEnabled = Config::Instance()->SuperSamplingEnabled.value_or(false); + } + + ImGui::Checkbox("Enable", &ssEnabled); + + ImGui::SameLine(0.0f, 6.0f); + + if (ImGui::Button("Apply Change") && (ssEnabled != Config::Instance()->SuperSamplingEnabled.value_or(false) || + ssRatio != Config::Instance()->SuperSamplingMultiplier.value_or(defaultRatio))) + { + Config::Instance()->SuperSamplingEnabled = ssEnabled; + Config::Instance()->SuperSamplingMultiplier = ssRatio; + Config::Instance()->changeBackend = true; + } + + ImGui::SameLine(0.0f, 6.0f); + + if (cf != nullptr) + ImGui::Text("%dx%d -> %dx%d", cf->RenderWidth(), cf->RenderHeight(), (uint32_t)(cf->DisplayWidth() * ssRatio), (uint32_t)(cf->DisplayHeight() * ssRatio)); + + ImGui::SliderFloat("Ratio", &ssRatio, 0.5f, 3.0f, "%.2f"); } - ImGui::BeginDisabled( - (Config::Instance()->Api == NVNGX_VULKAN || (Config::Instance()->Api == NVNGX_DX11 && Config::Instance()->Dx11Upscaler.value_or("fsr22") == "fsr22")) || - Config::Instance()->DisplayResolution.value_or(false) - ); - - ImGui::Checkbox("Enable", &ssEnabled); - - ImGui::SameLine(0.0f, 6.0f); - - if (ImGui::Button("Apply Change") && (ssEnabled != Config::Instance()->SuperSamplingEnabled.value_or(false) || - ssRatio != Config::Instance()->SuperSamplingMultiplier.value_or(defaultRatio))) + // DX12 ----------------------------- + if (Config::Instance()->Api == NVNGX_DX12) { - Config::Instance()->SuperSamplingEnabled = ssEnabled; - Config::Instance()->SuperSamplingMultiplier = ssRatio; - Config::Instance()->changeBackend = true; + // MIPMAP BIAS ----------------------------- + ImGui::SeparatorText("Mipmap Bias (Dx12)"); + + if (Config::Instance()->MipmapBiasOverride.has_value() && mipBias == 0.0f) + mipBias = Config::Instance()->MipmapBiasOverride.value(); + + ImGui::SliderFloat("Mipmap Bias", &mipBias, -15.0f, 15.0f, "%.6f", ImGuiSliderFlags_NoRoundToFormat); + + ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "This will be applied after first resolution change!"); + + if (ImGui::Button("Set")) + Config::Instance()->MipmapBiasOverride = mipBias; + + ImGui::SameLine(0.0f, 6.0f); + + if (ImGui::Button("Reset")) + { + Config::Instance()->MipmapBiasOverride.reset(); + mipBias = 0.0f; + } + + ImGui::SameLine(0.0f, 6.0f); + + if (ImGui::Button("Calculate")) + { + showMipmapCalcWindow = true; + } + + ImGui::SameLine(0.0f, 6.0f); + + ImGui::Text("Current : %.6f", Config::Instance()->lastMipBias); + + // Non-DLSS hotfixes ----------------------------- + if (currentBackend != "dlss") + { + // BARRIERS ----------------------------- + ImGui::SeparatorText("Resource Barriers (Dx12)"); + + AddResourceBarrier("Color", &Config::Instance()->ColorResourceBarrier); + AddResourceBarrier("Depth", &Config::Instance()->DepthResourceBarrier); + AddResourceBarrier("Motion", &Config::Instance()->MVResourceBarrier); + AddResourceBarrier("Exposure", &Config::Instance()->ExposureResourceBarrier); + AddResourceBarrier("Mask", &Config::Instance()->MaskResourceBarrier); + AddResourceBarrier("Output", &Config::Instance()->OutputResourceBarrier); + + // HOTFIXES ----------------------------- + ImGui::SeparatorText("Hotfixes (Dx12)"); + + if (bool crs = Config::Instance()->RestoreComputeSignature.value_or(false); ImGui::Checkbox("Restore Compute RS", &crs)) + Config::Instance()->RestoreComputeSignature = crs; + + ImGui::SameLine(0.0f, 6.0f); + if (bool grs = Config::Instance()->RestoreGraphicSignature.value_or(false); ImGui::Checkbox("Restore Graphic RS", &grs)) + Config::Instance()->RestoreGraphicSignature = grs; + } } - ImGui::SameLine(0.0f, 6.0f); - - if (cf != nullptr) - ImGui::Text("%dx%d -> %dx%d", cf->RenderWidth(), cf->RenderHeight(), (uint32_t)(cf->DisplayWidth() * ssRatio), (uint32_t)(cf->DisplayHeight() * ssRatio)); - - ImGui::SliderFloat("Ratio", &ssRatio, 0.5f, 3.0f, "%.2f"); - - ImGui::EndDisabled(); + // NEXT COLUMN ----------------- + ImGui::TableNextColumn(); // SHARPNESS ----------------------------- ImGui::SeparatorText("Sharpness"); if (bool overrideSharpness = Config::Instance()->OverrideSharpness.value_or(false); ImGui::Checkbox("Override", &overrideSharpness)) + { Config::Instance()->OverrideSharpness = overrideSharpness; + if (currentBackend == "dlss" && !Config::Instance()->CasEnabled.value_or(false)) + Config::Instance()->changeBackend = true; + } + ImGui::BeginDisabled(!Config::Instance()->OverrideSharpness.value_or(false)); float sharpness = Config::Instance()->Sharpness.value_or(0.3f); @@ -707,46 +843,6 @@ void Imgui_Base::RenderMenu() ImGui::EndDisabled(); - // MIPMAP BIAS ----------------------------- - ImGui::SeparatorText("Mipmap Bias (Dx12)"); - - ImGui::BeginDisabled(Config::Instance()->Api != NVNGX_DX12); - - if (Config::Instance()->MipmapBiasOverride.has_value() && mipBias == 0.0f) - mipBias = Config::Instance()->MipmapBiasOverride.value(); - - ImGui::SliderFloat("Mipmap Bias", &mipBias, -15.0f, 15.0f, "%.6f", ImGuiSliderFlags_NoRoundToFormat); - - ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "This will be applied after first resolution change!"); - - if (ImGui::Button("Set")) - Config::Instance()->MipmapBiasOverride = mipBias; - - ImGui::SameLine(0.0f, 6.0f); - - if (ImGui::Button("Reset")) - { - Config::Instance()->MipmapBiasOverride.reset(); - mipBias = 0.0f; - } - - ImGui::SameLine(0.0f, 6.0f); - - if (ImGui::Button("Calculate")) - { - showMipmapCalcWindow = true; - } - - ImGui::SameLine(0.0f, 6.0f); - - ImGui::Text("Current : %.6f", Config::Instance()->lastMipBias); - - ImGui::EndDisabled(); - - - ImGui::TableNextColumn(); - - // UPSCALE RATIO OVERRIDE ----------------- ImGui::SeparatorText("Upscale Ratio"); if (bool upOverride = Config::Instance()->UpscaleRatioOverrideEnabled.value_or(false); ImGui::Checkbox("Ratio Override", &upOverride)) @@ -774,23 +870,23 @@ void Imgui_Base::RenderMenu() float qUq = Config::Instance()->QualityRatio_UltraQuality.value_or(1.3f); if (ImGui::SliderFloat("Ultra Quality", &qUq, 1.0f, 3.0f, "%.3f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->QualityRatio_UltraQuality = qUq; + Config::Instance()->QualityRatio_UltraQuality = qUq; float qQ = Config::Instance()->QualityRatio_Quality.value_or(1.5f); if (ImGui::SliderFloat("Quality", &qQ, 1.0f, 3.0f, "%.3f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->QualityRatio_Quality = qQ; + Config::Instance()->QualityRatio_Quality = qQ; float qB = Config::Instance()->QualityRatio_Balanced.value_or(1.7f); if (ImGui::SliderFloat("Balanced", &qB, 1.0f, 3.0f, "%.3f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->QualityRatio_Balanced = qB; + Config::Instance()->QualityRatio_Balanced = qB; float qP = Config::Instance()->QualityRatio_Performance.value_or(2.0f); if (ImGui::SliderFloat("Performance", &qP, 1.0f, 3.0f, "%.3f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->QualityRatio_Performance = qP; + Config::Instance()->QualityRatio_Performance = qP; float qUp = Config::Instance()->QualityRatio_UltraPerformance.value_or(3.0f); if (ImGui::SliderFloat("Ultra Performance", &qUp, 1.0f, 3.0f, "%.3f", ImGuiSliderFlags_NoRoundToFormat)) - Config::Instance()->QualityRatio_UltraPerformance = qUp; + Config::Instance()->QualityRatio_UltraPerformance = qUp; ImGui::EndDisabled(); @@ -843,33 +939,6 @@ void Imgui_Base::RenderMenu() ImGui::EndTable(); } - // BARRIERS ----------------------------- - ImGui::SeparatorText("Resource Barriers (Dx12)"); - ImGui::BeginDisabled(Config::Instance()->Api != NVNGX_DX12); - - AddResourceBarrier("Color", &Config::Instance()->ColorResourceBarrier); - AddResourceBarrier("Depth", &Config::Instance()->DepthResourceBarrier); - AddResourceBarrier("Motion", &Config::Instance()->MVResourceBarrier); - AddResourceBarrier("Exposure", &Config::Instance()->ExposureResourceBarrier); - AddResourceBarrier("Mask", &Config::Instance()->MaskResourceBarrier); - AddResourceBarrier("Output", &Config::Instance()->OutputResourceBarrier); - - ImGui::EndDisabled(); - - // HOTFIXES ----------------------------- - ImGui::SeparatorText("Hotfixes (Dx12)"); - - ImGui::BeginDisabled(Config::Instance()->Api != NVNGX_DX12); - - if (bool crs = Config::Instance()->RestoreComputeSignature.value_or(false); ImGui::Checkbox("Restore Compute RS", &crs)) - Config::Instance()->RestoreComputeSignature = crs; - - ImGui::SameLine(0.0f, 6.0f); - if (bool grs = Config::Instance()->RestoreGraphicSignature.value_or(false); ImGui::Checkbox("Restore Graphic RS", &grs)) - Config::Instance()->RestoreGraphicSignature = grs; - - ImGui::EndDisabled(); - // LOGGING ----------------------------- ImGui::SeparatorText("Logging"); @@ -926,11 +995,11 @@ void Imgui_Base::RenderMenu() ImGui::SameLine(0.0f, 4.0f); - ImGui::Text("%.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); + ImGui::Text("%.3f ms/frame (%.1f FPS) %d", 1000.0f / io.Framerate, io.Framerate, Config::Instance()->CurrentFeature->FrameCount()); ImGui::SameLine(0.0f, 10.0f); - ImGui::PushItemWidth(90.0); + ImGui::PushItemWidth(45.0f * imguiRatio); const char* uiScales[] = { "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2.0" }; const char* selectedScaleName = uiScales[selectedScale]; @@ -952,7 +1021,7 @@ void Imgui_Base::RenderMenu() ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, 20.0f); + ImGui::SameLine(0.0f, 15.0f); if (ImGui::Button("Save INI")) Config::Instance()->SaveIni(); diff --git a/nvngx.ini b/nvngx.ini index 87f41df0..6b4c638e 100644 --- a/nvngx.ini +++ b/nvngx.ini @@ -16,14 +16,14 @@ VulkanUpscaler=auto SuperSamplingEnabled=auto ; Pseudo-supersampling ratio -; 1.0 - 3.0 - Default (auto) is 1.5 +; 0.5 - 3.0 - Default (auto) is 1.5 SuperSamplingMultiplier=auto [Dx11withDx12] ; Syncing meathods for Dx11 with Dx12 ; ; Valid values are; -; 0 - No syncing (fastest, most prone to errors) +; 0 - No syncing (fastest, most prone to errors) ; 1 - Fence ; 2 - Fences + Flush ; 3 - Fences + Event @@ -81,6 +81,20 @@ HorizontalFov=auto ; Default (auto) is path defined in registry LibraryPath=auto +; Set this to true to enable custom render preset overrides +; true or false - Default (auto) is false +RenderPresetOverride=auto + +; Render presets for quality settings +; 0 = Default / 1 = A / 2 = B / 3 = C / 4 = D / 5 = E / 6 = F / 7 = G +; Default (auto) is 0 +RenderPresetDLAA=auto +RenderPresetUltraQuality=auto +RenderPresetQuality=auto +RenderPresetBalanced=auto +RenderPresetPerformance=auto +RenderPresetUltraPerformance=auto + [Menu] ; In-game ImGui menu scale ; 1.0 to 2.0 - Default (auto) is 1.0 @@ -178,11 +192,13 @@ QualityRatioOverrideEnabled=auto ; Set custom upscaling ratio for each quality mode ; ; Default (auto) values: +; DLAA : 1.0 ; Ultra Quality : 1.3 ; Quality : 1.5 ; Balanced : 1.7 ; Performance : 2.0 ; Ultra Performance : 3.0 +QualityRatioDLAA=auto QualityRatioUltraQuality=auto QualityRatioQuality=auto QualityRatioBalanced=auto