Document that shader cache key changes need a CACHE_VERSION bump

The OpenGL and Vulkan shader caches store raw shader IDs (and, for Vulkan,
pipeline keys) on disk. Add the rule to AGENTS.md and point to it from the
persisted types.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-29 09:35:17 -06:00
1 parent a9eacff1e1
commit 24b71386ff
4 files changed
+14

No files matched your search

+8
View File
@@ -74,6 +74,14 @@ for it:
to forget: put it last in the array even when alphabetical or NID order would put it elsewhere,
and even when the array is otherwise tidily sorted. The same rule governs the order of
`Register_*()` calls in `Core/HLE/HLETables.cpp` - new modules go at the very end.
4. **Changing a shader cache key means bumping `CACHE_VERSION`, in both the OpenGL and Vulkan
caches** (`GPU/GLES/ShaderManagerGLES.cpp` and `GPU/Vulkan/ShaderManagerVulkan.cpp`). Their
on-disk caches store raw key bits with nothing to tell an old layout from a new one. OpenGL
stores `VShaderID`/`FShaderID`, and Vulkan stores those plus `VulkanPipelineKey` (the raster
state key and the decoded vertex format ID). So adding, removing, moving or reinterpreting any
of those bits needs the bump, or an old cache precompiles shaders for keys that now mean
something else, including combinations the generators assert on. D3D11 doesn't store shader IDs
on disk. Keys that only live in memory, like `SamplerCacheKey`, don't need a bump.
## Build and validation