From fa04337654f51449557aeff00b51b28c7823a787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Jun 2025 21:24:31 +0200 Subject: [PATCH] On Windows 11, start defaulting to Vulkan. --- Common/OSVersion.cpp | 4 ++++ Common/OSVersion.h | 1 + Core/Config.cpp | 6 +++++- Windows/GPU/D3D11Context.cpp | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Common/OSVersion.cpp b/Common/OSVersion.cpp index a69b8217c7..49b653787d 100644 --- a/Common/OSVersion.cpp +++ b/Common/OSVersion.cpp @@ -109,6 +109,10 @@ bool IsWin8OrHigher() { return DoesVersionMatchWindows(6, 2, 0, 0, 0, true); } +bool IsWin11OrHigher() { + return DoesVersionMatchWindows(10, 0, 0, 0, 22000, true); +} + std::string GetWindowsVersion() { std::vector> windowsReleases = { /* { "Preview text", { major, minor, spMajor, spMinor, build, greater } }, */ diff --git a/Common/OSVersion.h b/Common/OSVersion.h index 06eb7c54d4..10d7255e12 100644 --- a/Common/OSVersion.h +++ b/Common/OSVersion.h @@ -8,6 +8,7 @@ bool IsVistaOrHigher(); bool IsWin7OrHigher(); bool IsWin8OrHigher(); +bool IsWin11OrHigher(); bool DoesVersionMatchWindows(uint32_t major, uint32_t minor, uint32_t spMajor, uint32_t spMinor, uint32_t build, bool acceptGreater); bool GetVersionFromKernel32(uint32_t& major, uint32_t& minor, uint32_t& build); diff --git a/Core/Config.cpp b/Core/Config.cpp index b740e73646..6efbc8294d 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -456,7 +456,11 @@ static int DefaultGPUBackend() { } #if PPSSPP_PLATFORM(WINDOWS) - // If no Vulkan, use Direct3D 11 on Windows 8+ (most importantly 10.) + // On Win11, there's a good chance Vulkan will work by default. + if (IsWin11OrHigher()) { + return (int)GPUBackend::VULKAN; + } + // On older Windows, to be safe, use Direct3D 11. if (IsWin8OrHigher()) { return (int)GPUBackend::DIRECT3D11; } diff --git a/Windows/GPU/D3D11Context.cpp b/Windows/GPU/D3D11Context.cpp index 04d8c668dd..f1bd509bd1 100644 --- a/Windows/GPU/D3D11Context.cpp +++ b/Windows/GPU/D3D11Context.cpp @@ -264,6 +264,7 @@ void D3D11Context::Shutdown() { // Important that we release before we unload the DLL, otherwise we may crash on shutdown. bbRenderTargetTex_ = nullptr; bbRenderTargetView_ = nullptr; + swapChain_ = nullptr; context1_ = nullptr; context_ = nullptr; device1_ = nullptr;