mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00: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
					
				
					 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>{}, [&] { | ||||
|             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…
	
	Add table
		Add a link
		
	
		Reference in a new issue