Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildMacOSUniversalBinary: Bump minimum macOS to 10.14 #10714

Merged
merged 6 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion BuildMacOSUniversalBinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

# Minimum macOS version for each architecture slice
"arm64_mac_os_deployment_target": "11.0.0",
"x86_64_mac_os_deployment_target": "10.13.0",
"x86_64_mac_os_deployment_target": "10.14.0",

# CMake Generator to use for building
"generator": "Unix Makefiles",
Expand Down
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ endif()

# Minimum OS X version.
# This is inserted into the Info.plist as well.

# MacOS prior to 10.14 did not support aligned alloc which is used to implement
# std::unique_ptr in the arm64 C++ standard library. x86_64 builds can override
# this to 10.13.0 using -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13.0" without issue.
# This is done in the universal binary building script to build a binary that
# runs on 10.13 on x86_64 computers, while still containing an arm64 slice.

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14.0" CACHE STRING "")

set(CMAKE_USER_MAKE_RULES_OVERRIDE "CMake/FlagsOverride.cmake")
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please read the [FAQ](https://dolphin-emu.org/docs/faq/) before using Dolphin.
* OS
* Windows (10 or higher).
* Linux.
* macOS (10.13 High Sierra or higher).
* macOS (10.14 Mojave or higher).
* Unix-like systems other than Linux are not officially supported but might work.
* Processor
* A CPU with SSE2 support.
Expand Down
6 changes: 1 addition & 5 deletions Source/Core/Common/MemoryUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ void* AllocateExecutableMemory(size_t size)
#else
int map_flags = MAP_ANON | MAP_PRIVATE;
#if defined(__APPLE__)
// This check is in place to prepare for x86_64 MAP_JIT support. While MAP_JIT did exist
// prior to 10.14, it had restrictions on the number of JIT allocations that were removed
// in 10.14.
if (__builtin_available(macOS 10.14, *))
map_flags |= MAP_JIT;
map_flags |= MAP_JIT;
#endif
void* ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE | PROT_EXEC, map_flags, -1, 0);
if (ptr == MAP_FAILED)
Expand Down
35 changes: 0 additions & 35 deletions Source/Core/VideoBackends/Vulkan/VKMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,30 +280,6 @@ void VideoBackend::Shutdown()
UnloadVulkanLibrary();
}

#if defined(VK_USE_PLATFORM_METAL_EXT)
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;
}
#endif

void VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
{
#if defined(VK_USE_PLATFORM_METAL_EXT)
Expand Down Expand Up @@ -345,17 +321,6 @@ void VideoBackend::PrepareWindow(WindowSystemInfo& wsi)

// Store the layer pointer, that way MoltenVK doesn't call [NSView layer] outside the main thread.
wsi.render_surface = layer;

// 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())
{
PanicAlertFmtT(
"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+.");
}
#endif
}
} // namespace Vulkan
19 changes: 5 additions & 14 deletions Source/Core/VideoCommon/VideoBackendBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ 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.
// On macOS, we prefer Vulkan over OpenGL due to OpenGL support being deprecated by Apple.
#ifdef HAS_OPENGL
backends.push_back(std::make_unique<OGL::VideoBackend>());
#endif
Expand All @@ -228,17 +225,11 @@ const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvail
#endif
#ifdef HAS_VULKAN
#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
// Emplace the Vulkan backend at the beginning so it takes precedence over OpenGL.
backends.emplace(backends.begin(), std::make_unique<Vulkan::VideoBackend>());
#else
backends.push_back(std::make_unique<Vulkan::VideoBackend>());
#endif
{
backends.push_back(std::make_unique<Vulkan::VideoBackend>());
}
#endif
#ifdef HAS_OPENGL
backends.push_back(std::make_unique<SW::VideoSoftware>());
Expand Down