Skip to content
Permalink
Browse files
Merge pull request #9962 from OatmealDome/macos-vulkan-default
VideoBackendBase: Prefer Vulkan over OGL on macOS Mojave and newer
  • Loading branch information
leoetlino committed Aug 2, 2021
2 parents 8a078ea + 46e331d commit 35bf5e3
Showing 1 changed file with 16 additions and 1 deletion.
@@ -214,6 +214,10 @@ const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvail
std::vector<std::unique_ptr<VideoBackendBase>> backends;

// OGL > D3D11 > D3D12 > Vulkan > SW > Null
//
// On macOS Mojave and newer, we prefer Vulkan over OGL due to outdated drivers.
// However, on macOS High Sierra and older, we still prefer OGL due to its older Metal version
// missing several features required by the Vulkan backend.
#ifdef HAS_OPENGL
backends.push_back(std::make_unique<OGL::VideoBackend>());
#endif
@@ -222,7 +226,18 @@ const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvail
backends.push_back(std::make_unique<DX12::VideoBackend>());
#endif
#ifdef HAS_VULKAN
backends.push_back(std::make_unique<Vulkan::VideoBackend>());
#ifdef __APPLE__
// If we can run the Vulkan backend, emplace it at the beginning of the vector so
// it takes precedence over OpenGL.
if (__builtin_available(macOS 10.14, *))
{
backends.emplace(backends.begin(), std::make_unique<Vulkan::VideoBackend>());
}
else
#endif
{
backends.push_back(std::make_unique<Vulkan::VideoBackend>());
}
#endif
#ifdef HAS_OPENGL
backends.push_back(std::make_unique<SW::VideoSoftware>());

0 comments on commit 35bf5e3

Please sign in to comment.