TexCache: Choose texture based on mipmap count

This commit is contained in:
degasus 2015-01-11 22:41:04 +01:00
parent 744b1c1624
commit a9eb08b85d
2 changed files with 6 additions and 4 deletions

View File

@ -383,7 +383,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
// 2. b) For normal textures, all texture parameters need to match // 2. b) For normal textures, all texture parameters need to match
if (address == entry->addr && tex_hash == entry->hash && full_format == entry->format && if (address == entry->addr && tex_hash == entry->hash && full_format == entry->format &&
entry->config.levels >= tex_levels && entry->native_width == nativeW && entry->native_height == nativeH) entry->native_levels >= tex_levels && entry->native_width == nativeW && entry->native_height == nativeH)
{ {
return ReturnEntry(stage, entry); return ReturnEntry(stage, entry);
} }
@ -476,7 +476,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
} }
entry->SetGeneralParameters(address, texture_size, full_format); entry->SetGeneralParameters(address, texture_size, full_format);
entry->SetDimensions(nativeW, nativeH); entry->SetDimensions(nativeW, nativeH, tex_levels);
entry->hash = tex_hash; entry->hash = tex_hash;
// load texture // load texture
@ -873,7 +873,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
// TODO: Using the wrong dstFormat, dumb... // TODO: Using the wrong dstFormat, dumb...
entry->SetGeneralParameters(dstAddr, 0, dstFormat); entry->SetGeneralParameters(dstAddr, 0, dstFormat);
entry->SetDimensions(tex_w, tex_h); entry->SetDimensions(tex_w, tex_h, 1);
entry->SetHashes(TEXHASH_INVALID); entry->SetHashes(TEXHASH_INVALID);
entry->type = TCET_EC_VRAM; entry->type = TCET_EC_VRAM;
} }

View File

@ -47,6 +47,7 @@ public:
enum TexCacheEntryType type; enum TexCacheEntryType type;
unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view
unsigned int native_levels;
// used to delete textures which haven't been used for TEXTURE_KILL_THRESHOLD frames // used to delete textures which haven't been used for TEXTURE_KILL_THRESHOLD frames
int frameCount; int frameCount;
@ -59,10 +60,11 @@ public:
format = _format; format = _format;
} }
void SetDimensions(unsigned int _native_width, unsigned int _native_height) void SetDimensions(unsigned int _native_width, unsigned int _native_height, unsigned int _native_levels)
{ {
native_width = _native_width; native_width = _native_width;
native_height = _native_height; native_height = _native_height;
native_levels = _native_levels;
} }
void SetHashes(u64 _hash) void SetHashes(u64 _hash)