Fix Windows numeric NGX feature discovery and quick-test launches
This commit is contained in:
1 parent
21ed0a8c88
commit
17121ccbf6
22 files changed
+473
-44
No files matched your search
@@ -0,0 +1,34 @@
|
||||
diff --git a/OptiScaler/hooks/D3D12_Hooks.cpp b/OptiScaler/hooks/D3D12_Hooks.cpp
|
||||
index 3b757be..05fc194 100644
|
||||
--- a/OptiScaler/hooks/D3D12_Hooks.cpp
|
||||
+++ b/OptiScaler/hooks/D3D12_Hooks.cpp
|
||||
@@ -2217,11 +2217,20 @@ static HRESULT hkD3D12GetInterface(REFCLSID rclsid, REFIID riid, void** ppvDebug
|
||||
return result;
|
||||
}
|
||||
|
||||
+// Device discovery and NGX initialization can overlap. Installing d4r's
|
||||
+// command hooks can also create a device and re-enter this function. Never
|
||||
+// overwrite live Detours trampolines from a second installation attempt.
|
||||
+static std::recursive_mutex deviceHookMutex;
|
||||
+static bool deviceHookInstalling = false;
|
||||
static void HookToDevice(ID3D12Device* InDevice)
|
||||
{
|
||||
- if (o_CreateSampler != nullptr || InDevice == nullptr)
|
||||
+ std::lock_guard<std::recursive_mutex> lock(deviceHookMutex);
|
||||
+ if (o_CreateSampler != nullptr || InDevice == nullptr || deviceHookInstalling)
|
||||
return;
|
||||
|
||||
+ deviceHookInstalling = true;
|
||||
+ struct InstallationGuard { ~InstallationGuard() { deviceHookInstalling = false; } } installationGuard;
|
||||
+
|
||||
LOG_DEBUG("Dx12");
|
||||
|
||||
// Get the vtable pointer
|
||||
@@ -2334,6 +2343,7 @@ static void HookToDevice(ID3D12Device* InDevice)
|
||||
|
||||
static void UnhookDevice()
|
||||
{
|
||||
+ std::lock_guard<std::recursive_mutex> lock(deviceHookMutex);
|
||||
LOG_FUNC();
|
||||
|
||||
DetourTransactionBegin();
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp
|
||||
index 1f723f1..ef5ec77 100644
|
||||
--- a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp
|
||||
+++ b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp
|
||||
@@ -184,6 +184,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApp
|
||||
|
||||
if (result == NVSDK_NGX_Result_Success)
|
||||
NVNGXProxy::SetDx12Inited(true);
|
||||
+ else if (State::Instance().dlssExternalBackend)
|
||||
+ return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -254,6 +256,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init(unsigned long long InApplica
|
||||
|
||||
if (result == NVSDK_NGX_Result_Success)
|
||||
NVNGXProxy::SetDx12Inited(true);
|
||||
+ else if (State::Instance().dlssExternalBackend)
|
||||
+ return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
# Explicit Windows d4r backend
|
||||
|
||||
Base: OptiScaler `45a2001303ddff632e279f77aef85ceede5832cb` (2026-09-30).
|
||||
|
||||
`0004` serializes D3D12 device hook installation/removal and guards recursive
|
||||
device discovery while the d4r command backend installs. The previous frontend
|
||||
can start two installations, fail a Detours transaction with `0x10dd`, clear
|
||||
live original-function pointers and call null. This was reproduced in the
|
||||
numeric-ID standalone harness; no game was required.
|
||||
|
||||
`0005` propagates numeric Init/Init_Ext failures for the explicitly selected
|
||||
external backend, matching the existing ProjectID behavior. FeatureNotFound
|
||||
must fail initialization instead of being hidden until repeated CreateFeature
|
||||
attempts. `Libraries.NvngxDlssPath` takes a directory, not the DLL filename;
|
||||
the Windows installer and standalone runner now use that directory.
|
||||
The modifications to OptiScaler are GPL-3.0, matching its upstream license.
|
||||
No NVIDIA DLL is supplied or patched.
|
||||
|
||||
|
||||
Reference in new issue
Block a user