summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2017-10-16 22:41:18 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2017-11-17 22:11:33 -0600
commit332af8aa491a320d00b4989e9e4f1a25b59588c3 (patch)
treeab6cbc8ff2b9bdf7950a2cd423a8f014e9083320 /Source/Core/VideoCommon/TextureCacheBase.cpp
parentcf8c007769d400811628a5d9694762afeed0ce1c (diff)
TextureCacheBase: Fix issue in Rogue Squadron 2 where overlapping textures caused a hash change which would cause us to do a lookup from memory that gave us an incorrect result in XFB2Ram
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 3637ae7b4f..8d97bd759d 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -1938,6 +1938,19 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
}
entry->may_have_overlapping_textures = true;
+ // There are cases (Rogue Squadron 2 / Texas Holdem on Wiiware) where
+ // for xfb copies the textures overlap which causes the hash of the first copy
+ // to be different (from when it was originally created). This has no implications
+ // for XFB2Tex because the underlying memory doesn't change (dummy values) but
+ // can affect XFB2Ram when we compare the texture cache copy hash with the
+ // newly computed hash
+ // By calculating the hash when we receive overlapping xfbs, we are able
+ // to mitigate this
+ if (entry->is_xfb_copy && copy_to_ram)
+ {
+ entry->hash = entry->CalculateHash();
+ }
+
// Do not load textures by hash, if they were at least partly overwritten by an efb copy.
// In this case, comparing the hash is not enough to check, if two textures are identical.
if (entry->textures_by_hash_iter != textures_by_hash.end())