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
This commit is contained in:
kd-11 2020-06-17 21:32:17 +03:00 committed by kd-11
parent 4092e3e95f
commit 2086e7f2e8
2 changed files with 2 additions and 2 deletions

View File

@ -588,7 +588,7 @@ namespace gl
// Dimensions were given in 'dst' space. Work out the real source coordinates // Dimensions were given in 'dst' space. Work out the real source coordinates
const auto src_bpp = slice.src->pitch() / slice.src->width(); const auto src_bpp = slice.src->pitch() / slice.src->width();
src_x = (src_x * dst_bpp) / src_bpp; src_x = (src_x * dst_bpp) / src_bpp;
src_w = (src_w * dst_bpp) / src_bpp; src_w = ::aligned_div<u16>(src_w * dst_bpp, src_bpp);
} }
if (auto surface = dynamic_cast<gl::render_target*>(slice.src)) if (auto surface = dynamic_cast<gl::render_target*>(slice.src))

View File

@ -586,7 +586,7 @@ namespace vk
// Dimensions were given in 'dst' space. Work out the real source coordinates // Dimensions were given in 'dst' space. Work out the real source coordinates
const auto src_bpp = vk::get_format_texel_width(section.src->format()); const auto src_bpp = vk::get_format_texel_width(section.src->format());
src_x = (src_x * dst_bpp) / src_bpp; src_x = (src_x * dst_bpp) / src_bpp;
src_w = (src_w * dst_bpp) / src_bpp; src_w = ::aligned_div<u16>(src_w * dst_bpp, src_bpp);
transform &= ~(rsx::surface_transform::coordinate_transform); transform &= ~(rsx::surface_transform::coordinate_transform);
} }