AMD’s Mantle API: how it works and why PC developers will adopt it | PCGamesN

AMD’s Mantle API: how it works and why PC developers will adopt it

A red and black AMD Radeon video card against a white field.

Since the fall, we’ve heard some eyebrow-raising claims about Mantle, AMD’s new API (application programming interface). The numbers being tossed around in terms of performance-gain seem almost hard to believe, with Battlefield 4 running up to 45% faster via Mantle over DirectX.

It seems too good to be true, so we talked with AMD’s Robert Hallock. He explained how AMD have been able to achieve these kind of results with their API, and why he thinks it has such a strong case for being adopted as a standard. If he’s right, Mantle could spell huge changes for how games are made, and what kind of performance PC gamers can expect from their own machines.

Right now, when you are playing a modern PC game, DirectX is working behind the scenes to coordinate your game and the PC hardware running it, especially your graphics card and CPU.

“When you put an object on the screen for the player, that is a draw call,” Hallock explains. “That GPU talks to the CPU and says, ‘Hey, this thing has to go on screen.’ Current APIs are very limited in the number of calls they can make per frame. Each frame requires several thousand draw calls. Now, in a best case scenario, today’s APIs get you three to five thousand draw calls. That’s how many objects appear on screen.

“Mantle kicks that limit up to 80 thousand or 90 thousand. That is an absolutely massive increase in the number of objects the GPU can handle. Of course, when you increase that limit, that doesn’t mean devs are going to put more objects on screen. But they can improve the performance of draw calls that they are making.”

There are two major factors behind that increase. The first is that DirectX (and OpenGL) have their roots in an era when multi-core processors weren’t even on anyone’s radar. As a result, Hallock says, they don’t have the best approach to multithreading. Though there’s more performance to be had, “there’s a point where the [current] APIs are unable to satisfy the requests.” Mantle was built with the modern hardware environment in mind.

The second factor is Mantle’s own programming language. “[These performance gains] are a result of the the lower API overhead. At a fundamental level, Mantle’s code is executed in a language that’s much similar to the way our GPU architectures natively speak. Every architecture has its own native dialect of graphics core architecture.”

Hallock continues, “Reducing that overhead improves performance, allows you to do more, eliminates hardware downtime. We could alleviate or address those instances and allow the GPU to work faster and more efficiently.”

While Mantle offers tremendous gains in theory, they don’t mean anything unless it gets adopted by developers who have many, many years of history, experience, and fluency in DirectX. Hallock understands this, and knows Mantle is not a guaranteed success by any means.

A Battlefield 4 screenshot.

“No doubt that adoption is Mantle’s biggest hurdle. Our biggest hope is that Mantle becomes adopted as an industry standard, or the fact that it exists and presents an observably better model — that provides inspiration for new products. So either we become the standard and benefit the industry, or something like Mantle becomes the standard, and either way, PC gamers benefit,” he says.

But he thinks AMD have a good case for being adopted. For one thing, Mantle was built partially in response to developer needs and requests. DICE in particular, Hallock says, wanted to have an API for PC development that was as efficient as the stuff they were working with on consoles.

Because if you think about it, it’s kind of amazing that consoles work at all, isn’t it? As a collection of hardware components, the Xbox 360 was never all that impressive and it should have been obsolete years ago. Yet it was able to keep running the same games as a PC (albeit with increasingly dubious performance as the years went on).

“They have a fixed hardware platform, so you have one set of hardware that can be found on every model of that console,” Hallock points out. “That lets a game developer, like Mantle, to go very close to the GPU and write code that is very close to what the GPU is expecting. So you can extract a lot of performance out of the console because of that environment. And that is something you couldn’t do on PCs until Mantle because every PC is different.”

Now here’s something Hallock didn’t get into, but is almost certainly going to be a major factor behind adoption of Mantle: AMD’s hardware is already inside both the major next-gen consoles. That fixed hardware environment on PS4 and Xbox One is an AMD environment, so it’s not hard to see how suddenly working with an AMD API could suddenly be very appealing.

Hallock admitted, “The clever thing about Mantle is that it’s very similar to the types of code these game developers are already creating for consoles, so the process of porting is quite simple for them.”

That’s crucial, because we all saw with the PS3 and cell processing what happens when developers have to work with an unfamiliar and unusual architecture. DirectX isn’t just familiar, it was also designed to speak a language close to what programmers already knew and used. Mantle will have to become a similarly comfortable environment to succeed, and since it is speaking a language closer to what the GPU uses, it may not be as easy as DirectX is. Those problems go away, however, if developers are working with Mantle so much that they become fluent in it.

The nice thing about Mantle is it doesn’t rip-up their current work. Hallock explains, “We’ve designed Mantle to be compatible with DirectX Hight Level Shader Language. So that DirectX code that people are already writing is already compatible with Mantle. I would never dare claim that DirectX is going away. It’s not something that we hope to replace. It’s an important, powerful, great API.”

Mantle is still making its way to market as AMD continue developing it and opening it to developers. But people running AMD cards can get a taste of what Mantle can do later this month, when Battlefield 4 updates with Mantle support. It will be an interesting first test of what Mantle can really offer players.

“I see two big things going for Mantle, “Hallocks says. “If anything else, these two things will drive adoption. One, game developers really, really like Mantle. All the game developers currently using Mantle have come to us have come to us to request it. They are excited about using it. And point number two is that gamers will see the performance benefits and really, really want to get their hands on it. And that addresses both sides of the game development continuum. ‘Push-in’ from the game developers and ‘pull-out’ from the consumer side.”

Clicking on links in articles to retailers or publishers may mean we earn a small commission.