From 1e601871741906a7149c2b883e89908bc9cbaf9b Mon Sep 17 00:00:00 2001 From: magumagu Date: Mon, 16 Feb 2015 11:54:42 -0800 Subject: [PATCH] Get rid of deferred freeing of textures. Apparently, it isn't actually necessary, at least for the moment. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 26 +++----------------- Source/Core/VideoCommon/TextureCacheBase.h | 2 -- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 6d40e788b588..51bd98286dca 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -33,7 +33,6 @@ size_t TextureCache::temp_size; TextureCache::TexCache TextureCache::textures; TextureCache::TexPool TextureCache::texture_pool; TextureCache::TCacheEntryBase* TextureCache::bound_textures[8]; -std::vector TextureCache::to_free_list; TextureCache::BackupConfig TextureCache::backup_config; @@ -258,10 +257,6 @@ void TextureCache::BindTextures() void TextureCache::UnbindTextures() { - for (auto entry : to_free_list) - FreeTexture(entry); - to_free_list.clear(); - std::fill(std::begin(bound_textures), std::end(bound_textures), nullptr); } @@ -380,10 +375,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) auto decoded_entry_iter = textures.find(paletteDecodedID); if (decoded_entry_iter != textures.end()) { - // Pool this texture and make a new one later. We delay actually freeing - // the texture if it's currently bound; this can happen in edge cases - // involving multiple stages bound to the same address. - MaybeFreeTexture(decoded_entry_iter->second); + // Pool this texture and make a new one later. + FreeTexture(decoded_entry_iter->second); textures.erase(decoded_entry_iter); } @@ -409,10 +402,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) return ReturnEntry(stage, entry); } - // Pool this texture and make a new one later. We delay actually freeing - // the texture if it's currently bound; this can happen in edge cases involving - // multiple stages bound to the same address. - MaybeFreeTexture(entry); + // Pool this texture and make a new one later. + FreeTexture(entry); textures.erase(search_result); } @@ -868,15 +859,6 @@ TextureCache::TCacheEntryBase* TextureCache::AllocateTexture(const TCacheEntryCo return g_texture_cache->CreateTexture(config); } -void TextureCache::MaybeFreeTexture(TCacheEntryBase* entry) -{ - if (std::find(std::begin(bound_textures), std::end(bound_textures), entry)) - to_free_list.push_back(entry); - else - FreeTexture(entry); -} - - void TextureCache::FreeTexture(TCacheEntryBase* entry) { entry->frameCount = FRAMECOUNT_INVALID; diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index f6a227d86bf2..f5bb78a86f4f 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -178,7 +178,6 @@ class TextureCache static TCacheEntryBase* AllocateTexture(const TCacheEntryConfig& config); static void FreeTexture(TCacheEntryBase* entry); - static void MaybeFreeTexture(TCacheEntryBase* entry); static TCacheEntryBase* ReturnEntry(unsigned int stage, TCacheEntryBase* entry); @@ -188,7 +187,6 @@ class TextureCache static TexCache textures; static TexPool texture_pool; static TCacheEntryBase* bound_textures[8]; - static std::vector to_free_list; // Backup configuration values static struct BackupConfig