Commit 3fe96b78 by Nicolas Capens Committed by Nicolas Capens

Target macOS 10.14 on ARM64 to enable C++17

The first devices with M1 'Apple Silicon' AArch64 processors were launched with macOS 11.0, so it's safe to increase the target OS beyond the 10.11 support level needed by Chrome. This helps enable C++17 by addressing the lack of aligned heap allocation support in previous macOS versions: third_party/marl/include/marl/pool.h:236:27: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.14 or newer src/Vulkan/VkPipeline.hpp:83:10: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.14 or newer C++17 invokes aligned new/delete because of our use of alignas(16) for types like sw::float4, which is used for member fields in sw::DrawCall::BatchData and vk::GraphicsState. While this could be addressed by using custom new/delete operators for these classes (and classes which in turn use them as members), misalignment is just a minor performance issue, so we can leave things as-is and work around it with a build flag (note 16-byte alignment is needed for some vectors accessed in Reactor code, but that's handled for those individual cases). Bug: b/174843857 Change-Id: Iaa40a3ac6aa7d12c088bf93a55803d8146bd289c Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52068Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Commit-Queue: Nicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com>
parent 9441aea1
...@@ -69,12 +69,15 @@ config("swiftshader_config") { ...@@ -69,12 +69,15 @@ config("swiftshader_config") {
"-fno-operator-names", "-fno-operator-names",
] ]
cflags_cc = [ "-std=c++17" ] cflags_cc = [ "-std=c++17" ]
# On macOS, some C++17 features used by LLVM require version 10.12. # On macOS for the ARM architecture, some C++17 features require version 10.14,
if (is_mac && supports_llvm) { # while Chrome must support 10.11 (El Capitan). However, the first 'Apple Silicon'
# devices launched with macOS 11.0 (Big Sur).
# TODO(b/174843857): Remove once Chrome demands macOS 10.14.
if (is_mac && current_cpu == "arm64") {
cflags += [ cflags += [
"-isysroot", "-isysroot",
rebase_path(sysroot, root_build_dir), rebase_path(sysroot, root_build_dir),
"-mmacosx-version-min=10.12.0", "-mmacosx-version-min=10.14.0",
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment