summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authormimimi085181 <mimimi085181@gmail.com>2015-06-09 21:45:09 +0200
committermimimi085181 <mimimi085181@gmail.com>2015-06-09 21:45:09 +0200
commit4d5fdb74bef15db9acc31cc12ce65d001af9fa74 (patch)
tree4ac2038c5380398e7dc12d144ba9fdf0ea5001d3 /Source/Core/VideoCommon/TextureCacheBase.cpp
parente47e4c677ad22895f8c8bc78676dd295e36f2695 (diff)
Code cleanup for FreeTexture after merging PR #2097
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 6ca71d037c..4d2d941a15 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -154,7 +154,7 @@ void TextureCache::Cleanup(int _frameCount)
// EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted
!iter->second->IsEfbCopy())
{
- iter = RemoveTextureFromCache(iter);
+ iter = FreeTexture(iter);
}
else
{
@@ -191,7 +191,7 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
{
if (iter->second->OverlapsMemoryRange(start_address, size))
{
- iter = RemoveTextureFromCache(iter);
+ iter = FreeTexture(iter);
}
else
{
@@ -388,8 +388,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
// never be useful again. It's theoretically possible for a game to do
// something weird where the copy could become useful in the future, but in
// practice it doesn't happen.
- FreeTexture(entry);
- iter = textures_by_address.erase(iter);
+ iter = FreeTexture(iter);
continue;
}
}
@@ -461,7 +460,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
if (temp_frameCount != 0x7fffffff)
{
// pool this texture and make a new one later
- RemoveTextureFromCache(oldest_entry);
+ FreeTexture(oldest_entry);
}
std::shared_ptr<HiresTexture> hires_tex;
@@ -885,7 +884,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
TexCache::iterator iter = iter_range.first;
while (iter != iter_range.second)
{
- iter = RemoveTextureFromCache(iter);
+ iter = FreeTexture(iter);
}
// create the texture
@@ -937,20 +936,18 @@ TextureCache::TCacheEntryBase* TextureCache::AllocateTexture(const TCacheEntryCo
return entry;
}
-TextureCache::TexCache::iterator TextureCache::RemoveTextureFromCache(TexCache::iterator iter)
+TextureCache::TexCache::iterator TextureCache::FreeTexture(TexCache::iterator iter)
{
- if (iter->second->textures_by_hash_iter != textures_by_address.end())
+ TCacheEntryBase* entry = iter->second;
+
+ if (entry->textures_by_hash_iter != textures_by_address.end())
{
- textures_by_hash.erase(iter->second->textures_by_hash_iter);
- iter->second->textures_by_hash_iter = textures_by_address.end();
+ textures_by_hash.erase(entry->textures_by_hash_iter);
+ entry->textures_by_hash_iter = textures_by_address.end();
}
- FreeTexture(iter->second);
- return textures_by_address.erase(iter);
-}
-
-void TextureCache::FreeTexture(TCacheEntryBase* entry)
-{
entry->frameCount = FRAMECOUNT_INVALID;
texture_pool.insert(TexPool::value_type(entry->config, entry));
+
+ return textures_by_address.erase(iter);
}