From 2e1a28e9c867776dddd64bed95e638dcac3da594 Mon Sep 17 00:00:00 2001 From: FakeMichau <49685661+FakeMichau@users.noreply.github.com> Date: Tue, 23 Jun 2026 22:31:56 +0200 Subject: [PATCH] Prevent amdxc64 leaking the d3d12 device --- OptiScaler/misc/IdentifyGpu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OptiScaler/misc/IdentifyGpu.cpp b/OptiScaler/misc/IdentifyGpu.cpp index 60399c83..9af479a7 100644 --- a/OptiScaler/misc/IdentifyGpu.cpp +++ b/OptiScaler/misc/IdentifyGpu.cpp @@ -471,7 +471,6 @@ void IdentifyGpu::updateD3d12Capabilities(D3d12Proxy::PFN_D3D12CreateDevice o_D3 if (moduleAmdxc64 == nullptr) continue; - ComPtr amdExtD3DFactory = nullptr; auto AmdExtD3DCreateInterface = (PFN_AmdExtD3DCreateInterface) KernelBaseProxy::GetProcAddress_()( moduleAmdxc64, "AmdExtD3DCreateInterface"); @@ -481,9 +480,10 @@ void IdentifyGpu::updateD3d12Capabilities(D3d12Proxy::PFN_D3D12CreateDevice o_D3 if (localDevice && (State::Instance().isRunningOnLinux || !res.usesVkd3dProton) && AmdExtD3DCreateInterface) { + ComPtr amdExtD3DFactory; if (SUCCEEDED(AmdExtD3DCreateInterface(localDevice.Get(), IID_PPV_ARGS(&amdExtD3DFactory)))) { - ComPtr amdExtD3DShaderIntrinsics = nullptr; + ComPtr amdExtD3DShaderIntrinsics; if (amdExtD3DFactory && SUCCEEDED(amdExtD3DFactory->CreateInterface( @@ -495,6 +495,9 @@ void IdentifyGpu::updateD3d12Capabilities(D3d12Proxy::PFN_D3D12CreateDevice o_D3 if (float8support == S_OK) res.realFsr4Support = FSR4Support::FP8; } + + // Prevent amdxc64 leaking the d3d12 device + localDevice->Release(); } } }