Mesa Lands New Single File Cache To Help Steam's Pre-Compiled Shaders, Space Savings

Written by Michael Larabel in Mesa on 21 February 2021 at 06:22 AM EST. 30 Comments
Mesa's on-disk shader cache, which is used for speeding up game load times by avoiding the redundant recompiling of shaders on successive loads and also helping performance for software that compiles shaders on-the-fly, is seeing a big improvement with Mesa 21.1. Mesa 21.1-devel merged this weekend the new single file cache implementation.

Mesa's new single file shader cache has been in the works by Valve contractor Timothy Arceri the past few months. The single file cache doesn't help with load times any further beyond the existing multi-file cache layout but can help in space savings. By tucking all the cached shaders into a single file is the possibility of better on-disk space savings. Arceri estimates the multi-file cache behavior as is used right now inflates disk usage by more than 3x of the single file cache.

The other driver though for the single file cache is making it easier to redistribute by third-party software, namely Steam with its pre-compiled shader caching and distributing of those shader caches to gamers to help in performance / load times.

This new implementation also adds an environment variable (MESA_DISK_CACHE_READ_ONLY_FOZ_DBS) that allows pointing to a read-only path for external shader cache databases. So once Mesa 21.1+ is out there, this will likely be used by Steam for more easily redistributing the shader caches to Linux gamers.

For the moment though this new single file cache isn't used by default but requires setting the MESA_DISK_CACHE_SINGLE_FILE=1 environment variable for enabling.

More details on this Mesa 21.1 addition via this honored merge request.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week