1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Remove cached texture if new texture with the same CRC has different dimensions.

Fixed Aidyn Chronicles menu icons enlarged or text cut #1420

Problem description:
I thought that the same texture must always have the same dimensions.
I was wrong. When Aidyn Chronicles menu opens,
menu textures clamp width or clamp height may change during menu opening animation.
CRC remains the same because texture data not changed.

Solution:
Remove cached texture when expected dimensions differ from actual ones and load texture again.
I hope it is a rare case.
This commit is contained in:
Sergey Lipskiy 2017-03-19 19:18:07 +07:00
parent d87ad2c3d6
commit f428234787

View File

@ -1535,16 +1535,22 @@ void TextureCache::update(u32 _t)
if (locations_iter != m_lruTextureLocations.end()) {
Textures::iterator iter = locations_iter->second;
CachedTexture & current = *iter;
m_textures.splice(m_textures.begin(), m_textures, iter);
assert(current.width == sizes.width);
assert(current.height == sizes.height);
assert(current.format == pTile->format);
assert(current.size == pTile->size);
if (current.width == sizes.width && current.height == sizes.height) {
m_textures.splice(m_textures.begin(), m_textures, iter);
activateTexture(_t, &current);
m_hits++;
return;
assert(current.format == pTile->format);
assert(current.size == pTile->size);
activateTexture(_t, &current);
m_hits++;
return;
}
m_cachedBytes -= current.textureBytes;
gfxContext.deleteTexture(current.name);
m_lruTextureLocations.erase(locations_iter);
m_textures.erase(iter);
}
m_misses++;