Quick answer: Shader cache rebuilding on every launch after a GPU driver update? The cache key needs to include driver version - hash it into the cache filename to invalidate cleanly.
Player updates their NVIDIA driver. Next launch takes 90 seconds to compile shaders. Subsequent launches take 90 seconds too - the cache isn't being written.
Include driver version in cache key
auto key = hash(shader_hash, driver_version,
api_version, platform);Driver upgrades invalidate the cache; subsequent launches re-use the new build. Without it, an old cache might be loaded by a driver that can't read it - silent skip.
Persist to platform cache dir
Use %LOCALAPPDATA%/YourGame/Shaders on Windows, ~/Library/Caches on macOS. Avoids antivirus issues that delete files in unusual paths.
Telemetry the compile time
Log shader compile duration on each launch. A sudden jump indicates cache invalidation; if it stays high, the cache isn't being written.
“Shader cache hits are worth a hundred microoptimizations.”
For your own iteration, ship a developer command to force a cache rebuild. Faster than deleting the directory by hand.