Explainer: Metal

We take for granted many graphics features that have been hard-won over many years. You don’t even have to go back to System 6 to see how far the Mac’s graphical user interface has come.

resedit3

Just a few years ago, windows were strictly rectangular, shadow effects solid black, and text left pixellated without anti-aliasing. Modern Macs all use Graphics Processing Units (GPUs) to render these mundane miracles, and for them to do so, software needs to call libraries of sophisticated graphics primitives. This is accomplished at many levels: an app just calls for a window to be opened, leaving all the rendering work to lower levels to handle. But apps which render and animate elaborate 3D scenes need access to graphics primitives to work their magic.

The Mac’s first graphics system, QuickDraw, was initially developed by Bill Atkinson and Andy Herzfeld in the days when displays were monochrome and graphics were still based on pixels. This was eventually replaced by Quartz, which is based on 2D vector graphics using PDF (or a derivative). That flourished into Quartz Extreme which took rendering into available GPUs.

Quartz had strong competition. In the 1990s OpenGL grew from Silicon Graphics workstations into a major open standard for 3D graphics, and in 1995 Microsoft released Direct3D. While Apple supported OpenGL, and continued to do so until its deprecation in 2018, it had already launched Metal in June 2014, and incorporated it into OS X El Capitan a year later.

Currently, Metal provides the lowest-level of supported access to GPUs in Macs, iPhones, iPads, and Apple TV. It delivers hardware-accelerated 3D graphics and computing facilities equivalent to the combination of OpenGL and OpenCL, with features such as its own shading language, MSL. For 3D graphics apps, graphics-intensive games, and anything else which wants to access the full power of the GPU in modern Macs, it’s the best way to go. For the more advanced features and performance of Apple’s M1 series chips, it’s the only option, as Apple doesn’t document their GPUs.

Metal support for different GPUs varies. It’s best with Apple’s own hardware, in its devices and M1 series Macs. Support for Intel HD and Iris, and AMD GPUs is also good, but Metal drivers for NVIDIA GPUs have been limited by the ongoing cold relationship between Apple and NVIDIA. There are also large differences in supported features across GPUs of different ages, from the first feature set for devices with Apple’s A7 chips, to the seventh with the A14. Mac support for features is divided into two families, with models from 2012-2015 forming family 1, and those from 2015/2016 onwards in family 2. This becomes even more complex with ‘cheesegrater’ Mac Pro models from 2010 and 2012, which rely on a Metal-capable graphics card.

For users, the profusion of different graphics systems has been seriously bad news, and Metal has done little if anything to help. Apps which make good use of Metal perform excellently, and benefit greatly from the brute force of the GPUs in the M1 Max, for example.

However, to attain that level of performance, developers have to be prepared to invest in macOS-specific development so their apps can call Metal directly. In markets such as games, they tend to rely on third-party engines which increase the distance between the app and GPU. All too often, the end result isn’t impressive, and the Mac version of a popular game proves a disappointment. Hopefully the popularity and enhanced performance of M1 chips will encourage more third-party developers to build in good support for Metal.

Metal support is also important in the virtualisation of non-Mac operating systems. Many of the improvements in performance seen in recent releases of major virtualisation platforms have resulted from more extensive use of Metal when hosting Windows VMs. This has, for instance, made the use of games for Windows more feasible.

Finally, there’s a delightful irony in the name Metal. Back in the day when it was common to resort to very low-level programming of hardware to achieve good performance, that was referred to as hitting the metal. The one thing that Metal does is to ensure that today’s developers don’t have to hit the metal any more.

References

Apple’s Metal section.
Apple’s Metal documentation overview.
Metal feature sets.
Apple’s detailed tables of features supported on devices.