OpenGL Faster Than DirectX - Or Is It?
Written by Harry Fairhead   
Friday, 03 August 2012

It is being reported that Valve has found OpenGL to be faster than DirectX, but the real conclusion is slightly more complicated.

Valve is well known for its fast PC-based graphics and if anyone knows anything about DirectX you would expect it to be Valve. However, a recent blog post suggests that, even with all that knowledge, it wasn't possible to get DirectX working as fast as a port to OpenGL.




This looks damming for DirectX, especially so when the port to OpenGL even ran faster under Windows - i.e. OpenGL under Windows is faster than DirectX.

The game Left4Dead 2 was ported to a 32-bit version of Linux and initially it achieved 6 fps, which isn't unreasonable for a direct port of a program optimized to run under Windows/DirectX. The setup was:


  • Intel Core i7 3930k
  • NVIDIA GeForce GTX 680
  • 32 GB RAM


  • Windows 7 Service Pack 1 64-bit
  • Left 4 Dead 2
  • Ubuntu 12.04 32-bit

After three levels of optimization:

  • Modifying the game to work better with the kernel
  • Modifying the game to work better with OpenGL
  • Optimizing the graphics driver

the frame rate shot up to 315 fps. This is to be compared to the optimized Windows/DirectX frame rate of 270.6 fps. The graphics driver improvements also resulted in the Windows OpenGL version running at 303 fps, which still beat the DirectX version.

This does seem to be a long way from what you might expect, given the time already taken to get the DirectX version running as fast as possible. However, to quote from the Valve blog:

This experience lead to the question: why does an OpenGL version of our game run faster than Direct3D on Windows 7? It appears that it’s not related to multitasking overhead. We have been doing some fairly close analysis and it comes down to a few additional microseconds overhead per batch in Direct3D which does not affect OpenGL on Windows. Now that we know the hardware is capable of more performance, we will go back and figure out how to mitigate this effect under Direct3D.

So the problem with Direct3D isn't something deep and structural, but a small overhead on each graphics operation that adds up. As the Valve blog says, given that the problem is now identified there might be something that can be done to speed up DirectX to run faster.

This isn't quite as damning as some news reports suggest. It has been used as proof that DirectX is in some way deeply flawed. Of course it might be, but on the basis of what has been presented it seems that DirectX is a little (around 15%) worse than OpenGL. In addition a lot of work has been done to improve the Linux OpenGL drivers and it isn't clear how much this contributed to the speed up.




What you can say from the result is that OpenGL is a high performance graphics platform - as long as you have the right drivers installed.


More Information

Valve Linux Blog

Related Articles

OpenGL 3D fluid simulation (video)

OpenGL GPU Smoke simulation





or email your comment to:

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.



Google's Large Language Model Takes Control

of a robot. No it isn't Skynet just yet, but it is looking a more likely scenario. Until recently I thought that much of the hype about large language models was just that - hype. Now I'm not so sure. [ ... ]

Advances In Confidential Computing

Edgeless Systems, a company that aims to turn the public cloud into the safest place for sensitive data, is hosting the annual online Open Confidential Computing Conference (OC3) where CTOs  [ ... ]

More News

Last Updated ( Friday, 03 August 2012 )