summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authormimimi085181 <mimimi085181@users.noreply.github.com>2015-01-19 00:10:27 +0100
committermimimi085181 <mimimi085181@gmail.com>2015-01-19 01:31:41 +0100
commit0d3343d093faa31f4884c51cb2e88254dbefc51b (patch)
treecf29f966cab7f5fef4fca043d100273f1abe6339 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent37a770bb9f23404cbdc75e8cc2df31dfecb97057 (diff)
Make efb to texture less broken for paletted textures that are efb copies
Don't change the texID depending on the tlut_hash for paletted textures that are efb copies and don't have an entry in the cache for texID ^ tlut_hash. This makes those textures less broken when using efb to texture. This is not really fixing those textures, but it's a step forward. The mini map in Twilight Princess for example is in grayscales with this and is more or less usable.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 38449ae5eb..b3ae7e125f 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -354,8 +354,17 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
// we must make sure that a paletted texture gets assigned multiple IDs for each tlut used.
//
// TODO: Because texID isn't always the same as the address now, CopyRenderTargetToTexture might be broken now
+ u32 temp_texID = texID;
texID ^= ((u32)tlut_hash) ^(u32)(tlut_hash >> 32);
tex_hash ^= tlut_hash;
+
+ // Don't change the texID depending on the tlut_hash for paletted textures that are efb copies and don't have
+ // an entry in the cache for texID ^ tlut_hash. This makes those textures less broken when using efb to texture.
+ // Examples are the mini map in Twilight Princess and objects on the targetting computer in Rogue Squadron 2(RS2).
+ // TODO: Convert those textures using the right palette, so they display correctly
+ auto iter = textures.find(temp_texID);
+ if (iter != textures.end() && iter->second->IsEfbCopy() && textures.find(texID) == textures.end())
+ texID = temp_texID;
}
// GPUs don't like when the specified mipmap count would require more than one 1x1-sized LOD in the mipmap chain