summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp48
1 files changed, 41 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 042dbd4e8a..07b6609282 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -1878,14 +1878,21 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
}
else
{
- // Hack: Most games don't actually need the correct texture data in RAM
- // and we can just keep a copy in VRAM. We zero the memory so we
- // can check it hasn't changed before using our copy in VRAM.
- u8* ptr = dst;
- for (u32 i = 0; i < num_blocks_y; i++)
+ if (is_xfb_copy)
{
- memset(ptr, 0, bytes_per_row);
- ptr += dstStride;
+ UninitializeXFBMemory(dst, dstStride, bytes_per_row, num_blocks_y);
+ }
+ else
+ {
+ // Hack: Most games don't actually need the correct texture data in RAM
+ // and we can just keep a copy in VRAM. We zero the memory so we
+ // can check it hasn't changed before using our copy in VRAM.
+ u8* ptr = dst;
+ for (u32 i = 0; i < num_blocks_y; i++)
+ {
+ memset(ptr, 0, bytes_per_row);
+ ptr += dstStride;
+ }
}
}
@@ -2030,6 +2037,33 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
}
}
+void TextureCacheBase::UninitializeXFBMemory(u8* dst, u32 stride, u32 bytes_per_row,
+ u32 num_blocks_y)
+{
+ // Originally, we planned on using a 'key color'
+ // for alpha to address partial xfbs (Mario Strikers / Chicken Little).
+ // This work was removed since it was unfinished but there
+ // was still a desire to differentiate between the old and the new approach
+ // which is why we still set uninitialized xfb memory to fuchsia
+ // (Y=1,U=254,V=254) instead of dark green (Y=0,U=0,V=0) in YUV
+ // like is done in the EFB path.
+ for (u32 i = 0; i < num_blocks_y; i++)
+ {
+ for (u32 offset = 0; offset < bytes_per_row; offset++)
+ {
+ if (offset % 2)
+ {
+ dst[offset] = 254;
+ }
+ else
+ {
+ dst[offset] = 1;
+ }
+ }
+ dst += stride;
+ }
+}
+
TextureCacheBase::TCacheEntry* TextureCacheBase::AllocateCacheEntry(const TextureConfig& config)
{
std::unique_ptr<AbstractTexture> texture = AllocateTexture(config);