mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	Maxwell3D: Implement Depth Mode.
This commit finishes adding depth mode that was reverted before due to other unresolved issues.
This commit is contained in:
		
							parent
							
								
									6edadef96d
								
							
						
					
					
						commit
						7ffb672f61
					
				| @ -310,6 +310,11 @@ public: | |||||||
|             } |             } | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  |         enum class DepthMode : u32 { | ||||||
|  |             MinusOneToOne = 0, | ||||||
|  |             ZeroToOne = 1, | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|         enum class PrimitiveTopology : u32 { |         enum class PrimitiveTopology : u32 { | ||||||
|             Points = 0x0, |             Points = 0x0, | ||||||
|             Lines = 0x1, |             Lines = 0x1, | ||||||
| @ -491,11 +496,6 @@ public: | |||||||
|             INSERT_UNION_PADDING_WORDS(1); |             INSERT_UNION_PADDING_WORDS(1); | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         enum class DepthMode : u32 { |  | ||||||
|             MinusOneToOne = 0, |  | ||||||
|             ZeroToOne = 1, |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         enum class TessellationPrimitive : u32 { |         enum class TessellationPrimitive : u32 { | ||||||
|             Isolines = 0, |             Isolines = 0, | ||||||
|             Triangles = 1, |             Triangles = 1, | ||||||
| @ -676,7 +676,7 @@ public: | |||||||
|                     u32 count; |                     u32 count; | ||||||
|                 } vertex_buffer; |                 } vertex_buffer; | ||||||
| 
 | 
 | ||||||
|                 INSERT_UNION_PADDING_WORDS(1); |                 DepthMode depth_mode; | ||||||
| 
 | 
 | ||||||
|                 float clear_color[4]; |                 float clear_color[4]; | ||||||
|                 float clear_depth; |                 float clear_depth; | ||||||
| @ -1425,6 +1425,7 @@ ASSERT_REG_POSITION(rt, 0x200); | |||||||
| ASSERT_REG_POSITION(viewport_transform, 0x280); | ASSERT_REG_POSITION(viewport_transform, 0x280); | ||||||
| ASSERT_REG_POSITION(viewports, 0x300); | ASSERT_REG_POSITION(viewports, 0x300); | ||||||
| ASSERT_REG_POSITION(vertex_buffer, 0x35D); | ASSERT_REG_POSITION(vertex_buffer, 0x35D); | ||||||
|  | ASSERT_REG_POSITION(depth_mode, 0x35F); | ||||||
| ASSERT_REG_POSITION(clear_color[0], 0x360); | ASSERT_REG_POSITION(clear_color[0], 0x360); | ||||||
| ASSERT_REG_POSITION(clear_depth, 0x364); | ASSERT_REG_POSITION(clear_depth, 0x364); | ||||||
| ASSERT_REG_POSITION(clear_stencil, 0x368); | ASSERT_REG_POSITION(clear_stencil, 0x368); | ||||||
|  | |||||||
| @ -1028,6 +1028,10 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { | |||||||
|         flip_y = !flip_y; |         flip_y = !flip_y; | ||||||
|     } |     } | ||||||
|     state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; |     state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; | ||||||
|  |     state.clip_control.depth_mode = | ||||||
|  |         regs.depth_mode == Tegra::Engines::Maxwell3D::Regs::DepthMode::ZeroToOne | ||||||
|  |             ? GL_ZERO_TO_ONE | ||||||
|  |             : GL_NEGATIVE_ONE_TO_ONE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RasterizerOpenGL::SyncClipEnabled( | void RasterizerOpenGL::SyncClipEnabled( | ||||||
|  | |||||||
| @ -411,8 +411,9 @@ void OpenGLState::ApplyAlphaTest() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void OpenGLState::ApplyClipControl() { | void OpenGLState::ApplyClipControl() { | ||||||
|     if (UpdateValue(cur_state.clip_control.origin, clip_control.origin)) { |     if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), | ||||||
|         glClipControl(clip_control.origin, GL_NEGATIVE_ONE_TO_ONE); |                   std::tie(clip_control.origin, clip_control.depth_mode))) { | ||||||
|  |         glClipControl(clip_control.origin, clip_control.depth_mode); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -150,6 +150,7 @@ public: | |||||||
| 
 | 
 | ||||||
|     struct { |     struct { | ||||||
|         GLenum origin = GL_LOWER_LEFT; |         GLenum origin = GL_LOWER_LEFT; | ||||||
|  |         GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE; | ||||||
|     } clip_control; |     } clip_control; | ||||||
| 
 | 
 | ||||||
|     OpenGLState(); |     OpenGLState(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Fernando Sahmkow
						Fernando Sahmkow