Bringing Vulkan to Apple's Platforms: Khronos Group Announces Open Source MoltenVK 1.0 & SDKs
by Nate Oh on February 26, 2018 9:01 AM ESTOne of the unfortunate outcomes of Apple's desire to build their own top-to-bottom software ecosystems is that the company has gradually pulled away from supporting common APIs, particularly in graphics. Whereas early this decade Apple happily supported OpenGL ES up to 3.0, that's as far as the company ever went, skipping future OpenGL ES versions and OpenGL's successor, Vulkan. Instead Apple has relied on their own similar low-level API, Metal. As a result the widespread ability to use a single graphics API and target everything from PCs to Macs to smartphones has gradually been lost as old software and APIs grow stale.
Lost, perhaps, but as it turns out, not forgotten. Today, the Khronos Group, the industry consortium behind OpenGL and Vulkan, is announcing a wide-range of open-source tools, SDKs, and runtime library releases as part of their ongoing Vulkan Portability Initiative. The goal? To bring Vulkan applications to Apple platforms using Metal.
In collaboration with Valve, LunarG, and The Brenwill Workshop, this free open-source collection includes the full 1.0 release of the previously-commercial MoltenVK, a library for translating Vulkan API calls to Apple’s Metal 1 and 2 calls, as well LunarG’s new Vulkan SDK for macOS. Funding the costs of open-sourcing, Valve has been utilizing these tools on their applications, noting performance gains over native OpenGL drivers with Vulkan DOTA 2 on macOS as a production-load example.
Altogether, this forms the next step in Khronos’ Vulkan Portability Initiative, which was first announced at GDC 2017 as their “3D Portability Initiative,” and later refined as the “Vulkan Portability Initiative” last summer. Spurred by industry demand, Khronos is striving for a cross-platform API portability solution, where an appropriate subset of Vulkan can act as a ‘meta-API’-esque layer to map to DirectX 12 and Metal; the holy grail being that developers can craft a single Vulkan portable application or engine that can be seamlessly deployed across Vulkan, DX12, and Metal supporting platforms.
For the new generation of low-level low-overhead graphics APIs, the similar API philosophies makes this kind of mapping very feasible, particularly since Vulkan was designed with cross-vendor and cross-platform versatility in mind. Furthermore, both DX12 and glNext/Vulkan have been strongly influenced by AMD’s Mantle, which was donated wholesale to Khronos to form the modern foundation of Vulkan 1.0. The obstacle Khronos is tackling today is Apple’s Metal API, particularly as Apple continues with Metal development rather than adopting Vulkan and OpenGL ES 3.1+.
In accomplishing that, Khronos outlines several major parts: LunarG’s Vulkan macOS SDK and The Brenwill Workshop’s MoltenVK macOS/iOS runtime, as well as the open-source 'SPIRV-Cross' cross-compiler that MoltenVK utilizes. The open source LunarG Vulkan SDK unsurprisingly will allow developers to build, run and debug Vulkan applications on macOS platforms, including a number of loader and validation layers for API code.
Moving on, in short, SPIR-V is Khronos's existing common intermediate representation shader language, which the cross-compiler tool can in turn translate to a platform's native format, such as Metal Shading Language. And while MoltenVK 0.19 has existed as a paid product, Khronos noted that the fees and royalties did create a barrier to entry. On that front, Valve has been very eager to push Vulkan on macOS, and with their financial support MoltenVK has been open-sourced as the current full 1.0 release under the Apache 2.0 license, where it is free to use without development fees or royalties.
Khronos relayed that Valve very much intends MoltenVK to be a production-ready tool, and had Valve’s Vulkan DOTA 2 on macOS results at the ready, citing up to 50% faster framerates compared to native OpenGL. In any case, Khronos noted that the tools and SDKs were not specifically optimized for gaming applications, and applicable to browsers and other applications. And while there is technically an intermediate layer, Khronos stated that there are insignificant amounts of overhead, particularly in light of how Vulkan API calls are directly mapped to other low-level APIs.
Looking at Metal and DX12, almost all of Vulkan’s features are supported. The total unsupported operations add up to five general items, corresponding to around 20 function calls. In this way, Vulkan can be used as a portable subset, where different hardware and OS’ may support some of these exceptions. For the various generations of Apple platforms, the Metal 2 successor may enable yet more of those features; Apple’s relationship with Vulkan has not changed but the new Vulkan Portability tools are such that no support from Apple is needed. In the next few months, Khronos plans to publish final Vulkan portable subset definitions, working with AMD, NVIDIA, Unity, Mozilla, and others.
In the same vein, tentatively before the second half of the year Khronos and their collaborators are also planning to release tailored open-source conformance test layers, where only the features supported by a platform’s given Vulkan portable subset is tested. In addition, Khronos is looking to release simulation layers to flag the specific defined features not present in a given target system, along with various other enhanced SDK layers and tools. In general, any other SDK layers currently available under Windows are likely to be ported over to macOS at some point.
Moving forward, Khronos expects to continue releasing new portability tools, but additionally identified the current discussion over WebGL’s future and next-gen API possibilities as an avenue. Khronos also intends to continue widening platform support, noting development of the Rust-based gfx-rs for Vulkan portability, which remains in active development with the support of Mozilla and others.
The free and open source MoltenVK 1.0 can be found on the Khronos MoltenVK GitHub page, while the free macOS SDK is available through LunarXchange. Other tools can be found through Khronos’ Vulkan Portability resource page.
Source: Khronos Group
21 Comments
View All Comments
SydneyBlue120d - Monday, February 26, 2018 - link
I still remember Samsung testing a Vulkan UX two years ago, but it never make in production, and the same applies to all other smartphone makers :(https://www.androidcentral.com/samsung-testing-new...
tipoo - Monday, February 26, 2018 - link
Are all Android UIs going through OpenGL still then?SydneyBlue120d - Monday, February 26, 2018 - link
AFAIK Yes, no one is using Vulkan other than videogames. Correct me if I'm wrong.137ben - Wednesday, February 28, 2018 - link
Some Linux UIs now use Vulkan, since QT supports Vulkan and GTK will soon. I hope android catches up in that regard.tipoo - Monday, February 26, 2018 - link
The frustrating thing is still that going through a third party utility makes uptake potential on the Mac even less likely, as another niche within a niche. I really appreciate this effort, and the performance seems good, but Apple joining the rest of the world with native Vulkan support would go a further way to making more titles target it on the Mac.ET - Monday, February 26, 2018 - link
For most stuff, yes, it likely won't be used, but for games it should be pretty useful, both for better Vulkan adoption and for more games on the Mac.Krysto - Monday, February 26, 2018 - link
It's a shame they had to do this just so Vulkan can also be used on macOS/iOS, because Apple refused to support Vulkan directly.This move hurts everyone, including Apple, if iOS developers end-up adopting MoltenVK over Metal. They could have just adopted the "full" Vulkan and call it a day. Everyone would have been happy. But Apple had to be Apple.
id4andrei - Monday, February 26, 2018 - link
"if ios developers end-up adopting MoltenVK over Metal". Fat chance, ios devs will always use Apple's exclusive APIs and if Apple ends up gluing ios apps to macos then it's game over for Vulkan on Macos.osxandwindows - Monday, February 26, 2018 - link
Pretty much.These developers (mostly mobile games) won't care for crossplatform support, since android usually is an afterthought for game developers on mobile.
See rockstar's grand theft auto for example.
osxandwindows - Monday, February 26, 2018 - link
By the time vulkan came out apple was already developing stuff like CoreML to depend on metal.I can't see them adopting something that they can't control to go in a specific direction.