NVIDIA's OpenGL Shader Disk Cache For Linux

One of the features that NVIDIA introduced in the 290.03 Beta Linux driver that was released on Friday is support for an OpenGL shader disk cache.

NVIDIA's OpenGL shader disk cache option for Linux allows compiled shaders to be cached to the system disk in a temporary area so that they don't need to be re-compiled again later on, which can potentially save time by just pulling these binaries from the disk instead. This OpenGL shader disk cache feature is also supported by the proprietary Solaris and FreeBSD x86/x86_64 drivers, which were also released on Friday at version 290.03 Beta.

For those wondering more about the OpenGL shader disk cache option, below is the information extracted from the NVIDIA 290.03 read-me concerning this feature. This feature is enabled by default when using direct rendering and not running as root, but it can be configured via environmental variables and a xorg.conf option.

The NVIDIA OpenGL driver utilizes a shader disk cache. This optimization benefits some applications, by reusing shader binaries instead of compiling them repeatedly. The related environment variables __GL_SHADER_DISK_CACHE and __GL_SHADER_DISK_CACHE_PATH, as well as the GLShaderDiskCache X configuration option, allow fine-grained configuration of the shader cache behavior. The shader disk cache:

1. is always disabled for indirect rendering

2. is always disabled for setuid and setgid binaries

3. by default, is disabled for direct rendering when the OpenGL application is run as the root user

4. by default, is enabled for direct rendering when the OpenGL application is run as a non-root user

The GLShaderDiskCache X configuration option forcibly enables or disables the shader disk cache, for direct rendering as a non-root user.

By default, caches are stored in $HOME/.nv/GLCache. Caches are persistent across runs of an application. Cached shader binaries are specific to each driver version; changing driver versions will cause binaries to be recompiled.

Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via Twitter and Google+ or contacted via MichaelLarabel.com.