Skip to main content

AMD Mantle: A Graphics API Tested In Depth

APIs, Abstraction and Mantle: An API Primer

AMD's Mantle API is a polarizing topic in the world of PC gaming. There are many opinions, lots of information, plenty of speculation, and a handful of known facts to sift through. We want to tell the whole story, and we want to do it right. Unfortunately, it's almost impossible to discuss this topic without resorting to industry jargon, so let's start at the very beginning and lay out some definitions, set the stage, identify where we were, and how we got here.

What is an API?

The acronym API stands for application programming interface. The key word here is interface. An API is designed to allow applications to interface, or communicate, with each other.

A great example of this is copy and paste functionality in Windows. When you copy a paragraph of text from your browser to the clipboard, and then paste that text into a word processor, you have applied the power of an API. The developers of your browser included support for the API's request (or call) to copy, while the programmers of the word processor included support for the API's call to paste. Those two programs communicate to each other via the API.

The advantage of an API is that software developers don't have to code specific support for every possible application. If it wasn't for APIs, all of the document editing software in the world would have to contain unique code to interface something like copy and paste functionality with every other document editing software in the world. That model would be impossible to maintain.

The downside? An API is not as efficient as coding specific support for direct communication between software. The price of convenience is increased utilization of hardware and processing resources. 

 OK, what is a graphics API?

Since an API exists to provide a communication interface between applications, a graphics API communicates between an application and a graphics card driver.

The name of the game here is compatibility. Instead of coding a game engine to support multiple paths to interface with specific graphics card drivers, game developers can concentrate on communication with the API instead. The API then calls the graphics driver, which implements its instructions to the graphics card. In this way, graphics APIs can be considered one of the abstraction layers between the OS and hardware.

If the purpose of a graphics API is simplicity and convenience, why is there more than one API?

OpenGL has its roots in SGI's proprietary Iris GL, which was released in the early 1980s. In a surprising move, the company handed it off as an open standard called OpenGL (Open Graphics Library) API. SGI's competitors were given access in exchange for sharing the burden of maintaining and updating the code.

Microsoft even had a seat on the OpenGL Architecture Review Board until 2003, when the company pulled support in favor of its proprietary DirectX API, which is now more prolific. Currently, DirectX is used in Windows and the Xboxes, so it's easy to justify choosing Microsoft's API from the standpoint of a developer who wants to get the most out of their available resources.

Having said that, John Carmack is a famous holdout who we've seen prove that OpenGL can still be used to run high-end PC games (like Rage). In addition, OpenGL is important because it can be used across platforms: Windows, Mac, and Linux. Android, Windows Phone, and the iPhone use OpenGL ES (Open GL for Embedded Systems). As gaming on mobile devices gains prominence, so does OpenGL.

What's wrong with DirectX 11 and OpenGL? Why does the world need another graphics API?

Two standards at odds are bad enough. It seems counter-intuitive to add another. So how do existing APIs fall short of developer expectations?

Both DirectX and OpenGL were created in the previous millennium. It was a time before multi-core CPUs in mainstream devices were possible. Recently, some developers have voiced concerns that they are bloated, prone to instability, and scale poorly (or not at all) on well-threaded platforms. In addition, no API is perfect. Have you ever had to update a graphics driver to get a game to work properly? Every time this happens, the graphics API has failed in its role as an abstraction layer.

On top of this, it was rumored that Microsoft considered halting DirectX development in 2013. In an interview with c't, AMD's Roy Taylor was quoted as saying, "A new DirectX has again and again refreshed the industry, new graphics cards need more processors and more RAM. But there is no DirectX 12 come. That's it. As far as we know, there are no plans for DirectX 12". In addition, a leaked Microsoft email said the cross-platform XNA Game Studio development platform is not in active development, and that DirectX is no longer evolving as a technology. Microsoft later retracted this and claimed it was a miscommunication, but with no published plans for DirectX 12, the developer community was getting antsy.

AMD claims to have been driven to the creation of a new API that would address those issues at the behest of developers disenchanted with the state of DirectX and OpenGL. In addition, because AMD APUs and GPUs drive the Xbox One, PlayStation 4, and many PCs, the company is in a unique position to offer an API that could potentially be leveraged across multiple platforms.

How does Mantle supposedly improve compared to OpenGL and DirectX?

Mantle is associated with the phrases "low-level" and "closer to the metal". But what does that actually mean? In simple terms, the answer is minimalism. It's smaller, simpler, and consequently faster than DirectX 11 and OpenGL. AMD's new API purportedly makes fewer assumptions about how developers want to render a given scene. This puts more control of resources in the developer's hands, instead of the API's, allowing for better optimization.

In this light, Mantle has the potential to be more efficient. In addition, Mantle is able to execute fully-parallel draw submissions in order to divvy up workloads to multiple CPU execution units. If the API is able to effectively utilize more processing resources, slower CPUs with multiple execution units may be less of a bottleneck.

Put simply, AMD claims that Mantle has the potential to increase performance on systems with slower multi-core host processors. Where the CPU is not a bottleneck, Mantle might even lower GPU power consumption.  

AMD claims to be a big supporter of open source. Is Mantle an open source API?

Mantle is not open source, nor does AMD claim that it will ever be open source in the future. The company does say that it will make the Mantle SDK available to anyone by the end of 2014 with no license fee or restrictions once the closed beta program is complete, though.

To clarify, access to the SDK isn't the same as open source. But it does mean that, in theory, Nvidia and Intel could write a Mantle-compatible driver. Realistically, I think this is unlikely. But I'll save my analysis of the situation for our conclusion. The point is, AMD wants to keep control of Mantle to optimize it for the GCN architecture and allow for fast developer adoption of new hardware features, which isn't practical for generic APIs like DirectX and OpenGL.

Alright, I think I have a handle on the basics of Mantle. What now?

Well, we want to put Mantle to the test and see exactly what it can do. While AMD promises that a number of developers are working on Mantle support for upcoming titles like Civilization: Beyond Earth, Star Citizen, and Dragon Age: Inquisition, at the time of writing, there are only three games on the market that currently support AMD's API: Battlefield 4, Thief, and Plants vs. Zombies: Garden Warfare. Since Plants vs. Zombies: Garden Warfare does not have Mantle benchmark functionality available, and it uses the same Frostbite engine that powers Battlefield 4, we'll concentrate on the first two Mantle-enabled titles.