Return of the DirectX vs. OpenGL Debates
by Jarred Walton on March 24, 2014 3:55 PM ESTWith the announcement of DirectX 12 features like low-level programming, it appears we're having a revival of the DirectX vs. OpenGL debates—and we can toss AMD's Mantle into the mix in place of Glide (RIP 3dfx). I was around back in the days of the flame wars between OGL and DX1/2/3 devotees, with id Software's John Carmack and others weighing in on behalf of OGL at the time. As Microsoft continued to add features to DX, and with a healthy dose of marketing muscle, the subject mostly faded away after a few years. Today, the vast majority of Windows games run on DirectX, but with mobile platforms predominantly using variants of OpenGL (i.e. smartphones and tablets use a subset called OpenGL ES—the ES being for "Embedded Systems") we're seeing a bit of a resurgence in OGL use. There's also the increasing support of Linux and OS X, making a cross-platform grapics API even more desirable.
At the Game Developers Conference 2014, in a panel including NVIDIA's Cass Everitt and John McDonald, AMD's Graham Sellers, and Intel's Tim Foley, explanations and demonstrations were given suggesting OpenGL could unlock as much as a 7X to 15X improvement in performance. Even without fine tuning, they note that in general OpenGL code is around 1.3X faster than DirectX. It almost makes you wonder why we ever settled for DirectX in the first place—particularly considering many developers felt DirectX code was always a bit more complex than OpenGL code. (Short summary: DX was able to push new features into the API and get them working faster than OpenGL in the DX8/9/10/11 days.) Anyway, if you have an interest in graphics programming (or happen to be a game developer), you can find a full set of 130 slides from the presentation on NVIDIA's blog. Not surprisingly, Valve is also promoting OpenGL in various ways; the same link also has a video from a couple weeks back at Steam Dev Days covering the same topic.
The key to unlocking improved performance appears to be pretty straightforward: reducing driver overhead and increasing the number of draw calls. These are both items targeted by AMD's Mantle API, and presumably the low level DX12 API as well. I suspect the "7-15X improved performance" is going to be far more than we'll see in most real-world situations (i.e. games), but even a 50-100% performance improvement would be huge. Many of the mainstream laptops I test can hit 30-40 FPS at high quality 1080p settings, but there are periodic dips into the low 20s or maybe even the teens. Double the frame rates and everything becomes substantially smoother.
I won't pretend to have a definitive answer on which API is "best", but just like being locked into a single hardware platform or OS can lead to stagnation, I think it's always good to have alternatives. Obviously there's a lot going on with developing game engines, and sometimes slower code that's easier to use/understand is preferable to fast/difficult code. There's also far more to making a "good" game than graphics, which is a topic unto itself. Regardless, code for some of the testing scenarios provided by John McDonald is available on Github if you're interested in checking it out. It should work on Windows and Linux but may require some additional work to get it running on OS X for now.
Source: NVIDIA Blog - GDC 2014
105 Comments
View All Comments
jimjamjamie - Tuesday, March 25, 2014 - link
If we look at the fact that Microsoft won't even euthanise Internet Explorer, I doubt DirectX is going anywhere for a good number of years yet.sorten - Tuesday, March 25, 2014 - link
Why would Microsoft euthanize IE? IE's market share is growing and is greater than the share of all of its competitors combined.didibus - Tuesday, August 5, 2014 - link
Euh... what?http://en.wikipedia.org/wiki/File:Countries_by_mos...
Gigaplex - Monday, March 24, 2014 - link
"Even without fine tuning, they note that in general OpenGL code is around 1.3X faster than DirectX"A bold claim. What versions are being compared here, on what system? I recall OpenGL having vastly crippled performance on Windows during the DirectX 10/Vista days. Not a lot of Windows applications since then use OpenGL (or at least ones that I follow) so I haven't heard if this has been resolved.
tuxRoller - Tuesday, March 25, 2014 - link
Watch the video and read the slides.drzzz - Tuesday, March 25, 2014 - link
I find this discussion interesting. Something people have failed to realize is that you write an OGL ES app and it will run on OGL on the desktop. This is what is so great about OGL. Microsoft has DX for PC and XBOne but currently they are different in small ways. Sure by DX12 it should be fully unified. But that is a bit away. With Steam OS and Valves push unto other platforms a door is open for more OGL games to go cross platform.Studios are going to go where the money is and the more platforms they can run on with the minimal changes to their code base/engine is going to play a bigger and bigger role in the coming years. Thanks to Andriod and iOS both being great platforms with large user bases supporting OGL ES the concept of building cross platform games is actually becoming very accepted. GDC 2014 just demonstrated a large number of games that will release iOS, Andriod and PC. These games are based on OGL/OGL ES. With a 2015 date on DX12 and no DX library for OS'es other than Windows MS has a huge up hill battle.
Even if the speed was just equal the game developers are more and more seeing valid sustainable support for OGL and cross platform development.
mr_tawan - Tuesday, March 25, 2014 - link
On Windows, many of the OpenGL ES application runs over DirectX (through ANGLE)... one of them is Google Chrome.OpenGL and OpenGL ES are different API. though OpenGL ES is fully supported in OpenGL (starting 4.3 or 4.4, I'm not sure), I think majority of people still not be able to run OpenGL ES on their Windows desktop.
althaz - Tuesday, March 25, 2014 - link
Seems pretty clear that Jarred is a massive OpenGL fan. Only OpenGL zealots prefer OpenGL (from a coding point of view) to Direct3D which is a FAR superior API (lately, DirectX 1-6 were utter shite). That's the reason people use it. As a side bonus, if you don't want to spend big on optimizations, performance is generally better.The issues you run into is if you want to do a little bit more than is standard in terms of optimizations, Direct3D tends to suck a bit compared to OpenGl.
Open GL used to be the clear leader in performance and API quality, but they fell catastrophically behind in both. They are pretty caught up in performance (and arguably better if you spend the time optimizing) and their API whilst still not as nice to use as DirectX, is no longer complete pants.
Overall, I think OpenGL is the better API again now, but using it basically guarantees slightly longer development time due to the optimizations being more essential than in D3D and the less abstraction meaning there's more to do yourself. Also the API is not as nice to use, but for me none of that is as important as the end result and OpenGL makes it easier to port to other platforms and gives you more scope to improve on performance (though a lot of devs do not want to delve into that at all).
tuxRoller - Tuesday, March 25, 2014 - link
They fel behind after SGI had it's troubles. Khronos had done a pretty good job (obvioulsly we didn't get the clean break we were hoping for with 3.0).JarredWalton - Tuesday, March 25, 2014 - link
Please, OpenGL fan? I haven't programmed graphics in YEARS -- and I sucked at it. I just find it interesting that NVIDIA, AMD, and Intel all had a panel discussing how OpenGL could dramatically improve performance of graphics in certain areas. Is it true? Well, I don't have the know-how to really figure that out, but developers do and I'm sure some of them are playing around with this stuff. Ultimately, it's the games that matter, and I've played a lot of wonderful games that are built using pretty simply graphics, so DX vs. OGL vs. Mantle vs. Glide vs. whatever is only a secondary technological consideration. id Software made some great technology with games that were mediocre at best (IMO, naturally). Others (Valve) have stuck with DX9 for a long time and yet still made some incredible games. This is why games are art as much as anything else out there.