MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / PurgeOldTextures

Method PurgeOldTextures

Source/HLEGraphics/TextureCache.cpp:76–106  ·  view source on GitHub ↗

Purge any textures that haven't been used recently

Source from the content-addressed store, hash-verified

74
75// Purge any textures that haven't been used recently
76void CTextureCache::PurgeOldTextures()
77{
78 MutexLock lock(GetDebugMutex());
79
80 //
81 // Erase expired textures in reverse order, which should require less
82 // copying when large clumps of textures are released simultaneously.
83 //
84 for( s32 i = mTextures.size() - 1; i >= 0; --i )
85 {
86 CachedTexture * texture = mTextures[ i ];
87 if ( texture->HasExpired() )
88 {
89 u32 ixa = MakeHashIdxA( texture->GetTextureInfo() );
90 u32 ixb = MakeHashIdxB( texture->GetTextureInfo() );
91
92 if( mpCacheHashTable[ixa] == texture )
93 {
94 mpCacheHashTable[ixa] = nullptr;
95 }
96 if( mpCacheHashTable[ixb] == texture )
97 {
98 mpCacheHashTable[ixb] = nullptr;
99 }
100
101 mTextures.erase( mTextures.begin() + i );
102
103 delete texture;
104 }
105 }
106}
107
108void CTextureCache::DropTextures()
109{

Callers 1

DLParser_ProcessFunction · 0.80

Calls 2

sizeMethod · 0.80
HasExpiredMethod · 0.80

Tested by

no test coverage detected