From 1181b5d9050676b0d013631c3d2fa30524b6effb Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 22 Oct 2024 23:40:20 +0300 Subject: [PATCH] Force Vulkan when Wine is detected. --- UnleashedRecomp/gpu/video.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 27aee23..85db978 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -556,6 +556,12 @@ static std::unique_ptr g_resolveMsaaDepthPipelines[3]; "main", \ g_vulkan ? RenderShaderFormat::SPIRV : RenderShaderFormat::DXIL) +static bool DetectWine() +{ + HMODULE dllHandle = GetModuleHandle("ntdll.dll"); + return dllHandle != nullptr && GetProcAddress(dllHandle, "wine_get_version") != nullptr; +} + static void CreateHostDevice() { for (uint32_t i = 0; i < 16; i++) @@ -563,7 +569,7 @@ static void CreateHostDevice() Window::Init(); - g_vulkan = Config::GraphicsAPI == EGraphicsAPI::Vulkan; + g_vulkan = DetectWine() || Config::GraphicsAPI == EGraphicsAPI::Vulkan; LoadShaderCache();