1. Home >
  2. Gaming

Valve: OpenGL is faster than DirectX -- even on Windows

In a scary twist that reinforces Valve's distaste of Windows 8, it turns out that the Source engine -- the 3D engine that powers Half Life 2, Left 4 Dead, and Dota 2 -- runs faster on Ubuntu 12.04 and OpenGL than Windows 7 and DirectX/Direct3D.
By Sebastian Anthony
L4D2, running natively on Ubuntu 11.10

In a scary twist that reinforces Valve's distaste for Windows 8, it turns out that the Source engine -- the 3D engine that powers Half Life 2, Left 4 Dead, and Dota 2 -- runs faster on Ubuntu 12.04 and OpenGL than Windows 7 and DirectX/Direct3D.

The Valve Linux Team breaks it down on their shiny new blog(Opens in a new window): With an Nvidia GTX 680, Intel i7-3930k, and 32GB of RAM, Windows 7 and DirectX, Left 4 Dead 2 maxes out at 270.6 fps. With the same hardware, but different software -- Ubuntu 12.04 and OpenGL -- L4D2 scores 315 fps, almost 20% faster than Windows.

These figures are remarkable, considering Valve has been refining the Source engine's performance under Windows for almost 10 years, while the Valve Linux team has only been working on the Linux port of Source for a few months. Valve attributes the speed-up to the "underlying efficiency of the [Linux] kernel and OpenGL."

The Linux port of L4D2 didn't start off at 315 fps, of course -- the initial version actually maxed out at just 6 fps. To realize such a huge performance gain, a three-pronged approach is taken: The game is tweaked to play nicely with the Linux kernel, the game is optimized to work with OpenGL (rather than DirectX), and bugs in the Linux graphics drivers are addressed.

This last point is interesting: Valve has long-standing relationships with AMD, Nvidia, and Intel, where Valve reports driver bugs and the GPU maker fixes them in a timely fashion. Valve is carrying this relationship over to Linux, which is very important for the continued growth of Linux as a gaming platform. In this case, Valve says that the Nvidia Linux driver lacked multithreading support -- and once they added it to a later version of the driver, performance increased.

But here's the best bit: Using these new OpenGL optimizations, the OpenGL version of L4D2 on Windows is now faster than the DirectX version. With the same hardware, Windows 7/OpenGL/L4D2 clocks in at 303.4 fps -- compared to Windows 7/DirectX/L4D2 at 270.6 fps. In short: OpenGL is faster than DirectX.

DirectX logoAs for why OpenGL is faster than DirectX/Direct3D, the simple answer is that OpenGL seems to have a smoother, more efficient pipeline. At 303.4 fps, OpenGL is rendering a frame every 3.29 milliseconds; at 270.6 fps, DirectX is rendering a frame in 3.69 milliseconds. That 0.4 millisecond difference is down to how fast the DirectX pipeline can process and draw 3D data.

Why do we still use Direct3D?

If OpenGL is faster, why is DirectX still the predominant API? It isn't because of image quality or features: OpenGL 4.0 has all of shaders and tessellators and widgets that DX has. It isn't because of hardware support: All Nvidia and AMD graphics cards support the latest version of OpenGL along with DirectX.

Really, it all comes down to that crummy old thing we call the network effect -- and, of course, monopolistic heft and marketing dollars. DirectX, because it has a cleaner API and better documentation, is easier to learn. More developers using DirectX = more DirectX games = better driver support. This is a vicious loop that again leads to more DX devs, more DX games, and better DX drivers/tools/documentation. Microsoft has relentlessly marketed DirectX, too -- and who can forget the release of Windows Vista and Microsoft's OpenGL smear campaign? Vista's bundled version of OpenGL was completely crippled, forcing many devs to switch to DirectX.

Steam LinuxMicrosoft has good reason to hamper the progress of OpenGL, of course: While DirectX is proprietary and only runs on Windows, Xbox and Windows Phone, OpenGL is completely cross-platform. There are solid OpenGL implementations for Mac, Linux, PlayStation 3, Nintendo Wii, and just about every modern smartphone (OpenGL ES). It obviously in Microsoft's best interests to ensure that the best gaming experiences are exclusive to its platforms.

With Gabe Newell's distaste for Windows 8 (and Blizzard echoing his sentiments(Opens in a new window)), the imminent release of Steam on Linux, and the continued growth of smartphone games, we could be on the cusp of an OpenGL revolution. If the Windows gaming crown continues to slip, OpenGL might soon become the default API, rather than an afterthought. Very soon, it might be standard to develop a game that works well across every platform -- rather than focusing on Direct3D and leaving Linux and OS X out in the cold.

Valve will be speaking about its Linux/OpenGL advancements at SIGGRAPH 2012 next week. SIGGRAPH is where we usually hear about the latest OpenGL and DirectX news, too -- so stay tuned!

Updated @ 2:40: The story originally stated that the OpenGL spec is usually ahead of DirectX -- but that hasn't been true for a few years now.

Tagged In

Valve Windows 8 Windows Linux Windows 7

More from Gaming

Subscribe Today to get the latest ExtremeTech news delivered right to your inbox.
This newsletter may contain advertising, deals, or affiliate links. Subscribing to a newsletter indicates your consent to our Terms of use(Opens in a new window) and Privacy Policy. You may unsubscribe from the newsletter at any time.
Thanks for Signing Up