Merge pull request #2249 from unknownbrackets/texcache

Re-enable subimage optimization with scaling check
This commit is contained in:
Henrik Rydgård 2013-06-14 00:17:01 -07:00
commit 3908bf537f

View File

@ -1030,21 +1030,18 @@ void TextureCache::SetTexture() {
entry->numInvalidated++;
gpuStats.numTextureInvalidations++;
INFO_LOG(G3D, "Texture different or overwritten, reloading at %08x", texaddr);
if (doDelete) {
if (entry->maxLevel == maxLevel && entry->dim == (gstate.texsize[0] & 0xF0F) && entry->format == format) {
// 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 = g_Config.iTexScalingLevel <= 1;
} else {
if (entry->texture == lastBoundTexture) {
lastBoundTexture = -1;
}
if (doDelete) {
// TODO: This stuff is missing some check, its causes corruption. See issue #2222 .
/*
if (entry->maxLevel == maxLevel && entry->dim == (gstate.texsize[0] & 0xF0F)) {
// 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;
} else {
glDeleteTextures(1, &entry->texture);
}*/
glDeleteTextures(1, &entry->texture);
}
}
if (entry->status == TexCacheEntry::STATUS_RELIABLE) {
entry->status = TexCacheEntry::STATUS_HASHING;
}