TextureCache::Invalidate()/InvalidateAll() small corrections and optimizations.

I think the ranges are [start_addr, end_addr).
This commit is contained in:
aquanull 2013-06-05 00:43:42 +08:00
parent 9b85da657a
commit a1b7da413a

View File

@ -123,10 +123,7 @@ void TextureCache::Invalidate(u32 addr, int size, GPUInvalidationType type) {
u32 texAddr = iter->second.addr;
u32 texEnd = iter->second.addr + iter->second.sizeInRAM;
bool invalidate = (texAddr >= addr && texAddr < addr_end) || (texEnd >= addr && texEnd < addr_end);
invalidate = invalidate || (addr >= texAddr && addr < texEnd) || (addr_end >= texAddr && addr_end < texEnd);
if (invalidate) {
if (texAddr < addr_end && addr < texEnd) {
if ((iter->second.status & TexCacheEntry::STATUS_MASK) == TexCacheEntry::STATUS_RELIABLE) {
// Clear status -> STATUS_HASHING.
iter->second.status &= ~TexCacheEntry::STATUS_MASK;
@ -143,8 +140,14 @@ void TextureCache::Invalidate(u32 addr, int size, GPUInvalidationType type) {
}
}
void TextureCache::InvalidateAll(GPUInvalidationType type) {
Invalidate(0, 0xFFFFFFFF, type);
void TextureCache::InvalidateAll(GPUInvalidationType /*unused*/) {
for (TexCache::iterator iter = cache.begin(), end = cache.end(); iter != end; ++iter) {
if ((iter->second.status & TexCacheEntry::STATUS_MASK) == TexCacheEntry::STATUS_RELIABLE) {
// Clear status -> STATUS_HASHING.
iter->second.status &= ~TexCacheEntry::STATUS_MASK;
}
iter->second.invalidHint++;
}
}
void TextureCache::ClearNextFrame() {