Shader Cache: What It Is and Why It Matters
In this article
A shader cache is a storage area on your computer where the graphics driver keeps compiled shader programs so it doesn't have to recompile them every time you launch a game or application. When a game starts, it sends shaders—small programs that control how pixels are rendered—to the GPU. Compiling these shaders takes CPU time and can cause stuttering if done on the fly. By saving the compiled result, the cache makes subsequent launches faster and smoother. This article explains how shader caches work, where they live, common problems, and how to manage them.
Background: Why Shaders Need Caching
Shaders are written in high-level languages like HLSL (DirectX) or GLSL (OpenGL). The GPU doesn't execute these directly; it runs machine code. The graphics driver translates the shader source into GPU-specific instructions—a process called compilation. This compilation can take anywhere from a few milliseconds to several seconds per shader, depending on complexity. A modern game might use thousands of unique shaders, so compiling them all at launch could cause long loading times or stutter when a new shader appears mid-game. Caching avoids that by storing the compiled binaries so they can be loaded instantly next time.
How Shader Cache Works
When you first run a game, the driver compiles shaders and writes them to a cache folder on your disk. The cache is keyed by the game's executable, the GPU model, and the driver version. On subsequent launches, the driver checks if a cached entry exists and loads it directly. Some drivers also cache shaders during gameplay (incremental caching) to handle shaders that weren't compiled at startup. The cache is typically stored in a system directory, not inside the game folder, so it persists across game updates and even reinstalls.
There are two main types of shader caches:
- Driver-managed cache: Automatically maintained by the GPU driver (e.g., NVIDIA, AMD, Intel). It has a size limit and evicts old entries.
- Game-managed cache: Some games (especially PC ports) pre-compile shaders during a one-time setup or on first launch, storing them in the game's own folder.
Where Is the Shader Cache Stored?
The location varies by GPU vendor and operating system:
- NVIDIA (Windows):
%ProgramData%\NVIDIA Corporation\NV_Cache(older drivers) or%ProgramData%\NVIDIA Corporation\Downloader(newer). - AMD (Windows):
%ProgramData%\AMD\(older) or%AppData%\Local\AMD\DxCacheandGLCache. - Intel (Windows):
%AppData%\Local\Intel\ShaderCache. - Linux (various): Often under
~/.cacheor~/.local/sharedepending on the driver (e.g., Mesa stores in~/.cache/mesa_shader_cache).
These folders can grow large—sometimes several gigabytes—but the driver manages them automatically. You can manually delete the contents to force a fresh build, but that will cause temporary stutter until the cache rebuilds.
Common Problems and Misconceptions
One common misconception is that clearing the shader cache will improve performance. In reality, it usually makes performance worse initially because the game has to recompile everything, causing stutter. Another issue is that a corrupted cache (e.g., after a driver update) can cause visual glitches or crashes. In that case, clearing the cache is the fix. Also, some users worry that the cache is a security risk—it's just compiled shader code, not executable by the user, so it's harmless.
A frequent problem on PC is shader compilation stutter in games that don't pre-cache. This happens when the game encounters a shader for the first time. Solutions include running the game once to build the cache, using a game's 'pre-compile' option if available, or using third-party tools that share pre-built caches (though that's not officially supported).
How to Manage Shader Cache
Most users don't need to touch the shader cache. However, if you're troubleshooting, here's what you can do:
- Clear the cache: Close all games, then delete the contents of the cache folder listed above. The driver will rebuild it next time you run a game.
- Set a size limit (NVIDIA): In the NVIDIA Control Panel, go to Manage 3D Settings > Shader Cache Size and choose a limit (e.g., 10 GB or unlimited). Larger limits reduce stutter but use more disk space.
- Disable it (not recommended): Some drivers allow disabling the cache entirely, but this will cause severe stutter in most games.
Note that after a driver update, the cache is often invalidated automatically because the compiled code may differ between driver versions.
Shader Cache vs Pre-Compiled Shaders
Some games (like many console ports) include a pre-compiled shader pack that ships with the game. This is different from a shader cache: it's a static set of compiled shaders that the game uses directly, and it doesn't change based on your hardware. A shader cache, on the other hand, is built specifically for your GPU and driver. Pre-compiled shaders are why some games have a one-time 'optimizing' step on first launch—they're building the cache for your system.
Another related term is 'shader compilation'—the process itself. Caching is just the storage of the result.
Frequently Asked Questions
Does clearing shader cache improve FPS?
No. It usually reduces FPS temporarily because the game has to recompile shaders, causing stutter. Only clear it if you suspect corruption or after a driver update that causes issues.
Why does my shader cache folder keep growing?
Every new game or update adds more entries. The driver is supposed to evict old ones, but sometimes it doesn't, so the folder can grow large. You can manually delete it, but it's safe to leave it.
Is it safe to delete shader cache?
Yes, it's safe. The driver will rebuild it next time you run a game. You might notice stutter for the first few minutes after deletion.
Why do some games stutter even with shader cache?
If the game uses dynamic shaders that are created at runtime, they can't be pre-cached. Also, if the cache is disabled or too small, the driver may evict entries frequently.
Can I move the shader cache to another drive?
Not easily—the location is hardcoded by the driver. Some third-party tools offer to redirect it, but they're not officially supported and can cause issues.
Does shader cache affect VRAM usage?
No, shader cache is stored on disk, not in VRAM. It only affects disk space and loading times.