Live long and prosper —

Vulkan is coming to macOS and iOS, but no thanks to Apple

Early signs are that performance is much better than Apple's awful OpenGL stack.

Vulkan is coming to macOS and iOS, but no thanks to Apple

Vulkan—the open, cross-platform GPU API from the Khronos Group, the industry body that also develops OpenGL—is available on Windows, Linux, Android, the Nintendo Switch, and cloud systems, but it has one sizeable gap: none of Apple's platforms support it. macOS has old, and slow, OpenGL drivers, and iOS supports OpenGL ES, the OpenGL subset designed for embedded systems. Apple has thus far shown no interest in offering the modern Vulkan API and instead has pushed its own proprietary API, Metal.

Today, that gap is being substantially filled, with the open source, royalty-free release of MoltenVK—a runtime for macOS and iOS that offers an almost complete subset of the Vulkan API implemented using Metal. Released under the Apache 2 license, MoltenVK will enable developers to build their Vulkan applications for Apple's platforms, allowing for a single codebase to span Windows, Linux, Android, macOS, iOS, and more.

<em>Dota 2</em> using Vulkan-on-Metal, compared to <em>Dota 2</em> on Apple's OpenGL drivers.
Enlarge / Dota 2 using Vulkan-on-Metal, compared to Dota 2 on Apple's OpenGL drivers.
Khronos Group

Valve is an early adopter of MoltenVK. The company has been testing MoltenVK for the macOS version of Dota 2, and indications are extremely promising: the Vulkan-on-Metal version of the game has frame rates as much as 50 percent higher than the version using Apple's OpenGL stack. Apple's OpenGL drivers have long been criticized, both for their poor performance and for Apple's refusal to support the latest versions of the specification. The Dota 2 experience suggests that developers can reap big dividends by bypassing them.

The release is in response to demands from developers; they want a cross-platform API to maximize their reach but also need to be able to reach Apple's platforms. However, developers also told Khronos that they didn't want a fourth API to learn; rather, they hoped the company could repurpose some existing API to give them this reach. The identification of a universally portable subset of Vulkan, one that can be efficiently run on top of other GPU APIs, is the result.

MoltenVK has been designed as a very thin layer. It has been deliberately designed to not perform any significant remapping or conversion of data and function calls, ensuring that its performance is predictable and consistent, and its overheads are low. A handful of Vulkan features aren't available, but overall the portable subset is substantial.

The portable subset will also soon be able to target another platform: DirectX 12. Expected within the next few months, a similar translation layer is being developed that will enable Vulkan applications to use a DirectX 12 back-end. While Windows, unlike macOS, does have Vulkan drivers from GPU companies, applications sold through the Microsoft Store are only permitted to use DirectX. Already today, some Store applications use ANGLE—an implementation of OpenGL ES that runs on top of DirectX—so that their developers can use a cross-platform graphics API. The Vulkan layer will enable the same for software that uses the high performance, low-level GPU API.

Listing image by Memory Alpha

Channel Ars Technica