Fast zombies

Original author: Valve Linux Team
  • Transfer
This is a translation of a new Valve Linux blog post .

One of the factors of a pleasant game is the speed of its work. In this post, I’ll talk about what we learned about the graphics performance of our Linux games.
Any developer will say that productivity is a very confusing thing. Therefore, for simplicity of narration, we will focus on the following top-end configuration:


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

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


Don’t worry, we are using 32-bit versions of Linux temporarily, the release will work on the 64-bit architecture.
Running Left 4 Dead 2 on Windows 7 with the Direct3D driver, we get a value of 270.6 FPS. Data is generated using our internal tests.

When we started working with Linux, the first version that started worked with 6 FPS. This is normal for the initial stage of porting the game to a new platform.
Performance improvements were mainly implemented in three directions:

  • Make the game work better with the kernel
  • Make the game work better with OpenGL
  • Optimize Graphics Drivers

For example, to improve interaction with the kernel, we changed our memory allocation mechanism so that it uses functions that are more acceptable for Linux. We also reduced the number of unnecessary OpenGL calls and expanded the interface of our graphics engine for better interaction with OpenGL and Direct3d.
The third point is especially interesting, since this includes working with iron manufacturers to identify weaknesses in their drivers, and, as a result, improving them, which will positively affect other Linux games. Investigating driver delays and adding multithreading support to it are two examples of changes that have resulted from the collaboration of our teams.

After all the work done, Left 4 Dead 2 runs on 315 FPS on Linux. Greater productivity in Linux compared to Windows (270.6), at first glance it looks a bit not logical, given the amount of time spent on porting. However, this speaks of the potential opportunities that lie behind the core and OpenGL. By the way, in the process of working with equipment manufacturers, we also accelerated the implementation of OpenGL for Windows. Left 4 Dead 2 runs on 303.4 FPS in this configuration.

OpenGL vs Direct3D on Windows 7


All this leads to the question: why is the OpenGL version of our game faster than the Direct3D version on Windows 7? This does not seem to apply to the implementation of multithreading. We conducted a fairly honest analysis and found a small delay (a few microseconds) for each batch in Direct3D, which does not affect OpenGL. Now we know that equipment can do more, and we will figure out how to reach a new limit with Direct3D.

Work with video card manufacturers


We worked with NVIDIA, AMD, and Intel to improve Linux driver performance. Together we did a great job, it was very nice to see how our developers work together with them, carefully analyzing the data received. Each open bug was a revelation, and it is simply invaluable to be around people who understand the game, renderer, driver, hardware and work with them side by side, attacking performance problems.

This is a great example of the benefits of close collaboration between software and hardware developers, and this collaboration should make a big contribution to the Linux community.

Also popular now: