MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / IncreaseSpriteLRU

Function IncreaseSpriteLRU

src/spritecache.cpp:762–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762void IncreaseSpriteLRU()
763{
764 int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
765 uint target_size = (bpp > 0 ? _sprite_cache_size * bpp / 8 : 1) * 1024 * 1024;
766 if (_spritecache_bytes_used > target_size) {
767 DeleteEntriesFromSpriteCache(_spritecache_bytes_used - target_size + 512 * 1024);
768 }
769
770 if (_sprite_lru_counter >= 0xC0000000) {
771 Debug(sprite, 3, "Fixing lru {}, inuse={}", _sprite_lru_counter, _spritecache_bytes_used);
772
773 for (SpriteCache &sc : _spritecache) {
774 if (sc.ptr != nullptr) {
775 if (sc.lru > 0x80000000) {
776 sc.lru -= 0x80000000;
777 } else {
778 sc.lru = 0;
779 }
780 }
781 }
782 _sprite_lru_counter -= 0x80000000;
783 }
784}
785
786void SpriteCache::ClearSpriteData()
787{

Callers 1

GameLoopFunction · 0.85

Calls 2

GetScreenDepthMethod · 0.45

Tested by

no test coverage detected