Optimised EFB copy to RAM.

The finding was that 99% of the time, textures are static in memory. However, Dolphin would pessimistically continue to decode and copy the same texture every time.  The optimisation is to check if the texture matches what is in the cache, and if it does, Dolphin should early exit.

The result is the speed in New Super Mario Bros Wii increased 35% with spinning coins.  Still not as fast as EFB copy to texture though.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6352 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau
2010-11-06 04:46:44 +00:00
parent d0afc20596
commit 8775abacc6
4 changed files with 33 additions and 4 deletions

View File

@ -119,8 +119,12 @@ void TextureCache::InvalidateRange(u32 start_address, u32 size)
void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
{
TexCache::iterator
iter = textures.begin(),
tcend = textures.end();
iter = textures.lower_bound(start_address),
tcend = textures.upper_bound(start_address + size);
if (iter != textures.begin())
iter--;
for (; iter != tcend; ++iter)
{
const int rangePosition = iter->second->IntersectsMemoryRange(start_address, size);
@ -131,6 +135,18 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
}
}
bool TextureCache::Find(u32 start_address, u64 hash)
{
TexCache::iterator
iter = textures.lower_bound(start_address),
tcend = textures.upper_bound(start_address);
if (iter->second->hash == hash)
return true;
return false;
}
int TextureCache::TCacheEntryBase::IntersectsMemoryRange(u32 range_address, u32 range_size) const
{
if (addr + size_in_bytes < range_address)