Valve explains how L4D2 in Ubuntu outperforms Windows

The 39th Conference and Exhibition for Computer Graphics and Interactive Techniques (also known as SIGGRAPH 2012) was held in Los Angeles during 5-9 August. It’s a great place for disseminating new scholarly work in computer graphics and interactive techniques, while paper authors provide brief overviews of their work in the fast forward sessions. But this time was special due to Valve’s latest work in Linux gaming development, porting Left 4 Dead 2 into native a Linux machine using Ubuntu along with OpenGL technology.

The presentation started off with Mr.Rich Geldreich talking about their experience into Linux game programming, and most importantly he explained how the Ubuntu’s version outperforms Windows 7 for both renders – Direct3D & OpenGL. The speech was called [highlight color=”orange”]From 6 to 300 FPS[/highlight]. The talk was focused on Valve’s optimization efforts and mainly visual enhancement; including a short time video running the game in his laptop using Ubuntu 12.04.  The team was available for questions afterwards.

Since the “Faster Zombies” article posted into the LVT blog, some users expressed their resentment for the the integrity of Valve’s results. Now, even these guys can’t believe how many good things are happening for Linux gaming right now. Take a look to the most important enhancements:

[tabs tab1=”NVIDIA new drivers” tab2=”Universal performance” tab3=”Configuring the GCC”]

[tab]In cooperation with NVIDIA, we are expecting new multi threaded drivers. This new feature added in the Linux driver for nVIDIA cards is very important according to Mr.Rich. He said that nVIDIA’s multithreaded drivers showed a day/night difference working on Linux for the GL calls.[/tab]
[tab]Valve’s programmers did the dirty job, writing the hottest D3D->GL code segments for better performance, paying attention to the fact that they ought to be able to reuse their work for other Source titles as well. Likely, same performance will passed to other titles via the Steam engine.[/tab]
[tab]Valve did some experiments playing around with the dynamic buffer updating: glMapBufferRange vs. glBufferSubData. In the end, they added –ffast-math to their GCC compiler options and removed -fPIC, resulting in some 8-10% performance increase[/tab][/tabs]

To measure the game’s performance in front of the audience, they used a timedemo benchmark (about 30 seconds) in “Dead Center” campaign. The demo shows a massive action scene, including explodes and fast moves — a fair enough representation of the gameplay. In addition, Mr.Rich claimed they use many more timedemos in their private test sessions.

[dropcap]It’s important[/dropcap] to notice that Valve is not joking around about Linux. The very first port (scored 6 FPS) was done before the current Linux Team was formed. In the meantime, Valve picked up the phone and called some hardware vendors (eg Intel) in order to discuss the possibilities and limitations of this effort altogether.

The D3D – OpenGL system directly maps D3D calls and immediately flushed its state to the graphics buffer. Then, it translates the API calls on the fly and supports shader model 2.0b, with 3.0 support coming up. Such performance optimization boosted the actual framerate and currently Left 4 Dead scores 300 FPS. Good news, is that they applied the same optimizations to other games based on the Source platform.

The Linux driver immaturity is a well known problem among the Linux gamers. That’s why the benchmarking sessions was hard and without using top notch hardware, it was impossible to figure out the root of performance regression. To avoid misconfiguration among different Linux systems, Steam is going to universally handle your driver’s settings. In this hardware-free way, they will manage to port games not only for Ubuntu, but for any other Linux distro outhere. In that manner, all enhancements and visual optimizations is going to inherit from one game to another, via Steam.

[toggle title=”What tools they used for debugging”]According to Jaroen BaertThe primary debugging/profiling tool used was Telemetry by RAD Game Tools (the guys behind the BINK video format). It consists of a visualizer app, a runtime component and a server. Since Telemetry is an intrusive system, extra lines had to be added to define Telemetry zones in the code. These zones can be nested, labeled … Using this tool paid off when it was time to find performance bottlenecks, as Rich showed by demonstrating a Telemetry analysis of a typical game run, in which he was able to zoom in up to microsecond level to see what was eating cycles. He mentioned that they’ve only scratched the surface of what was possible with this tool, and looked forward to using it more.

Another home-mode performance analysis tool they’ve made is a visual batch trace mode, in which the engine outputs PNG files on which the scanlines depict using several colors on what the time was spent. This way, they could visually compare D3D, OpenGL single-threaded and OpenGL multi-threaded performance by drawing them next to eachother. They stitched together these PNG files usingVirtualdub. These colorful images soon became a great way to communicate performance improvements to vendors and other associates.[/toggle]

Consequently, during the event, Kronos team released the new OpenGL 4.3 version coming with many features, visual enhancements and optimizations.

More news are expected from Valve’s Linux Blog someday during this week.

Categories: Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.