diff options
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.h')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index bb8dfe1111..0acbdfb361 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -98,17 +98,24 @@ public: // This texture entry is used by the other entry as a sub-texture void CreateReference(TCacheEntryBase* other_entry) { + // References are two-way, so they can easily be destroyed later this->references.emplace(other_entry); other_entry->references.emplace(this); } + void DestroyAllReferences() + { + for (auto& reference : references) + reference->references.erase(this); + + references.clear(); + } + void SetEfbCopy(u32 stride); - void Reset(); // Prepare for reuse TCacheEntryBase(const TCacheEntryConfig& c) : config(c) {} virtual ~TCacheEntryBase(); - virtual void Bind(unsigned int stage) = 0; virtual bool Save(const std::string& filename, unsigned int level) = 0; @@ -179,7 +186,9 @@ private: static TCacheEntryBase* AllocateTexture(const TCacheEntryConfig& config); static TexCache::iterator GetTexCacheIter(TCacheEntryBase* entry); - static TexCache::iterator FreeTexture(TexCache::iterator t_iter); + + // Removes and unlinks texture from texture cache and returns it to the pool + static TexCache::iterator InvalidateTexture(TexCache::iterator t_iter); static TCacheEntryBase* ReturnEntry(unsigned int stage, TCacheEntryBase* entry); |
