If an entry already exists in the secondary texture cache, delete it properly. Fixes #9503

This commit is contained in:
Henrik Rydgard committed 2017-03-26 18:33:11 +02:00
1 parent 67fb745278
commit c8187dd35c
1 file changed
+7
+7
View File
@@ -1484,6 +1484,13 @@ bool TextureCacheCommon::CheckFullHash(TexCacheEntry *entry, bool &doDelete) {
} else {
secondKey = entry->fullhash | ((u64)entry->cluthash << 32);
secondCacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
// If the entry already exists in the secondary texture cache, drop it nicely.
auto oldIter = secondCache_.find(secondKey);
if (oldIter != secondCache_.end()) {
ReleaseTexture(oldIter->second.get(), true);
}
// Is this wise? We simply copy the entry.
secondCache_[secondKey].reset(new TexCacheEntry(*entry));