Skip to content

Commit

Permalink
Get rid of deferred freeing of textures.
Browse files Browse the repository at this point in the history
Apparently, it isn't actually necessary, at least for the moment.
  • Loading branch information
magumagu committed Feb 16, 2015
1 parent 179ee86 commit 1e60187
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
26 changes: 4 additions & 22 deletions Source/Core/VideoCommon/TextureCacheBase.cpp
Expand Up @@ -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::TCacheEntryBase*> TextureCache::to_free_list;

TextureCache::BackupConfig TextureCache::backup_config;

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/VideoCommon/TextureCacheBase.h
Expand Up @@ -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);

Expand All @@ -188,7 +187,6 @@ class TextureCache
static TexCache textures;
static TexPool texture_pool;
static TCacheEntryBase* bound_textures[8];
static std::vector<TCacheEntryBase*> to_free_list;

// Backup configuration values
static struct BackupConfig
Expand Down

0 comments on commit 1e60187

Please sign in to comment.