From ac9ebdecbafa545c43a32fca964e2daeae1125be Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Sun, 25 Jan 2026 01:34:51 +0100 Subject: [PATCH] GS/DX12: Check if D3D12GetInterface is supported first. On older versions of Windows 10 (example 2019 LTSC) D3D12GetInterface may fail because it doesn't exist, in such case we can check if D3D12GetInterface exists first. --- pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index 5563eab7c2..40ec160bb5 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -193,11 +193,24 @@ void GSDevice12::LoadAgilitySDK() if (agility_loaded) return; - HRESULT hr; + // On older versions of Windows 10 (example 2019 LTSC) D3D12GetInterface may fail because it doesn't exist, + // in such case we can check if D3D12GetInterface exists first. + const HMODULE d3d12 = GetModuleHandleW(L"d3d12.dll"); + if (!d3d12) + return; + + using PFN_D3D12GetInterface = HRESULT(WINAPI*)(REFCLSID rclsid, REFIID riid, void** ppv); + auto pD3D12GetInterface = reinterpret_cast(GetProcAddress(d3d12, "D3D12GetInterface")); + if (!pD3D12GetInterface) + { + Console.Error("D3D12: Agility SDK configuration is not available"); + return; + } // See https://microsoft.github.io/DirectX-Specs/d3d/IndependentDevices.html ComPtr sdk_configuration; - hr = D3D12GetInterface(CLSID_D3D12SDKConfiguration, IID_PPV_ARGS(sdk_configuration.put())); + HRESULT hr; + hr = pD3D12GetInterface(CLSID_D3D12SDKConfiguration, IID_PPV_ARGS(sdk_configuration.put())); if (FAILED(hr)) { Console.Error("D3D12: Agility SDK configuration is not available");