Valve-Sponsored Mesa Work Makes Games Load A Lot Faster

Written by Michael Larabel in Mesa on 4 May 2014 at 11:58 PM EDT. 56 Comments
MESA
Improvements to Mesa done by LunarG and sponsored by Valve in a new open-source patch-set means that popular Linux games should take significantly less time to load -- including titles like Dota 2 and Counter-Strike: Global Offensive -- by speeding up the shader compilation process.

Chia-I Wu recently sent out a set of 21 patches for Mesa that add a thread pool to Mesa's GLSL compiler and a new DRI option for defering glCompileShader calls to this pool. These changes are to reduce start-up time of applications that can handle defered compilation of GLSL shaders. When going through this thread pool, the shader compilation process is much faster across multiple threads while returning asynchronously with the compile shader call.

Intel's Ian Romanick has begun reviewing the patches. Pierre-Loup A. Griffais followed-up to explain the benefits at length. Pierre-Loup says that the shader compilation time on OpenGL is a real problem for both developers and users while in the Direct3D world threaded shader compiles and lazy shader reflection have been around for a long time.

When testing the patches, Dota 2 is running with a 20 second reduction in loading times across the board for an Intel-powered Gigabyte Brix Pro system. Valve is already merging these patches into their SteamOS Mesa branch and will be shipping it as part of their next driver release cycle for SteamOS.

Aside from needing a patched version of Mesa, the DRIRC option also needs to be set for this deferred and threaded OpenGL shader compilation process, but Pierre-Loup also mentioned they are already working on updated builds of Counter-Strike: Global Offensive and Dota 2 for Linux to automatically take advantage of the feature. Valve is also encouraging other game developers to begin taking advantage of this feature. This statement is also very interesting since Valve hasn't publicly released Counter-Strike: Global Offensive to Linux gamers, but we know it's already been ported and Linux driver developers have been working to optimize CS:GO -- hopefully with a better open-source experience, CS:GO could be publicly released for Linux/SteamOS gamers.
Some more context on the intent: we're having this work done because shader compilation time on OpenGL is a real issue that both end-users and developers run into on a daily basis. Threaded compiles and lazy shader reflection have been part of the D3D ecosystem for a long while. Here's a sample that contains several data points to put this into perspective:

https://github.com/ValveSoftware/Dota-2/issues/661

I'm happy to say that when applying this patch series to my Mesa branch and changing ToGL in DOTA2 to perform lazy shader reflection, I'm seeing a 20s reduction in loading times across the board on a Brix Pro machine, from starting the client to getting in-game.

This is a very promising start and I will be merging this patch series to the SteamOS Mesa branch, and ship it as part of our next driver release cycle.

We will also be releasing updated builds of CS:GO and DOTA2 for Linux to take advantage of that feature; we encourage developers shipping on Linux to use that same pattern when compiling their shaders as well as enabling this new feature in their environment, as it's too good to pass on.

Thanks a lot,
- Pierre-Loup
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week