From 0f4633c590821365f71e68540d32300b85cc141d Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Mon, 9 Aug 2021 19:31:59 -0700 Subject: [PATCH] macOS: Default to Vulkan for rendering (#306) * Change macOS to default to Vulkan in 10.14+. This mirrors a change in mainline Dolphin, so should be relatively safe to do. Slippi's MoltenVK setup is a bit older than modern Dolphin's, but most users still see a jump in performance in comparison to Apple's broken OpenGL API. High Sierra remains defaulted to OpenGL, as Metal on that platform lacks critical pieces that Dolphin requires. --- Source/Core/VideoCommon/VideoBackendBase.cpp | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index e671b35af7..04cd9816a5 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -85,8 +85,26 @@ void VideoBackendBase::PopulateList() // disable OGL video Backend while is merged from master g_available_video_backends.push_back(std::make_unique()); - if(PlatformSupportsVulkan()) { - g_available_video_backends.push_back(std::make_unique()); + // on macOS, we want to push users to use Vulkan on 10.14+ (Mojave onwards). OpenGL has been + // long deprecated by Apple there and is a known stumbling block for performance for new players. + // + // That said, we still support High Sierra, which can't use Metal (it will load, but lacks certain critical pieces). + // + // This mirrors a recent (2021) change in mainline Dolphin, so should be relatively safe to do here as well. All + // we're doing is shoving Vulkan to the front if it's macOS 10.14 or later, so it loads first. + if(PlatformSupportsVulkan()) { +#ifdef __APPLE__ + if (__builtin_available(macOS 10.14, *)) { + g_available_video_backends.emplace( + g_available_video_backends.begin(), + std::make_unique() + ); + } + else +#endif + { + g_available_video_backends.push_back(std::make_unique()); + } } // Disable software video backend as is currently not working