Flag replaced/scaled textures so we don't reuse.

Otherwise, we may try to use the replaceImages path, and end up with a
small updated texture in the top left of a large replaced texture.
This commit is contained in:
Unknown W. Brackets committed 2016-06-06 19:35:58 -07:00
1 parent ce8d2bef57
commit fc77e2f8fc
4 files changed
+13 -3

No files matched your search

+4 -1
View File
@@ -1336,7 +1336,7 @@ bool TextureCache::HandleTextureChange(TexCacheEntry *const entry, const char *r
gpuStats.numTextureInvalidations++;
DEBUG_LOG(G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason);
if (doDelete) {
if (initialMatch && standardScaleFactor_ == 1) {
if (initialMatch && standardScaleFactor_ == 1 && (entry->status & TexCacheEntry::STATUS_IS_SCALED) == 0) {
// Actually, if size and number of levels match, let's try to avoid deleting and recreating.
// Instead, let's use glTexSubImage to replace the images.
replaceImages = true;
@@ -1345,6 +1345,7 @@ bool TextureCache::HandleTextureChange(TexCacheEntry *const entry, const char *r
lastBoundTexture = INVALID_TEX;
}
glDeleteTextures(1, &entry->textureName);
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
}
}
// Clear the reliable bit if set.
@@ -1435,6 +1436,7 @@ void TextureCache::BuildTexture(TexCacheEntry *const entry, bool replaceImages)
if (replaced.GetSize(0, w, h)) {
// We're replacing, so we won't scale.
scaleFactor = 1;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
if (g_Config.bMipMap) {
maxLevel = replaced.MaxLevel();
badMipSizes = false;
@@ -1456,6 +1458,7 @@ void TextureCache::BuildTexture(TexCacheEntry *const entry, bool replaceImages)
scaleFactor = 1;
} else {
entry->status &= ~TexCacheEntry::STATUS_TO_SCALE;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
texelsScaledThisFrame_ += w * h;
}
}