From 212ce753933e237f873aa9ca7cb29ffc0fd95fd9 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Mon, 25 Nov 2024 01:42:47 +0300 Subject: [PATCH] more fixes --- OptiScaler/NVNGX_DLSS_Dx12.cpp | 5 ++--- OptiScaler/OptiScaler.vcxproj | 2 +- OptiScaler/XeSS_Proxy.h | 2 +- OptiScaler/hooks/HooksDx.cpp | 18 ++++++++---------- OptiScaler/resource.h | 2 +- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/OptiScaler/NVNGX_DLSS_Dx12.cpp b/OptiScaler/NVNGX_DLSS_Dx12.cpp index 19fb920f..9f4dacef 100644 --- a/OptiScaler/NVNGX_DLSS_Dx12.cpp +++ b/OptiScaler/NVNGX_DLSS_Dx12.cpp @@ -1566,9 +1566,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom { std::unique_lock lock(FrameGen_Dx12::ffxMutex); #endif - //Config::Instance()->dxgiSkipSpoofing = true; - retCode = FfxApiProxy::D3D12_Dispatch()(&FrameGen_Dx12::fgContext, &dfgPrepare.header); - //Config::Instance()->dxgiSkipSpoofing = false; + + retCode = FfxApiProxy::D3D12_Dispatch()(&FrameGen_Dx12::fgContext, &dfgPrepare.header); #ifdef USE_MUTEX_FOR_FFX } diff --git a/OptiScaler/OptiScaler.vcxproj b/OptiScaler/OptiScaler.vcxproj index 976ad651..8ccaafc4 100644 --- a/OptiScaler/OptiScaler.vcxproj +++ b/OptiScaler/OptiScaler.vcxproj @@ -82,7 +82,7 @@ $(SolutionDir)external\vulkan\include;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\FidelityFX-SDK\ffx-api\include\ffx_api;$(SolutionDir)external\simpleini;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\spdlog\include;$(SolutionDir)external\freetype;$(IncludePath) $(ProjectDir)fsr2\lib;$(ProjectDir)fsr2_212\lib;$(ProjectDir)fsr31\lib;$(ProjectDir)vulkan;$(ProjectDir)d3dx;$(ProjectDir)detours;$(SolutionDir)external\xess\lib;$(SolutionDir)external\freetype;$(LibraryPath) dxgi - D:\Folders\Games\Cyberpunk 2077\bin\x64\ + ..\..\..\Games\Steam\steamapps\common\DEAD RISING DELUXE REMASTER DEMO .\x64\Debug .dll diff --git a/OptiScaler/XeSS_Proxy.h b/OptiScaler/XeSS_Proxy.h index 3bf13dbf..c7d658a5 100644 --- a/OptiScaler/XeSS_Proxy.h +++ b/OptiScaler/XeSS_Proxy.h @@ -359,6 +359,7 @@ public: return _xessVersion; } + static PFN_xessD3D12CreateContext D3D12CreateContext() { return _xessD3D12CreateContext; } static PFN_xessD3D12BuildPipelines D3D12BuildPipelines() { return _xessD3D12BuildPipelines; } static PRN_xessD3D12Init D3D12Init() { return _xessD3D12Init; } @@ -384,6 +385,5 @@ public: static PFN_xessD3D12GetResourcesToDump xessD3D12GetResourcesToDump() { return _xessD3D12GetResourcesToDump; } static PFN_xessD3D12GetProfilingData xessD3D12GetProfilingData() { return _xessD3D12GetProfilingData; } - static PFN_xessSetContextParameterF xessSetContextParameterF() { return _xessSetContextParameterF; } }; \ No newline at end of file diff --git a/OptiScaler/hooks/HooksDx.cpp b/OptiScaler/hooks/HooksDx.cpp index 89ff9557..a792b7e4 100644 --- a/OptiScaler/hooks/HooksDx.cpp +++ b/OptiScaler/hooks/HooksDx.cpp @@ -658,9 +658,8 @@ static void GetHudless(ID3D12GraphicsCommandList* This) { std::unique_lock lock(FrameGen_Dx12::ffxMutex); #endif - //Config::Instance()->dxgiSkipSpoofing = true; + retCode = FfxApiProxy::D3D12_Dispatch()(&FrameGen_Dx12::fgContext, &dfgPrepare.header); - //Config::Instance()->dxgiSkipSpoofing = false; #ifdef USE_MUTEX_FOR_FFX } @@ -753,10 +752,9 @@ static void CaptureHudless(ID3D12GraphicsCommandList* cmdList, ResourceInfo* res if (Config::Instance()->FGCaptureResources) { - captureMutex.lock(); + std::unique_lock lock(captureMutex); fgCaptureList.insert(resource->buffer); Config::Instance()->FGCapturedResourceCount = fgCaptureList.size(); - captureMutex.unlock(); } GetHudless(cmdList); @@ -1785,21 +1783,17 @@ static void hkDispatch(ID3D12GraphicsCommandList* This, UINT ThreadGroupCountX, #ifdef USE_MUTEX_FOR_FFX static HRESULT hkFGPresent(void* This, UINT SyncInterval, UINT Flags) { - std::unique_lock lock(FrameGen_Dx12::ffxMutex); - auto fIndex = fgFrameIndex; - LOG_DEBUG("{}", fIndex); + LOG_DEBUG("fc: {}, fi: {}", frameCounter, fIndex); if (Config::Instance()->FGResetCapturedResources) { LOG_DEBUG("FGResetCapturedResources"); - - captureMutex.lock(); + std::unique_lock lock(captureMutex); fgCaptureList.clear(); Config::Instance()->FGCapturedResourceCount = 0; Config::Instance()->FGResetCapturedResources = false; - captureMutex.unlock(); } // Skip calculations etc @@ -1809,6 +1803,9 @@ static HRESULT hkFGPresent(void* This, UINT SyncInterval, UINT Flags) return o_FGSCPresent(This, SyncInterval, Flags); } + LOG_DEBUG("Waiting mutex"); + std::unique_lock lock(FrameGen_Dx12::ffxMutex); + // If dispatch still not called if (!fgDispatchCalled && Config::Instance()->FGHUDFix.value_or(false) && FrameGen_Dx12::fgIsActive && Config::Instance()->FGUseFGSwapChain.value_or(true) && Config::Instance()->OverlayMenu.value_or(true) && @@ -1821,6 +1818,7 @@ static HRESULT hkFGPresent(void* This, UINT SyncInterval, UINT Flags) } auto result = o_FGSCPresent(This, SyncInterval, Flags); + LOG_DEBUG("Result: {:X}", result); #ifdef USE_PRESENT_FOR_FT float msDelta = 0.0; diff --git a/OptiScaler/resource.h b/OptiScaler/resource.h index 1acc0144..e4ce4ac4 100644 --- a/OptiScaler/resource.h +++ b/OptiScaler/resource.h @@ -21,7 +21,7 @@ #define VER_MAJOR_VERSION 0 #define VER_MINOR_VERSION 7 #define VER_HOTFIX_VERSION 0 -#define VER_BUILD_NUMBER 68 +#define VER_BUILD_NUMBER 681 #define VER_PRE_RELEASE