MoltenVK brings Vulkan to macOS

By

Before talking about MoltenVK, we need to come back to Vulkan. Vulkan is a great graphics API, aimed at improving over OpenGL by providing more closer control over the hardware, similar to Metal and DirectX12. It had a little problem, namely adoption. Apple did not support Vulkan in any way, instead recommending developers for macOS and iOS devices to use Metal, their home-made API. For games developers, this meant they would have to support potentially three different API moving forward, instead of just OpenGL: DirectX12 for Windows/Xbox, Vulkan for Linux/Android and other platforms, and Metal for macOS/iOS. This is where MoltenVK, from Brenwill Workshop, comes in.

MoltenVK implements the Vulkan API on top of Metal. This makes it possible to execute pure Vulkan code on Apple devices in a transparent manner. MoltenVK already existed, but the big news is that on the 26th of February, it was made open-source (Apache 2 License) thanks to Valve’s support. And since demos speak louder than words, this is Dota2, using Vulkan, running on macOS through MoltenVK:

The framerate is much better using Vulkan - not that OpenGL is inefficient per se, but macOS’ support of OpenGL was stuck in 4.1 version, making the latest extensions unavailable for the platform.

Moltenvk performance on Mac vs OpenGL

At the same time, LunarG’s SDK for Vulkan does now integrate MoltenVK and can be used to target Apple platforms as well. Valve’s aim is pretty clear from their press release:

By making the code to MoltenVK freely available and open-source, the goal is to enable developers to bring their games to macOS and iOS with minimal development cost.

So this should help spread the use of Vulkan across platforms, since you could now potentially write a Vulkan renderer that would run on Windows, Mac and Linux. Of course that’s not all it requires to make games portable, yet this is major progress in that direction - and who knows, this may benefit Linux gamers in the end if more ports can be developed in this way.

Note that the Molten initiative does not stop at Vulkan. There is also MoltenGL, from the same folks (however not open source), to provide OpenGL ES 2.0 support to macOS while the macOS stack does not support it originally. There are also rumors of a DirectX12 version of Molten, to implement Vulkan on top of DirectX12. It is of dubious usefulness for Windows itself, but there are two specific use cases where it would matter:

  • Games in Windows store that force applications to use DX12 and only DX12.
  • Xbox, where DirectX12 is the only API available.

In the meantime, I will be particularly interested to see what Feral and other porting companies that target both Mac and Linux platforms make of this piece of news.