From a2abd81ebcdd0956e632b5f51e40b46dd59aa22a Mon Sep 17 00:00:00 2001 From: cdozdil Date: Wed, 10 Apr 2024 22:05:22 +0300 Subject: [PATCH] changed version info format --- CyberXeSS/backends/IFeature.h | 9 ++++++++- CyberXeSS/backends/fsr2/FSR2Feature.h | 3 ++- CyberXeSS/backends/fsr2_212/FSR2Feature_212.h | 3 ++- CyberXeSS/backends/xess/XeSSFeature.h | 5 +++-- CyberXeSS/backends/xess/XeSSFeature_Dx12.cpp | 4 +++- CyberXeSS/imgui/Imgui_Dx11.cpp | 4 ---- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CyberXeSS/backends/IFeature.h b/CyberXeSS/backends/IFeature.h index d3b24ef8..a3f2184f 100644 --- a/CyberXeSS/backends/IFeature.h +++ b/CyberXeSS/backends/IFeature.h @@ -39,6 +39,13 @@ protected: virtual void SetInit(bool InValue) { _isInited = InValue; } public: + typedef struct _feature_version + { + unsigned int major; + unsigned int minor; + unsigned int patch; + } feature_version; + NVSDK_NGX_Handle* Handle() const { return _handle; }; static unsigned int GetNextHandleId() { return handleCounter++; } @@ -61,7 +68,7 @@ public: bool HasExposure() const { return _hasExposure; } bool HasOutput() const { return _hasOutput; } int InitFlags() const { return _initFlags; } - virtual const char* Version() = 0; + virtual feature_version Version() = 0; virtual const char* Name() = 0; IFeature(unsigned int InHandleId, const NVSDK_NGX_Parameter* InParameters) diff --git a/CyberXeSS/backends/fsr2/FSR2Feature.h b/CyberXeSS/backends/fsr2/FSR2Feature.h index f6232b3e..c3a9131a 100644 --- a/CyberXeSS/backends/fsr2/FSR2Feature.h +++ b/CyberXeSS/backends/fsr2/FSR2Feature.h @@ -47,6 +47,7 @@ private: bool _depthInverted = false; unsigned int _lastWidth = 0; unsigned int _lastHeight = 0; + static inline feature_version _version{ 2, 2, 1 }; protected: FfxFsr2Context _context = {}; @@ -60,7 +61,7 @@ protected: public: bool IsDepthInverted() const; - const char* Version() final { return "2.2.1"; } + feature_version Version() final { return _version; } const char* Name() final { return "FSR"; } FSR2Feature(unsigned int InHandleId, const NVSDK_NGX_Parameter* InParameters) : IFeature(InHandleId, InParameters) diff --git a/CyberXeSS/backends/fsr2_212/FSR2Feature_212.h b/CyberXeSS/backends/fsr2_212/FSR2Feature_212.h index 349abe67..e4e0f3a6 100644 --- a/CyberXeSS/backends/fsr2_212/FSR2Feature_212.h +++ b/CyberXeSS/backends/fsr2_212/FSR2Feature_212.h @@ -34,6 +34,7 @@ private: bool _depthInverted = false; unsigned int _lastWidth = 0; unsigned int _lastHeight = 0; + static inline feature_version _version{ 2, 1, 2 }; protected: Fsr212::FfxFsr2Context _context = {}; @@ -47,7 +48,7 @@ protected: public: bool IsDepthInverted() const; - const char* Version() final { return "2.1.2"; } + feature_version Version() final { return _version; } const char* Name() final { return "FSR"; } FSR2Feature212(unsigned int InHandleId, const NVSDK_NGX_Parameter* InParameters) : IFeature(InHandleId, InParameters) diff --git a/CyberXeSS/backends/xess/XeSSFeature.h b/CyberXeSS/backends/xess/XeSSFeature.h index a1196a78..8af73fff 100644 --- a/CyberXeSS/backends/xess/XeSSFeature.h +++ b/CyberXeSS/backends/xess/XeSSFeature.h @@ -34,6 +34,7 @@ class XeSSFeature : public virtual IFeature { private: std::string _version = "1.3.0"; + xess_version_t _xessVersion{}; protected: xess_context_handle_t _xessContext = nullptr; @@ -43,10 +44,10 @@ protected: bool InitXeSS(ID3D12Device* device, const NVSDK_NGX_Parameter* InParameters); float GetSharpness(const NVSDK_NGX_Parameter* InParameters); bool CreateBufferResource(ID3D12Device* InDevice, ID3D12Resource* InSource, ID3D12Resource** OutDest, D3D12_RESOURCE_STATES InDestState); - const char* Version() final { return _version.c_str(); } - const char* Name() final { return "XeSS"; } public: + feature_version Version() final { return feature_version{ _xessVersion.major, _xessVersion.minor, _xessVersion.patch }; } + const char* Name() final { return "XeSS"; } XeSSFeature(unsigned int handleId, const NVSDK_NGX_Parameter* InParameters) : IFeature(handleId, InParameters) { diff --git a/CyberXeSS/backends/xess/XeSSFeature_Dx12.cpp b/CyberXeSS/backends/xess/XeSSFeature_Dx12.cpp index b88a3b5e..e2d37df1 100644 --- a/CyberXeSS/backends/xess/XeSSFeature_Dx12.cpp +++ b/CyberXeSS/backends/xess/XeSSFeature_Dx12.cpp @@ -82,9 +82,11 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const N auto sharpness = GetSharpness(InParameters); + float ssMulti = Version().major >= 1 && Version().minor >= 3 ? Config::Instance()->SuperSamplingMultiplier.value_or(3.0f) : Config::Instance()->SuperSamplingMultiplier.value_or(2.5f); + bool useSS = Config::Instance()->SuperSamplingEnabled.value_or(false) && !Config::Instance()->DisplayResolution.value_or(false) && - ((float)DisplayWidth() / (float)params.inputWidth) < Config::Instance()->SuperSamplingMultiplier.value_or(3.0f); + ((float)DisplayWidth() / (float)params.inputWidth) < ssMulti; spdlog::debug("XeSSFeatureDx12::Evaluate Input Resolution: {0}x{1}", params.inputWidth, params.inputHeight); diff --git a/CyberXeSS/imgui/Imgui_Dx11.cpp b/CyberXeSS/imgui/Imgui_Dx11.cpp index c2d71dbe..d247f02a 100644 --- a/CyberXeSS/imgui/Imgui_Dx11.cpp +++ b/CyberXeSS/imgui/Imgui_Dx11.cpp @@ -119,10 +119,7 @@ Imgui_Dx11::~Imgui_Dx11() if (!_dx11Init) return; - spdlog::debug("Imgui_Dx11::~Imgui_Dx11"); - ImGui::SetCurrentContext(context); - spdlog::trace("Imgui_Dx11::~Imgui_Dx11 sleeping before ImGui_ImplDX11_Shutdown for 250ms"); std::this_thread::sleep_for(std::chrono::milliseconds(250)); ImGui_ImplDX11_Shutdown(); @@ -131,7 +128,6 @@ Imgui_Dx11::~Imgui_Dx11() ImGui::SetCurrentContext(currCtx); // hackzor - spdlog::trace("Imgui_Dx11::~Imgui_Dx11 sleeping after ImGui_ImplDX11_Shutdown for 250ms"); std::this_thread::sleep_for(std::chrono::milliseconds(250)); if (_renderTargetTexture)