NVIDIA's OpenGL Shader Disk Cache For Linux

Written by Michael Larabel in NVIDIA on 23 October 2011 at 09:53 AM EDT. 10 Comments
NVIDIA
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.

The following environment variables configure shader disk cache behavior, and override the GLShaderDiskCache configuration option:

Environment Variable Description
---------------------------------- ----------------------------------
__GL_SHADER_DISK_CACHE (boolean) Enables or disables the shader cache for direct rendering.
__GL_SHADER_DISK_CACHE_PATH (string) Enables configuration of where shader caches are stored on disk.

For more information on the other features to this first 290 series Linux/FreeBSD/Solaris driver beta, see the earlier news announcement (and for the download links).

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