summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-01-24 16:58:28 +0100
committerdegasus <wickmarkus@web.de>2013-01-24 16:58:28 +0100
commite0ffdda26e5fb34b2f0d59d5d45b0deda9c90c19 (patch)
tree8e289ea93c97fe7430ae501200b60327f572c7e2 /Source/Core/VideoCommon/Src/TextureCacheBase.cpp
parentd5748ebaef93cd601ae6ab5e12f39dd201593ad0 (diff)
parentd60cc373d1b389215eb63c4e20fe24e902680c7a (diff)
Merge branch 'immediate-removal' into GLSL-master
Conflicts: Source/Core/VideoCommon/Src/PixelShaderGen.cpp Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp immediate-removal is a new created branch seperated from master but reverted the revert of immediate-removal so we get less conflicts by merging
Diffstat (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
index c2f1466be7..58b2fac341 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
@@ -204,12 +204,16 @@ void TextureCache::ClearRenderTargets()
iter = textures.begin(),
tcend = textures.end();
- for (; iter!=tcend; ++iter)
+ while (iter != tcend)
+ {
if (iter->second->type == TCET_EC_VRAM)
{
delete iter->second;
textures.erase(iter++);
}
+ else
+ ++iter;
+ }
}
bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsigned int levels)
@@ -329,6 +333,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
if (from_tmem) src_data = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE];
else src_data = Memory::GetPointer(address);
+ // TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data from the low tmem bank than it should)
tex_hash = GetHash64(src_data, texture_size, g_ActiveConfig.iSafeTextureCache_ColorSamples);
if (isPaletteTexture)
{
@@ -409,10 +414,19 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
}
}
- // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems here when preloading is enabled
if (!using_custom_texture)
- pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth,
- expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
+ {
+ if (!(texformat == GX_TF_RGBA8 && from_tmem))
+ {
+ pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth,
+ expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
+ }
+ else
+ {
+ u8* src_data_gb = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE];
+ pcfmt = TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight);
+ }
+ }
// TODO: Cleanup. Plus, we still autogenerate mipmaps in certain cases (we shouldn't do that)
bool isPow2;