|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:
After three levels of optimization:
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.
or email your comment to: email@example.com
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.
|Last Updated ( Friday, 03 August 2012 )|