From 53eeb421c5341c405e09acac65431fac6f135261 Mon Sep 17 00:00:00 2001 From: Dom Chen Date: Fri, 13 Dec 2024 19:33:16 +0800 Subject: [PATCH] Fix an issue where GpuBuffers with valid UniqueKeys are mistakenly purged from cache. (#376) --- src/gpu/ResourceCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpu/ResourceCache.cpp b/src/gpu/ResourceCache.cpp index 1d24a712..4066aa76 100644 --- a/src/gpu/ResourceCache.cpp +++ b/src/gpu/ResourceCache.cpp @@ -230,7 +230,7 @@ void ResourceCache::processUnreferencedResources() { auto currentTime = std::chrono::steady_clock::now(); for (auto& resource : needToPurge) { RemoveFromList(nonpurgeableResources, resource); - if (!resource->scratchKey.empty()) { + if (!resource->scratchKey.empty() || resource->hasExternalReferences()) { AddToList(purgeableResources, resource); purgeableBytes += resource->memoryUsage(); resource->lastUsedTime = currentTime;