Skip to content
Browse files

Vulkan: Display a warning when using MoltenVK on HS and earlier

  • Loading branch information...
stenzek committed Jan 25, 2019
1 parent 0177c6c commit 3f1586dbce4e32153fa01fe0a23fde102c09cc6d
Showing with 34 additions and 0 deletions.
  1. +34 −0 Source/Core/VideoBackends/Vulkan/main.cpp
@@ -277,6 +277,30 @@ void VideoBackend::Shutdown()

static bool IsRunningOnMojaveOrHigher()
// id processInfo = [NSProcessInfo processInfo]
id processInfo = reinterpret_cast<id (*)(Class, SEL)>(objc_msgSend)(
objc_getClass("NSProcessInfo"), sel_getUid("processInfo"));
if (!processInfo)
return false;

struct OSVersion // NSOperatingSystemVersion
size_t major_version; // NSInteger majorVersion
size_t minor_version; // NSInteger minorVersion
size_t patch_version; // NSInteger patchVersion

// const bool meets_requirement = [processInfo isOperatingSystemAtLeastVersion:required_version];
constexpr OSVersion required_version = {10, 14, 0};
const bool meets_requirement = reinterpret_cast<bool (*)(id, SEL, OSVersion)>(objc_msgSend)(
processInfo, sel_getUid("isOperatingSystemAtLeastVersion:"), required_version);
return meets_requirement;

void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi)
@@ -315,6 +339,16 @@ void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi)
// layer.contentsScale = factor
reinterpret_cast<void (*)(id, SEL, double)>(objc_msgSend)(layer, sel_getUid("setContentsScale:"),
// The Metal version included with MacOS 10.13 and below does not support several features we
// require. Furthermore, the drivers seem to choke on our shaders (mainly Intel). So, we warn
// the user that this is an unsupported configuration, but permit them to continue.
if (!IsRunningOnMojaveOrHigher())
"You are attempting to use the Vulkan (Metal) backend on an unsupported operating system. "
"For all functionality to be enabled, you must use macOS 10.14 (Mojave) or newer. Please "
"do not report any issues encountered unless they also occur on 10.14+.");
} // namespace Vulkan

0 comments on commit 3f1586d

Please sign in to comment.
You can’t perform that action at this time.