summaryrefslogtreecommitdiffstats
path: root/tools/gfx/persistent-shader-cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/persistent-shader-cache.cpp')
-rw-r--r--tools/gfx/persistent-shader-cache.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/gfx/persistent-shader-cache.cpp b/tools/gfx/persistent-shader-cache.cpp
index 55a95a257..fdf91fbe8 100644
--- a/tools/gfx/persistent-shader-cache.cpp
+++ b/tools/gfx/persistent-shader-cache.cpp
@@ -68,6 +68,12 @@ void PersistentShaderCache::loadCacheFromFile()
ShaderCacheEntry entry = { dependencyDigest, astDigest };
auto entryNode = entries.AddLast(entry);
keyToEntry.Add(dependencyDigest, entryNode);
+
+ // If there are more entries present in the cache file than the entry count limit allows,
+ // ignore the rest. Since we output the lines in the cache file in order of most to least
+ // recently used, the cache's behavior will still be correct.
+ if (desc.entryCountLimit > 0 && entries.Count() == desc.entryCountLimit)
+ break;
}
}