From 2086e7f2e8d16bd40cce3368cdf21f4679cbb7c3 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 17 Jun 2020 21:32:17 +0300 Subject: [PATCH] rsx: Account for subpixel precision when converting DST coordinates to SRC coordinates - When extracting a 1x1 texture from another texture of a different format, width conversion can result in a dimension of 0 if the extracted texel is not a full texel in SRC --- rpcs3/Emu/RSX/GL/GLTextureCache.h | 2 +- rpcs3/Emu/RSX/VK/VKTextureCache.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 61cd803014..b36c76d797 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -588,7 +588,7 @@ namespace gl // Dimensions were given in 'dst' space. Work out the real source coordinates const auto src_bpp = slice.src->pitch() / slice.src->width(); src_x = (src_x * dst_bpp) / src_bpp; - src_w = (src_w * dst_bpp) / src_bpp; + src_w = ::aligned_div(src_w * dst_bpp, src_bpp); } if (auto surface = dynamic_cast(slice.src)) diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index fb16be36d9..cb8d183b16 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -586,7 +586,7 @@ namespace vk // Dimensions were given in 'dst' space. Work out the real source coordinates const auto src_bpp = vk::get_format_texel_width(section.src->format()); src_x = (src_x * dst_bpp) / src_bpp; - src_w = (src_w * dst_bpp) / src_bpp; + src_w = ::aligned_div(src_w * dst_bpp, src_bpp); transform &= ~(rsx::surface_transform::coordinate_transform); }