mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	Pica/TextureEnvironment: Add support for the MAD-like texture combiners and clean up texture environment logic.
This commit is contained in:
		
							parent
							
								
									087edcfbec
								
							
						
					
					
						commit
						04cd06d5c2
					
				| @ -266,6 +266,9 @@ struct Regs { | |||||||
|             AddSigned       = 3, |             AddSigned       = 3, | ||||||
|             Lerp            = 4, |             Lerp            = 4, | ||||||
|             Subtract        = 5, |             Subtract        = 5, | ||||||
|  | 
 | ||||||
|  |             MultiplyThenAdd = 8, | ||||||
|  |             AddThenMultiply = 9, | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         union { |         union { | ||||||
|  | |||||||
| @ -419,6 +419,25 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||||||
|                         return result.Cast<u8>(); |                         return result.Cast<u8>(); | ||||||
|                     } |                     } | ||||||
| 
 | 
 | ||||||
|  |                     case Operation::MultiplyThenAdd: | ||||||
|  |                     { | ||||||
|  |                         auto result = (input[0] * input[1] + 255 * input[2].Cast<int>()) / 255; | ||||||
|  |                         result.r() = std::min(255, result.r()); | ||||||
|  |                         result.g() = std::min(255, result.g()); | ||||||
|  |                         result.b() = std::min(255, result.b()); | ||||||
|  |                         return result.Cast<u8>(); | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     case Operation::AddThenMultiply: | ||||||
|  |                     { | ||||||
|  |                         auto result = input[0] + input[1]; | ||||||
|  |                         result.r() = std::min(255, result.r()); | ||||||
|  |                         result.g() = std::min(255, result.g()); | ||||||
|  |                         result.b() = std::min(255, result.b()); | ||||||
|  |                         result = (result * input[2].Cast<int>()) / 255; | ||||||
|  |                         return result.Cast<u8>(); | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|                     default: |                     default: | ||||||
|                         LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); |                         LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); | ||||||
|                         UNIMPLEMENTED(); |                         UNIMPLEMENTED(); | ||||||
| @ -443,6 +462,12 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||||||
|                     case Operation::Subtract: |                     case Operation::Subtract: | ||||||
|                         return std::max(0, (int)input[0] - (int)input[1]); |                         return std::max(0, (int)input[0] - (int)input[1]); | ||||||
| 
 | 
 | ||||||
|  |                     case Operation::MultiplyThenAdd: | ||||||
|  |                         return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255); | ||||||
|  | 
 | ||||||
|  |                     case Operation::AddThenMultiply: | ||||||
|  |                         return (std::min(255, (input[0] + input[1])) * input[2]) / 255; | ||||||
|  | 
 | ||||||
|                     default: |                     default: | ||||||
|                         LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); |                         LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); | ||||||
|                         UNIMPLEMENTED(); |                         UNIMPLEMENTED(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Tony Wasserka
						Tony Wasserka