Updated with a less aggressive optimisation to EFB copy to RAM. The destination texture now does not get invalidated if its hash is found in the texture cache. Fixes Metroid Prime 3.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6353 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau
2010-11-07 04:28:33 +00:00
parent 8775abacc6
commit 6666b400a3
3 changed files with 16 additions and 18 deletions

View File

@ -214,7 +214,7 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
glEnd();
GL_REPORT_ERRORD();
// .. and then readback the results.
// .. and then read back the results.
// TODO: make this less slow.
int writeStride = bpmem.copyMipMapStrideChannels * 32;
@ -345,12 +345,6 @@ u64 EncodeToRamFromTexture(u32 address,GLuint source_texture,float MValueX,float
int size_in_bytes = TexDecoder_GetTextureSizeInBytes(width, height, format);
u64 hash = GetHash64(dest_ptr,size_in_bytes,g_ActiveConfig.iSafeTextureCache_ColorSamples);
// If the texture in RAM is already in the texture cache, do not copy it again as it has not changed.
if (TextureCache::Find(address, hash))
return hash;
u16 blkW = TexDecoder_GetBlockWidthInTexels(format) - 1;
u16 blkH = TexDecoder_GetBlockHeightInTexels(format) - 1;
u16 samples = TextureConversionShader::GetEncodedSampleCount(format);
@ -380,6 +374,12 @@ u64 EncodeToRamFromTexture(u32 address,GLuint source_texture,float MValueX,float
int readStride = (expandedWidth * cacheBytes) / TexDecoder_GetBlockWidthInTexels(format);
EncodeToRamUsingShader(texconv_shader, source_texture, scaledSource, dest_ptr, expandedWidth / samples, expandedHeight, readStride, true, bScaleByHalf > 0 && !bFromZBuffer);
u64 hash = GetHash64(dest_ptr,size_in_bytes,g_ActiveConfig.iSafeTextureCache_ColorSamples);
// If the texture in RAM is already in the texture cache, do not copy it again as it has not changed.
if (TextureCache::Find(address, hash))
return hash;
TextureCache::MakeRangeDynamic(address,size_in_bytes);
return hash;
}
@ -411,7 +411,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
Renderer::ResetAPIState(); // reset any game specific settings
// swich to texture converter frame buffer
// switch to texture converter frame buffer
// attach destTexture as color destination
g_framebufferManager.SetFramebuffer(s_texConvFrameBuffer);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, destTexture);