mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 22:11:26 +12:00
rsx: Fix blit intersection falling outside the available texture
- Just becaue we have a hit inside the tile of interest does not guarantee that it sits inside the texture!
This commit is contained in:
parent
1a13d3ae4e
commit
03fca73cf4
1 changed files with 19 additions and 4 deletions
|
@ -935,9 +935,17 @@ namespace rsx
|
||||||
const auto int_required_width = required_width / scale_x;
|
const auto int_required_width = required_width / scale_x;
|
||||||
const auto int_required_height = required_height / scale_y;
|
const auto int_required_height = required_height / scale_y;
|
||||||
|
|
||||||
auto offset = texaddr - this_address;
|
const auto offset = texaddr - this_address;
|
||||||
info.src_y = (offset / required_pitch) / scale_y;
|
info.src_y = (offset / required_pitch) / scale_y;
|
||||||
info.src_x = (offset % required_pitch) / surface_info.bpp / scale_x;
|
info.src_x = (offset % required_pitch) / surface_info.bpp / scale_x;
|
||||||
|
|
||||||
|
if (UNLIKELY(info.src_x >= surface_info.surface_width || info.src_y >= surface_info.surface_height))
|
||||||
|
{
|
||||||
|
// Region lies outside the actual texture area, but inside the 'tile'
|
||||||
|
// In this case, a small region lies to the top-left corner, partially occupying the target
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
info.dst_x = 0;
|
info.dst_x = 0;
|
||||||
info.dst_y = 0;
|
info.dst_y = 0;
|
||||||
info.width = std::min<u32>(int_required_width, surface_info.surface_width - info.src_x);
|
info.width = std::min<u32>(int_required_width, surface_info.surface_width - info.src_x);
|
||||||
|
@ -949,11 +957,18 @@ namespace rsx
|
||||||
const auto int_surface_width = surface_info.surface_width * scale_x;
|
const auto int_surface_width = surface_info.surface_width * scale_x;
|
||||||
const auto int_surface_height = surface_info.surface_height * scale_y;
|
const auto int_surface_height = surface_info.surface_height * scale_y;
|
||||||
|
|
||||||
auto offset = this_address - texaddr;
|
const auto offset = this_address - texaddr;
|
||||||
info.src_x = 0;
|
|
||||||
info.src_y = 0;
|
|
||||||
info.dst_y = (offset / required_pitch);
|
info.dst_y = (offset / required_pitch);
|
||||||
info.dst_x = (offset % required_pitch) / surface_info.bpp;
|
info.dst_x = (offset % required_pitch) / surface_info.bpp;
|
||||||
|
|
||||||
|
if (UNLIKELY(info.dst_x >= int_surface_width || info.dst_y >= int_surface_height))
|
||||||
|
{
|
||||||
|
// False positive
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
info.src_x = 0;
|
||||||
|
info.src_y = 0;
|
||||||
info.width = std::min<u32>(int_surface_width, required_width - info.dst_x);
|
info.width = std::min<u32>(int_surface_width, required_width - info.dst_x);
|
||||||
info.height = std::min<u32>(int_surface_height, required_height - info.dst_y);
|
info.height = std::min<u32>(int_surface_height, required_height - info.dst_y);
|
||||||
info.is_clipped = (info.width < required_width || info.height < required_height);
|
info.is_clipped = (info.width < required_width || info.height < required_height);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue