TexCache: rewrite level calculation

This commit is contained in:
degasus
2015-01-11 15:15:14 +01:00
parent d95e5e2b6f
commit 744b1c1624
5 changed files with 3 additions and 8 deletions

View File

@ -358,10 +358,9 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
tex_hash ^= tlut_hash;
}
// D3D doesn't like when the specified mipmap count would require more than one 1x1-sized LOD in the mipmap chain
// e.g. 64x64 with 7 LODs would have the mipmap chain 64x64,32x32,16x16,8x8,4x4,2x2,1x1,1x1, so we limit the mipmap count to 6 there
while (g_ActiveConfig.backend_info.bUseMinimalMipCount && std::max(width, height) >> (tex_levels - 1) == 0)
--tex_levels;
// GPUs don't like when the specified mipmap count would require more than one 1x1-sized LOD in the mipmap chain
// e.g. 64x64 with 7 LODs would have the mipmap chain 64x64,32x32,16x16,8x8,4x4,2x2,1x1,0x0, so we limit the mipmap count to 6 there
tex_levels = std::min<u32>(IntLog2(std::max(width, height)) + 1, tex_levels);
TCacheEntryBase *entry = textures[texID];
if (entry)