| 
									
										
										
										
											2016-03-24 02:23:56 +00:00
										 |  |  | // Copyright 2016 Dolphin Emulator Project
 | 
					
						
							|  |  |  | // Licensed under GPLv2+
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-24 02:42:08 +00:00
										 |  |  | namespace SamplerCommon | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-03-24 02:23:56 +00:00
										 |  |  | // Helper for checking if a BPMemory TexMode0 register is set to Point
 | 
					
						
							|  |  |  | // Filtering modes. This is used to decide whether Anisotropic enhancements
 | 
					
						
							|  |  |  | // are (mostly) safe in the VideoBackends.
 | 
					
						
							|  |  |  | // If both the minification and magnification filters are set to POINT modes
 | 
					
						
							|  |  |  | // then applying anisotropic filtering is equivalent to forced filtering. Point
 | 
					
						
							|  |  |  | // mode textures are usually some sort of 2D UI billboard which will end up
 | 
					
						
							|  |  |  | // misaligned from the correct pixels when filtered anisotropically.
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | template <class T> | 
					
						
							| 
									
										
										
										
											2016-03-24 02:23:56 +00:00
										 |  |  | constexpr bool IsBpTexMode0PointFiltering(const T& tm0) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   return tm0.min_filter < 4 && !tm0.mag_filter; | 
					
						
							| 
									
										
										
										
											2016-03-24 02:23:56 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-03-24 02:42:08 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Check if the minification filter has mipmap based filtering modes enabled.
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | template <class T> | 
					
						
							| 
									
										
										
										
											2016-03-24 02:42:08 +00:00
										 |  |  | constexpr bool AreBpTexMode0MipmapsEnabled(const T& tm0) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   return (tm0.min_filter & 3) != 0; | 
					
						
							| 
									
										
										
										
											2016-03-24 02:42:08 +00:00
										 |  |  | } | 
					
						
							|  |  |  | } |