GPU: Block mipmap autogen for matching size.

If the mips don't get smaller, we can't autogen - the bias in that case is
used to select a different texture.  Fixes #9731.

This also may improve a minor performance issue on PowerVR in some games.
This commit is contained in:
Unknown W. Brackets committed 2017-05-31 21:23:20 -07:00
1 parent 9687873417
commit b6375638f5
5 files changed
+59 -19

No files matched your search

+9 -3
View File
@@ -155,16 +155,17 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
bool tClamp;
float lodBias;
bool autoMip;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr, autoMip);
u8 maxLevel = (entry.status & TexCacheEntry::STATUS_BAD_MIPS) ? 0 : entry.maxLevel;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, maxLevel, entry.addr, autoMip);
if (entry.maxLevel != 0) {
if (maxLevel != 0) {
if (autoMip) {
dxstate.texMaxMipLevel.set(0);
dxstate.texMipLodBias.set(lodBias);
} else {
// TODO: This is just an approximation - texMaxMipLevel sets the lowest numbered mip to use.
// Unfortunately, this doesn't support a const 1.5 or etc.
dxstate.texMaxMipLevel.set(std::max(0, std::min((int)entry.maxLevel, (int)lodBias)));
dxstate.texMaxMipLevel.set(std::max(0, std::min((int)maxLevel, (int)lodBias)));
dxstate.texMipLodBias.set(-1000.0f);
}
entry.lodBias = lodBias;
@@ -590,6 +591,11 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
}
}
if (maxLevel == 0) {
entry->status |= TexCacheEntry::STATUS_BAD_MIPS;
} else {
entry->status &= ~TexCacheEntry::STATUS_BAD_MIPS;
}
if (replaced.Valid()) {
entry->SetAlphaStatus(TexCacheEntry::Status(replaced.AlphaStatus()));
}