mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-11 15:44:15 +00:00
Allow texture scaling on changed textures.
But only if they don't change very frequently. Should fix #1934.
This commit is contained in:
parent
6c90f4bcf7
commit
9680a7ccc7
@ -47,6 +47,9 @@
|
|||||||
// Try to be prime to other decimation intervals.
|
// Try to be prime to other decimation intervals.
|
||||||
#define TEXCACHE_DECIMATION_INTERVAL 13
|
#define TEXCACHE_DECIMATION_INTERVAL 13
|
||||||
|
|
||||||
|
// Changes more frequent than this will be considered "frequent" and prevent texture scaling.
|
||||||
|
#define TEXCACHE_FRAME_CHANGE_FREQUENT 15
|
||||||
|
|
||||||
#ifndef GL_UNPACK_ROW_LENGTH
|
#ifndef GL_UNPACK_ROW_LENGTH
|
||||||
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||||
#endif
|
#endif
|
||||||
@ -992,6 +995,9 @@ void TextureCache::SetTexture(bool force) {
|
|||||||
if (hashFail) {
|
if (hashFail) {
|
||||||
match = false;
|
match = false;
|
||||||
entry->status |= TexCacheEntry::STATUS_UNRELIABLE;
|
entry->status |= TexCacheEntry::STATUS_UNRELIABLE;
|
||||||
|
if (entry->numFrames < TEXCACHE_FRAME_CHANGE_FREQUENT) {
|
||||||
|
entry->status |= TexCacheEntry::STATUS_CHANGE_FREQUENT;
|
||||||
|
}
|
||||||
entry->numFrames = 0;
|
entry->numFrames = 0;
|
||||||
|
|
||||||
// Don't give up just yet. Let's try the secondary cache if it's been invalidated before.
|
// Don't give up just yet. Let's try the secondary cache if it's been invalidated before.
|
||||||
@ -1048,8 +1054,9 @@ void TextureCache::SetTexture(bool force) {
|
|||||||
glDeleteTextures(1, &entry->texture);
|
glDeleteTextures(1, &entry->texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entry->status == TexCacheEntry::STATUS_RELIABLE) {
|
// Clear the reliable bit if set.
|
||||||
entry->status = TexCacheEntry::STATUS_HASHING;
|
if ((entry->status & TexCacheEntry::STATUS_MASK) == TexCacheEntry::STATUS_RELIABLE) {
|
||||||
|
entry->status &= ~TexCacheEntry::STATUS_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1551,10 +1558,10 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replac
|
|||||||
scaleFactor = 1;
|
scaleFactor = 1;
|
||||||
|
|
||||||
u32 *pixelData = (u32 *)finalBuf;
|
u32 *pixelData = (u32 *)finalBuf;
|
||||||
if (scaleFactor > 1 && entry.numInvalidated == 0)
|
if (scaleFactor > 1 && (entry.status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0)
|
||||||
scaler.Scale(pixelData, dstFmt, w, h, scaleFactor);
|
scaler.Scale(pixelData, dstFmt, w, h, scaleFactor);
|
||||||
// Or always?
|
|
||||||
if (entry.numInvalidated == 0)
|
if ((entry.status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0)
|
||||||
CheckAlpha(entry, pixelData, dstFmt, w, h);
|
CheckAlpha(entry, pixelData, dstFmt, w, h);
|
||||||
else
|
else
|
||||||
entry.status |= TexCacheEntry::STATUS_ALPHA_UNKNOWN;
|
entry.status |= TexCacheEntry::STATUS_ALPHA_UNKNOWN;
|
||||||
|
@ -72,14 +72,16 @@ private:
|
|||||||
|
|
||||||
enum Status {
|
enum Status {
|
||||||
STATUS_HASHING = 0x00,
|
STATUS_HASHING = 0x00,
|
||||||
STATUS_RELIABLE = 0x01, // cache, don't hash
|
STATUS_RELIABLE = 0x01, // Don't bother rehashing.
|
||||||
STATUS_UNRELIABLE = 0x02, // never cache
|
STATUS_UNRELIABLE = 0x02, // Always recheck hash.
|
||||||
STATUS_MASK = 0x03,
|
STATUS_MASK = 0x03,
|
||||||
|
|
||||||
STATUS_ALPHA_UNKNOWN = 0x04,
|
STATUS_ALPHA_UNKNOWN = 0x04,
|
||||||
STATUS_ALPHA_FULL = 0x00, // Has no alpha channel, or always full alpha.
|
STATUS_ALPHA_FULL = 0x00, // Has no alpha channel, or always full alpha.
|
||||||
STATUS_ALPHA_SIMPLE = 0x08, // Like above, but also has 0 alpha (e.g. 5551.)
|
STATUS_ALPHA_SIMPLE = 0x08, // Like above, but also has 0 alpha (e.g. 5551.)
|
||||||
STATUS_ALPHA_MASK = 0x0c,
|
STATUS_ALPHA_MASK = 0x0c,
|
||||||
|
|
||||||
|
STATUS_CHANGE_FREQUENT = 0x10, // Changes often (less than 15 frames in between.)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Status, but int so we can zero initialize.
|
// Status, but int so we can zero initialize.
|
||||||
|
Loading…
Reference in New Issue
Block a user