mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	Rasterizer: Abstract duplicated stencil code into a lambda.
This commit is contained in:
		
							parent
							
								
									46f660a789
								
							
						
					
					
						commit
						e74825e3d0
					
				| @ -791,6 +791,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             u8 old_stencil = 0; |             u8 old_stencil = 0; | ||||||
|  | 
 | ||||||
|  |             auto UpdateStencil = [stencil_test, x, y, &old_stencil](Pica::Regs::StencilAction action) { | ||||||
|  |                 u8 new_stencil = PerformStencilAction(action, old_stencil, stencil_test.reference_value); | ||||||
|  |                 SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask)); | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|             if (stencil_action_enable) { |             if (stencil_action_enable) { | ||||||
|                 old_stencil = GetStencil(x >> 4, y >> 4); |                 old_stencil = GetStencil(x >> 4, y >> 4); | ||||||
|                 u8 dest = old_stencil & stencil_test.input_mask; |                 u8 dest = old_stencil & stencil_test.input_mask; | ||||||
| @ -832,8 +838,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if (!pass) { |                 if (!pass) { | ||||||
|                     u8 new_stencil = PerformStencilAction(stencil_test.action_stencil_fail, old_stencil, stencil_test.reference_value); |                     UpdateStencil(stencil_test.action_stencil_fail); | ||||||
|                     SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask)); |  | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @ -884,8 +889,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||||||
| 
 | 
 | ||||||
|                 if (!pass) { |                 if (!pass) { | ||||||
|                     if (stencil_action_enable) { |                     if (stencil_action_enable) { | ||||||
|                         u8 new_stencil = PerformStencilAction(stencil_test.action_depth_fail, old_stencil, stencil_test.reference_value); |                         UpdateStencil(stencil_test.action_depth_fail); | ||||||
|                         SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask)); |  | ||||||
|                     } |                     } | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
| @ -895,8 +899,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||||||
| 
 | 
 | ||||||
|                 if (stencil_action_enable) { |                 if (stencil_action_enable) { | ||||||
|                     // TODO: What happens if stencil testing is enabled, but depth testing is not? Will stencil get updated anyway?
 |                     // TODO: What happens if stencil testing is enabled, but depth testing is not? Will stencil get updated anyway?
 | ||||||
|                     u8 new_stencil = PerformStencilAction(stencil_test.action_depth_pass, old_stencil, stencil_test.reference_value); |                     UpdateStencil(stencil_test.action_depth_pass); | ||||||
|                     SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | (old_stencil & ~stencil_test.write_mask)); |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Subv
						Subv