mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-03 14:54:20 +01:00
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
@ -858,10 +858,11 @@ SurfaceId RasterizerCache<T>::FindMatch(const SurfaceParams& params, ScaleMatch
|
||||
});
|
||||
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Reinterpret>{}, [&] {
|
||||
ASSERT(validate_interval);
|
||||
const bool matched =
|
||||
!boost::icl::contains(surface.invalid_regions, *validate_interval) &&
|
||||
surface.CanReinterpret(params);
|
||||
return std::make_pair(matched, surface.GetInterval());
|
||||
const SurfaceInterval copy_interval =
|
||||
surface.GetCopyableInterval(params.FromInterval(*validate_interval));
|
||||
const bool matched = boost::icl::length(copy_interval & *validate_interval) != 0 &&
|
||||
surface.CanReinterpret(params);
|
||||
return std::make_pair(matched, copy_interval);
|
||||
});
|
||||
IsMatch_Helper(std::integral_constant<MatchFlags, MatchFlags::Expand>{}, [&] {
|
||||
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) {
|
||||
return other_surface.addr >= addr && other_surface.end <= end &&
|
||||
pixel_format != PixelFormat::Invalid && GetFormatBpp() == other_surface.GetFormatBpp() &&
|
||||
other_surface.is_tiled == is_tiled && other_surface.stride == stride &&
|
||||
pixel_format != PixelFormat::Invalid && pixel_format != other_surface.pixel_format &&
|
||||
GetFormatBpp() == other_surface.GetFormatBpp() && other_surface.is_tiled == is_tiled &&
|
||||
other_surface.stride == stride &&
|
||||
(other_surface.addr - addr) % BytesInPixels(is_tiled ? 64 : 1) == 0 &&
|
||||
GetSubRect(other_surface).right <= stride;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user