One 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

Comments Locked

21 Comments

View All Comments

Log in

Don't have an account? Sign up now