From 6feffe6ff63b78e5403851007b03dc3b87ee8e45 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 25 Apr 2019 17:25:45 +0300 Subject: [PATCH] rsx: Ignore transfer offsets when wrapping behaviour is expected --- rpcs3/Emu/RSX/rsx_methods.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index cc49c4ded7..f21df7cf87 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -835,16 +835,6 @@ namespace rsx auto in_x = (u16)std::floor(method_registers.blit_engine_in_x()); auto in_y = (u16)std::floor(method_registers.blit_engine_in_y()); - if (UNLIKELY(in_x || in_y)) - { - if (scale_x < 0.f || scale_y < 0.f || fabsf(fabsf(scale_x * scale_y) - 1.f) > 0.000001f) - { - // Scaling operation, check for subpixel correction offsets - if (in_x == 1) in_x = 0; - if (in_y == 1) in_y = 0; - } - } - // Clipping // Validate that clipping rect will fit onto both src and dst regions const u16 clip_w = std::min(method_registers.blit_engine_clip_width(), out_w); @@ -926,6 +916,25 @@ namespace rsx out_pitch = out_bpp * out_w; } + if (UNLIKELY(in_x == 1 || in_y == 1)) + { + const bool is_graphics_op = scale_x < 0.f || scale_y < 0.f || in_bpp != out_bpp || fabsf(fabsf(scale_x * scale_y) - 1.f) > 0.000001f; + if (!is_graphics_op) + { + // No scaling factor, so size in src == size in dst + // Check for texel wrapping where (offset + size) > size by 1 pixel + // TODO: Should properly RE this behaviour when I have time (kd-11) + if (in_x == 1 && in_w == clip_w) in_x = 0; + if (in_y == 1 && in_h == clip_h) in_y = 0; + } + else + { + // Graphics operation, ignore subpixel correction offsets + if (in_x == 1) in_x = 0; + if (in_y == 1) in_y = 0; + } + } + const u32 in_offset = in_x * in_bpp + in_pitch * in_y; const s32 out_offset = out_x * out_bpp + out_pitch * out_y;