d3d9: Fix maxSeenV when not known.

And just make the code reused between both.  Fixes #8478.
This commit is contained in:
Unknown W. Brackets committed 2016-01-22 18:48:54 -08:00
1 parent d5539c4831
commit e30ab95179
4 files changed
+26 -40

No files matched your search

+23
View File
@@ -119,6 +119,29 @@ void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sCl
}
}
void TextureCacheCommon::UpdateMaxSeenV(bool throughMode) {
// If the texture is >= 512 pixels tall...
if (nextTexture_->dim >= 0x900) {
// Texture scale/offset and gen modes don't apply in through.
// So we can optimize how much of the texture we look at.
if (throughMode) {
if (nextTexture_->maxSeenV == 0 && gstate_c.vertBounds.maxV > 0) {
// Let's not hash less than 272, we might use more later and have to rehash. 272 is very common.
nextTexture_->maxSeenV = std::max((u16)272, gstate_c.vertBounds.maxV);
} else if (gstate_c.vertBounds.maxV > nextTexture_->maxSeenV) {
// The max height changed, so we're better off hashing the entire thing.
nextTexture_->maxSeenV = 512;
nextTexture_->status |= TexCacheEntry::STATUS_FREE_CHANGE;
}
} else {
// Otherwise, we need to reset to ensure we use the whole thing.
// Can't tell how much is used.
// TODO: We could tell for texcoord UV gen, and apply scale to max?
nextTexture_->maxSeenV = 512;
}
}
}
void TextureCacheCommon::NotifyFramebuffer(u32 address, VirtualFramebuffer *framebuffer, FramebufferNotification msg) {
// Must be in VRAM so | 0x04000000 it is. Also, ignore memory mirrors.
// These checks are mainly to reduce scanning all textures.