summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2018-09-10 00:47:05 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2018-09-13 19:39:49 +0200
commitd97bc0d35917d81a8958e15c4a20e9be3502fa6c (patch)
treede09ac3f0b03910c8b0184317b6ac82f74fdd3eb /Source/Core/VideoCommon/RenderBase.cpp
parent5f0d825f40b8aabe13eaef32d44ab667ff8e8c28 (diff)
Correctly adjust the rendered XFB region at non-native internal resolutions when XFB was loaded from console RAM.
If, for whatever reason, the XFB has to be loaded from console memory, it's possible that the texture is returned at native resolution instead of EFB-scaled resolution. In this case, our xfb_rect.right adjustment must also happen at native resolution instead of scaled resolution.
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 25730f98f4..317f876aa7 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -676,7 +676,16 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
m_last_xfb_ticks = ticks;
auto xfb_rect = texture_config.GetRect();
- xfb_rect.right -= EFBToScaledX(fbStride - fbWidth);
+
+ // It's possible that the returned XFB texture is native resolution
+ // even when we're rendering at higher than native resolution
+ // if the XFB was was loaded entirely from console memory.
+ // If so, adjust the rectangle by native resolution instead of scaled resolution.
+ const u32 native_stride_width_difference = fbStride - fbWidth;
+ if (texture_config.width == xfb_entry->native_width)
+ xfb_rect.right -= native_stride_width_difference;
+ else
+ xfb_rect.right -= EFBToScaledX(native_stride_width_difference);
m_last_xfb_region = xfb_rect;