mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Include texture size in cache key.
This makes Tales of Destiny 2's towns significantly faster. It may however cause us to keep textures around for longer - but we still account for them in our metrics and invalidation.
This commit is contained in:
parent
49783edf6d
commit
58563324bd
2 changed files with 10 additions and 8 deletions
|
@ -1022,7 +1022,8 @@ bool TextureCacheDX9::SetOffsetTexture(u32 offset) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 cachekey = (u64)(texaddr & 0x3FFFFFFF) << 32;
|
const u16 dim = gstate.getTextureDimension(0);
|
||||||
|
u64 cachekey = ((u64)(texaddr & 0x3FFFFFFF) << 32) | dim;
|
||||||
TexCache::iterator iter = cache.find(cachekey);
|
TexCache::iterator iter = cache.find(cachekey);
|
||||||
if (iter == cache.end()) {
|
if (iter == cache.end()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1068,6 +1069,7 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const u16 dim = gstate.getTextureDimension(0);
|
||||||
int w = gstate.getTextureWidth(0);
|
int w = gstate.getTextureWidth(0);
|
||||||
int h = gstate.getTextureHeight(0);
|
int h = gstate.getTextureHeight(0);
|
||||||
|
|
||||||
|
@ -1080,7 +1082,7 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||||
bool hasClut = gstate.isTextureFormatIndexed();
|
bool hasClut = gstate.isTextureFormatIndexed();
|
||||||
|
|
||||||
// Ignore uncached/kernel when caching.
|
// Ignore uncached/kernel when caching.
|
||||||
u64 cachekey = (u64)(texaddr & 0x3FFFFFFF) << 32;
|
u64 cachekey = ((u64)(texaddr & 0x3FFFFFFF) << 32) | dim;
|
||||||
u32 cluthash;
|
u32 cluthash;
|
||||||
if (hasClut) {
|
if (hasClut) {
|
||||||
if (clutLastFormat_ != gstate.clutformat) {
|
if (clutLastFormat_ != gstate.clutformat) {
|
||||||
|
@ -1088,7 +1090,7 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||||
UpdateCurrentClut();
|
UpdateCurrentClut();
|
||||||
}
|
}
|
||||||
cluthash = GetCurrentClutHash() ^ gstate.clutformat;
|
cluthash = GetCurrentClutHash() ^ gstate.clutformat;
|
||||||
cachekey |= cluthash;
|
cachekey ^= cluthash;
|
||||||
} else {
|
} else {
|
||||||
cluthash = 0;
|
cluthash = 0;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1113,6 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||||
if (iter != cache.end()) {
|
if (iter != cache.end()) {
|
||||||
entry = &iter->second;
|
entry = &iter->second;
|
||||||
// Validate the texture still matches the cache entry.
|
// Validate the texture still matches the cache entry.
|
||||||
u16 dim = gstate.getTextureDimension(0);
|
|
||||||
bool match = entry->Matches(dim, format, maxLevel);
|
bool match = entry->Matches(dim, format, maxLevel);
|
||||||
|
|
||||||
// Check for FBO - slow!
|
// Check for FBO - slow!
|
||||||
|
|
|
@ -1195,7 +1195,8 @@ bool TextureCache::SetOffsetTexture(u32 offset) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 cachekey = (u64)(texaddr & 0x3FFFFFFF) << 32;
|
const u16 dim = gstate.getTextureDimension(0);
|
||||||
|
u64 cachekey = ((u64)(texaddr & 0x3FFFFFFF) << 32) | dim;
|
||||||
TexCache::iterator iter = cache.find(cachekey);
|
TexCache::iterator iter = cache.find(cachekey);
|
||||||
if (iter == cache.end()) {
|
if (iter == cache.end()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1241,6 +1242,7 @@ void TextureCache::SetTexture(bool force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const u16 dim = gstate.getTextureDimension(0);
|
||||||
int w = gstate.getTextureWidth(0);
|
int w = gstate.getTextureWidth(0);
|
||||||
int h = gstate.getTextureHeight(0);
|
int h = gstate.getTextureHeight(0);
|
||||||
|
|
||||||
|
@ -1253,7 +1255,7 @@ void TextureCache::SetTexture(bool force) {
|
||||||
bool hasClut = gstate.isTextureFormatIndexed();
|
bool hasClut = gstate.isTextureFormatIndexed();
|
||||||
|
|
||||||
// Ignore uncached/kernel when caching.
|
// Ignore uncached/kernel when caching.
|
||||||
u64 cachekey = (u64)(texaddr & 0x3FFFFFFF) << 32;
|
u64 cachekey = ((u64)(texaddr & 0x3FFFFFFF) << 32) | dim;
|
||||||
u32 cluthash;
|
u32 cluthash;
|
||||||
if (hasClut) {
|
if (hasClut) {
|
||||||
if (clutLastFormat_ != gstate.clutformat) {
|
if (clutLastFormat_ != gstate.clutformat) {
|
||||||
|
@ -1261,7 +1263,7 @@ void TextureCache::SetTexture(bool force) {
|
||||||
UpdateCurrentClut();
|
UpdateCurrentClut();
|
||||||
}
|
}
|
||||||
cluthash = GetCurrentClutHash() ^ gstate.clutformat;
|
cluthash = GetCurrentClutHash() ^ gstate.clutformat;
|
||||||
cachekey |= cluthash;
|
cachekey ^= cluthash;
|
||||||
} else {
|
} else {
|
||||||
cluthash = 0;
|
cluthash = 0;
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1284,6 @@ void TextureCache::SetTexture(bool force) {
|
||||||
if (iter != cache.end()) {
|
if (iter != cache.end()) {
|
||||||
entry = &iter->second;
|
entry = &iter->second;
|
||||||
// Validate the texture still matches the cache entry.
|
// Validate the texture still matches the cache entry.
|
||||||
u16 dim = gstate.getTextureDimension(0);
|
|
||||||
bool match = entry->Matches(dim, format, maxLevel);
|
bool match = entry->Matches(dim, format, maxLevel);
|
||||||
|
|
||||||
// Check for FBO - slow!
|
// Check for FBO - slow!
|
||||||
|
|
Loading…
Add table
Reference in a new issue