mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	VideoCore: Implement the DOT3_RGB combiner
This commit is contained in:
		
							parent
							
								
									2501f111a6
								
							
						
					
					
						commit
						d08e9b29e2
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		|  | @ -290,6 +290,7 @@ struct Regs { | |||
|             AddSigned       = 3, | ||||
|             Lerp            = 4, | ||||
|             Subtract        = 5, | ||||
|             Dot3_RGB        = 6, | ||||
| 
 | ||||
|             MultiplyThenAdd = 8, | ||||
|             AddThenMultiply = 9, | ||||
|  |  | |||
|  | @ -641,7 +641,18 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
|                         result = (result * input[2].Cast<int>()) / 255; | ||||
|                         return result.Cast<u8>(); | ||||
|                     } | ||||
| 
 | ||||
|                     case Operation::Dot3_RGB: | ||||
|                     { | ||||
|                         // Not fully accurate.
 | ||||
|                         // Worst case scenario seems to yield a +/-3 error
 | ||||
|                         // Some HW results indicate that the per-component computation can't have a higher precision than 1/256,
 | ||||
|                         // while dot3_rgb( (0x80,g0,b0),(0x7F,g1,b1) ) and dot3_rgb( (0x80,g0,b0),(0x80,g1,b1) ) give different results
 | ||||
|                         int result = ((input[0].r() * 2 - 255) * (input[1].r() * 2 - 255) + 128) / 256 + | ||||
|                                      ((input[0].g() * 2 - 255) * (input[1].g() * 2 - 255) + 128) / 256 + | ||||
|                                      ((input[0].b() * 2 - 255) * (input[1].b() * 2 - 255) + 128) / 256; | ||||
|                         result = std::max(0, std::min(255, result)); | ||||
|                         return { (u8)result, (u8)result, (u8)result }; | ||||
|                     } | ||||
|                     default: | ||||
|                         LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); | ||||
|                         UNIMPLEMENTED(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue