Fix additional reinterpretation nonsense (#6521)
* surface_params: Ensure pixel formats are not the same * rasterizer_cache: Check copyable interval
This commit is contained in:
parent
f9ab0b3042
commit
b9d644b777
2 changed files with 8 additions and 6 deletions
|
@ -858,10 +858,11 @@ SurfaceId RasterizerCache<T>::FindMatch(const SurfaceParams& params, ScaleMatch
|
||||||
});
|
});
|
||||||
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Reinterpret>{}, [&] {
|
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Reinterpret>{}, [&] {
|
||||||
ASSERT(validate_interval);
|
ASSERT(validate_interval);
|
||||||
const bool matched =
|
const SurfaceInterval copy_interval =
|
||||||
!boost::icl::contains(surface.invalid_regions, *validate_interval) &&
|
surface.GetCopyableInterval(params.FromInterval(*validate_interval));
|
||||||
|
const bool matched = boost::icl::length(copy_interval & *validate_interval) != 0 &&
|
||||||
surface.CanReinterpret(params);
|
surface.CanReinterpret(params);
|
||||||
return std::make_pair(matched, surface.GetInterval());
|
return std::make_pair(matched, copy_interval);
|
||||||
});
|
});
|
||||||
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Expand>{}, [&] {
|
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Expand>{}, [&] {
|
||||||
return std::make_pair(surface.CanExpand(params), surface.GetInterval());
|
return std::make_pair(surface.CanExpand(params), surface.GetInterval());
|
||||||
|
|
|
@ -27,8 +27,9 @@ bool SurfaceParams::CanSubRect(const SurfaceParams& sub_surface) const {
|
||||||
|
|
||||||
bool SurfaceParams::CanReinterpret(const SurfaceParams& other_surface) {
|
bool SurfaceParams::CanReinterpret(const SurfaceParams& other_surface) {
|
||||||
return other_surface.addr >= addr && other_surface.end <= end &&
|
return other_surface.addr >= addr && other_surface.end <= end &&
|
||||||
pixel_format != PixelFormat::Invalid && GetFormatBpp() == other_surface.GetFormatBpp() &&
|
pixel_format != PixelFormat::Invalid && pixel_format != other_surface.pixel_format &&
|
||||||
other_surface.is_tiled == is_tiled && other_surface.stride == stride &&
|
GetFormatBpp() == other_surface.GetFormatBpp() && other_surface.is_tiled == is_tiled &&
|
||||||
|
other_surface.stride == stride &&
|
||||||
(other_surface.addr - addr) % BytesInPixels(is_tiled ? 64 : 1) == 0 &&
|
(other_surface.addr - addr) % BytesInPixels(is_tiled ? 64 : 1) == 0 &&
|
||||||
GetSubRect(other_surface).right <= stride;
|
GetSubRect(other_surface).right <= stride;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue