News


Apple’s Metal API Comes to OS X Desktops

Apple’s Metal API Comes to OS X Desktops

At last year’s WWDC, Apple introduced their Metal API for iOS 8. A low-level graphics API, Metal was originally designed to bring the benefits of low-level graphics programming to Apple’s mobile operating system. And while we typically don’t think of mobile devices as being GPU-bound, in reality Apple has been packing some relatively powerful GPUs like GXA6850 with what are relatively speaking still fairly weak CPUs, which means Apple has ended up in a situation where they can be CPU-bottlenecked on draw calls.

Metal, despite being the 3rd such low-level API to be introduced, was the first to reach production status. Microsoft’s DirectX 12 is arguably not there yet (Windows 10 is still in testing), and Khronos’s Vulkan was still in its primordial Mantle form at this point in 2014. What this means is that out of all of the vendors, it’s arguably Apple who has the lead time advantage in low-level API development. Which is why for the last year we have been wondering if Metal would stay on iOS, or make the jump to OS X.

Yesterday we got our answer, with the announcement from Apple that Metal would be coming to OS X “10.11” El Capitan, and that it would be part of a larger investment into Metal for the company. Along with bringing Metal to OS X, Apple is going to be releasing new API kits that interface with Metal to simplify development, and internally Apple is now using Metal (when available) for parts of the desktop composition rendering chain. At this point it’s fair to say that Apple has gone all-in on Metal.

Consequently the fact that Metal is now over on OS X is not unexpected, but whether it has been planned for or not, it means that we now have 3 low-level APIs on the desktop as well as mobile. OS X’s Metal will be going head-to-head with Microsoft’s DirectX 12 and Khronos’s Vulkan, and this is the first time in a very long that we have seen a viable and competitive 3rd graphics API on the desktop, as DirectX and OpenGL have been the reigning APIs since the turn of the millennium.


Metal's Introduction At WWDC 2014 (Image Courtesy Apple Insider)

As for what this means for Mac users, in the short run it’s a good thing. With Vulkan still in development, had Apple not implemented Metal on OS X, OS X would have needed to stick with classic OpenGL for another year until OS X 10.12. Going with their own API, as was the case with mobile, gets a low-level API on OS X sooner. Furthermore because it’s been on iOS for the last year, Apple gets to leverage all of the developer experience and code already written for Metal, and bring that over to OS X. Which is why developers like Epic are able to show off engines using Metal on OS X so early.

In the long run however there are some big unknowns left to answer, which could have a big impact on how things play out. Apple has not yet released the complete documentation for the newest version of Metal – specifically, we don’t have feature lists – so how the Mac and iOS versions compare feature-wise remains to be seen. My biggest concern here is that Apple will put OS X and iOS at parity, essentially limiting the features available to the lowest common denominator of iOS, leading to Macs in general being behind the curve in graphics features. The other big question is whether Apple will support Vulkan next year once it’s done, or whether they will stick with Metal, essentially turning OS X’s graphics stack proprietary. Which for users could lead to a reduction in game ports to the Mac if developers have to go write against a Mac-specific graphics API.


Apple iOS Metal Thread Model

One thing that is a pretty sure bet at this point is the GPUs that will support Metal. In short, don’t expect to see anything that can’t support Vulkan support Metal due to a lack of necessary features. So I’m expecting Metal compatibility to start with Intel’s Haswell (Gen 7.5) iGPUs, AMD’s GCN dGPUs, and NVIDIA’s Fermi/Kepler dGPUs. El Capitan works on a much wider range of machines of course, so this means only a fraction of those machines get to experience Metal. Though this was the same situation on mobile as well.

As for developers, things will be interesting. As I mentioned before Apple seems to be going all-in on Metal, starting with the fact that they will have Metal back-ends for their Core Graphics and Core Animation frameworks. And actually I’m a bit surprised by this, as basic compositing is not something that is draw call limited. Apple is claiming upwards of 50% performance increases here, so I’m curious just how this works out, but I suspect these are based on low-level benchmarks. Draw call performance is not the only benefit of Metal, but it is the most immediate, so Apple may be leveraging the harder to get GPU benefits here, or just wringing every last Joule of power out by getting to an API that isn't doing high-level state checking.


OS X Metal Performance Improvements: From Apple's Promotional Materials

In any case, by building Core frameworks off of Metal, Apple is in a position where they have to ensure Metal drivers are working well, which is to the benefit of developers. Meanwhile Apple is going one step past Metal on iOS 8 with the release of MetalKit, which is a set of utility functions for Metal to help speed Metal development. As we’ve mentioned before one of the few real pitfalls of low-level APIs is that to best utilize them you need guru-level programmers – after all, the API doesn’t have high-level safety nets to keep developers out of trouble – and with MetalKit Apple is at least partially resolving this issue by providing some base functionality for programmers.

Wrapping things up, though not an unexpected move from Apple, it will none the less be interesting to see how their efforts with Metal go. As a tightly integrated vendor they have the advantage of being able to move quickly when they choose to, which is why we’re seeing Metal come to OS X so soon and to get used by Core OS components so soon. Metal is just a graphics API, but due to Apple’s timing OS X will be the real test for low-level APIs on the desktop, and not just for gaming. Apple is in an interesting position to take advantage of these new APIs like no one else can, so in several ways they are going to be the pathfinder on just what can be done with these APIs.