Purge any textures that haven't been used recently
| 74 | |
| 75 | // Purge any textures that haven't been used recently |
| 76 | void 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 | |
| 108 | void CTextureCache::DropTextures() |
| 109 | { |
no test coverage detected