PC Optimization #shader cache#gpu optimization#nvidia

GPU Shader Cache Management in Windows 11

Clear NVIDIA and AMD shader caches, apply registry tweaks, and understand when GPU shader cache helps or hurts gaming performance.

7 min read

GPU Shader Cache Management in Windows 11

Shader compilation stutter is one of the most talked-about performance problems in modern PC gaming. Every time a game encounters a visual effect or shader combination it has not seen before, it must compile that shader on-the-fly — causing a freeze ranging from a few milliseconds to several seconds. The GPU shader cache is Windows and your driver’s answer to this problem: compiled shaders are saved to disk so they can be reloaded instantly the next time. Understanding where this cache lives, when to clear it, and how to tune its behavior separates smooth gameplay from constant micro-stutters.

How Shader Caching Works

Modern GPU APIs (DirectX 12, Vulkan, DirectX 11) require shaders to be compiled into GPU-native machine code before execution. This compilation is CPU-intensive and non-trivial. The driver maintains a disk-based cache of these compiled programs keyed by shader bytecode hash. On subsequent game launches, the driver checks the cache first — a cache hit means zero compilation latency.

The cache has limits. When it fills up, old entries are evicted using an LRU (Least Recently Used) policy. Corrupted cache entries can cause visual artifacts or crashes. Driver updates sometimes invalidate all cache entries, forcing a full rebuild on next launch.

NVIDIA Shader Cache

Cache Location

NVIDIA’s driver cache has two components:

Cache TypePath
DX11 shader cacheC:\Users\<User>\AppData\Local\NVIDIA\DXCache
DX12 / Vulkan cacheC:\Users\<User>\AppData\Local\NVIDIA\GLCache
Driver-managed cacheC:\ProgramData\NVIDIA Corporation\NV_Cache

The driver also stores application-specific compiled shaders in:

C:\Users\<User>\AppData\Local\D3DSCache

This D3DSCache folder is managed by Windows itself (not just NVIDIA) and is shared across vendors for DirectX shader compilation results.

Clearing NVIDIA Cache

# Stop any running NVIDIA processes first
Stop-Process -Name "nvcontainer" -ErrorAction SilentlyContinue
Stop-Process -Name "nvsphelper64" -ErrorAction SilentlyContinue

# Clear DX caches
Remove-Item "$env:LOCALAPPDATA\NVIDIA\DXCache\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\NVIDIA\GLCache\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\D3DSCache\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\ProgramData\NVIDIA Corporation\NV_Cache\*" -Recurse -Force -ErrorAction SilentlyContinue

Write-Host "NVIDIA shader cache cleared."

NVIDIA Control Panel Cache Settings

In NVIDIA Control PanelManage 3D SettingsGlobal Settings:

  • Shader Cache Size: Default is 10 GB. For large open-world games with many unique shaders, increase this to 100 GB if you have SSD space to spare. A larger cache means fewer evictions and less on-the-fly compilation.
  • OpenGL Shader Cache Policy: Set to All to cache shaders from all OpenGL applications.

AMD Shader Cache

Cache Location

AMD’s DirectX and Vulkan shader caches live here:

Cache TypePath
AMD DX cacheC:\Users\<User>\AppData\Local\AMD\DxCache
AMD Vulkan cacheC:\Users\<User>\AppData\Local\AMD\VkCache
Windows D3DSCache (shared)C:\Users\<User>\AppData\Local\D3DSCache

AMD drivers also maintain a driver-level cache in:

C:\ProgramData\AMD\<driver version>\Cache

Clearing AMD Cache

# Clear AMD shader caches
Remove-Item "$env:LOCALAPPDATA\AMD\DxCache\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\AMD\VkCache\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\D3DSCache\*" -Recurse -Force -ErrorAction SilentlyContinue

# Clear driver-level cache (adjust version number)
$amdCache = "C:\ProgramData\AMD"
if (Test-Path $amdCache) {
    Get-ChildItem $amdCache -Recurse -Filter "*.cache" | Remove-Item -Force -ErrorAction SilentlyContinue
}

Write-Host "AMD shader cache cleared."

AMD Software Settings

In AMD Software: Adrenalin EditionGamingGraphicsAdvanced:

  • Shader Cache: Ensure this is Enabled. Disabling it eliminates stutters from cache misses being written to disk, but massively increases in-game compilation pauses.
  • Texture Cache Size Limit: Leave at driver default unless you are on a storage-constrained system.

Windows D3DSCache Registry Tweaks

Windows maintains its own DirectX shader cache separate from vendor caches. You can tune its behavior via registry:

# Increase D3DSCache size limit (default ~256 MB, raise to 4096 MB)
$d3dPath = "HKLM:\SOFTWARE\Microsoft\Direct3D"
If (-not (Test-Path $d3dPath)) {
    New-Item -Path $d3dPath -Force | Out-Null
}
New-ItemProperty -Path $d3dPath -Name "ShaderCacheSizeInMB" `
    -Value 4096 -PropertyType DWord -Force

Write-Host "D3DSCache size set to 4 GB"

Additionally, you can disable the cache size throttle that Windows applies when the system disk is near capacity:

New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Direct3D" `
    -Name "DisableShaderDiskCache" -Value 0 -PropertyType DWord -Force

Ensure DisableShaderDiskCache is 0 (zero = cache enabled). A value of 1 disables disk caching entirely.

When to Clear the Shader Cache

SituationAction
After a GPU driver updateClear all caches — old compiled shaders are incompatible
Experiencing visual artifactsClear caches — corrupted entries are the likely cause
Game stutters disappeared then returnedDriver updated silently; clear and let rebuild
First launch of a new gameNo need — cache will populate on first playthrough
Routine maintenanceNot necessary; Windows manages eviction automatically

The most important trigger is after any driver update. NVIDIA and AMD drivers are supposed to invalidate their own caches on update, but this does not always happen cleanly — especially with third-party tools like DDU (Display Driver Uninstaller) involved.

Performance Impact: Cache Hit vs. Cache Miss

To understand the stakes, here is what happens in each scenario:

Cache Hit: Driver loads pre-compiled shader blob from disk → GPU executes immediately. Latency: ~1 ms.

Cache Miss: Driver compiles shader from DXBC/SPIR-V bytecode on CPU → stores to cache → GPU executes. Latency: 50 ms to 2000 ms depending on shader complexity.

In a game with thousands of unique shaders (Cyberpunk 2077 has over 100,000), a cold cache on first launch means the first playthrough is a compilation marathon. Subsequent launches skip that pain entirely — unless the cache was cleared needlessly.

Practical Recommendations

  • Do not clear caches routinely. Unlike browser caches, GPU shader caches do not become “dirty” with stale data under normal conditions.
  • Do clear after driver updates if you notice new stutters in previously smooth games.
  • Increase cache size limits for NVIDIA users via the Control Panel if you play multiple large games.
  • Keep shader cache on an SSD, not an HDD. Cache reads from a spinning disk add latency that partially defeats the purpose.
  • Monitor cache size with PowerShell if you are on a constrained SSD:
$paths = @(
    "$env:LOCALAPPDATA\NVIDIA\DXCache",
    "$env:LOCALAPPDATA\NVIDIA\GLCache",
    "$env:LOCALAPPDATA\AMD\DxCache",
    "$env:LOCALAPPDATA\D3DSCache"
)
foreach ($p in $paths) {
    if (Test-Path $p) {
        $size = (Get-ChildItem $p -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1MB
        Write-Host "$p : $([math]::Round($size, 1)) MB"
    }
}

Shader cache management is a low-effort, high-reward discipline. The five minutes spent understanding your cache locations pays dividends in smoother gameplay across every session.

#windows 11 #amd #nvidia #gpu optimization #shader cache