diff options
| author | 2019-12-10 21:20:52 -0300 | |
|---|---|---|
| committer | 2019-12-10 21:20:52 -0300 | |
| commit | c8db7d1399bf83937debe347e6d214c501afdff6 (patch) | |
| tree | 82e494fd45cf84d676b1e0b3c88e08bc0ce17300 /src | |
| parent | Merge pull request #3208 from ReinUsesLisp/vk-shader-decompiler (diff) | |
| parent | Maxwell3D: Implement Depth Mode. (diff) | |
| download | yuzu-c8db7d1399bf83937debe347e6d214c501afdff6.tar.gz yuzu-c8db7d1399bf83937debe347e6d214c501afdff6.tar.xz yuzu-c8db7d1399bf83937debe347e6d214c501afdff6.zip | |
Merge pull request #3211 from FernandoS27/depth-mode
Maxwell3D: Implement Depth Mode.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 1 |
4 files changed, 15 insertions, 8 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index dcc7cd1fe..dbb4e597f 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -310,6 +310,11 @@ public: | |||
| 310 | } | 310 | } |
| 311 | }; | 311 | }; |
| 312 | 312 | ||
| 313 | enum class DepthMode : u32 { | ||
| 314 | MinusOneToOne = 0, | ||
| 315 | ZeroToOne = 1, | ||
| 316 | }; | ||
| 317 | |||
| 313 | enum class PrimitiveTopology : u32 { | 318 | enum class PrimitiveTopology : u32 { |
| 314 | Points = 0x0, | 319 | Points = 0x0, |
| 315 | Lines = 0x1, | 320 | Lines = 0x1, |
| @@ -491,11 +496,6 @@ public: | |||
| 491 | INSERT_UNION_PADDING_WORDS(1); | 496 | INSERT_UNION_PADDING_WORDS(1); |
| 492 | }; | 497 | }; |
| 493 | 498 | ||
| 494 | enum class DepthMode : u32 { | ||
| 495 | MinusOneToOne = 0, | ||
| 496 | ZeroToOne = 1, | ||
| 497 | }; | ||
| 498 | |||
| 499 | enum class TessellationPrimitive : u32 { | 499 | enum class TessellationPrimitive : u32 { |
| 500 | Isolines = 0, | 500 | Isolines = 0, |
| 501 | Triangles = 1, | 501 | Triangles = 1, |
| @@ -676,7 +676,7 @@ public: | |||
| 676 | u32 count; | 676 | u32 count; |
| 677 | } vertex_buffer; | 677 | } vertex_buffer; |
| 678 | 678 | ||
| 679 | INSERT_UNION_PADDING_WORDS(1); | 679 | DepthMode depth_mode; |
| 680 | 680 | ||
| 681 | float clear_color[4]; | 681 | float clear_color[4]; |
| 682 | float clear_depth; | 682 | float clear_depth; |
| @@ -1425,6 +1425,7 @@ ASSERT_REG_POSITION(rt, 0x200); | |||
| 1425 | ASSERT_REG_POSITION(viewport_transform, 0x280); | 1425 | ASSERT_REG_POSITION(viewport_transform, 0x280); |
| 1426 | ASSERT_REG_POSITION(viewports, 0x300); | 1426 | ASSERT_REG_POSITION(viewports, 0x300); |
| 1427 | ASSERT_REG_POSITION(vertex_buffer, 0x35D); | 1427 | ASSERT_REG_POSITION(vertex_buffer, 0x35D); |
| 1428 | ASSERT_REG_POSITION(depth_mode, 0x35F); | ||
| 1428 | ASSERT_REG_POSITION(clear_color[0], 0x360); | 1429 | ASSERT_REG_POSITION(clear_color[0], 0x360); |
| 1429 | ASSERT_REG_POSITION(clear_depth, 0x364); | 1430 | ASSERT_REG_POSITION(clear_depth, 0x364); |
| 1430 | ASSERT_REG_POSITION(clear_stencil, 0x368); | 1431 | ASSERT_REG_POSITION(clear_stencil, 0x368); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 9eef7fcd2..88d78d2ad 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -1028,6 +1028,10 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { | |||
| 1028 | flip_y = !flip_y; | 1028 | flip_y = !flip_y; |
| 1029 | } | 1029 | } |
| 1030 | state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; | 1030 | state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; |
| 1031 | state.clip_control.depth_mode = | ||
| 1032 | regs.depth_mode == Tegra::Engines::Maxwell3D::Regs::DepthMode::ZeroToOne | ||
| 1033 | ? GL_ZERO_TO_ONE | ||
| 1034 | : GL_NEGATIVE_ONE_TO_ONE; | ||
| 1031 | } | 1035 | } |
| 1032 | 1036 | ||
| 1033 | void RasterizerOpenGL::SyncClipEnabled( | 1037 | void RasterizerOpenGL::SyncClipEnabled( |
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 39b3986d3..ccc1e050a 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -411,8 +411,9 @@ void OpenGLState::ApplyAlphaTest() { | |||
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | void OpenGLState::ApplyClipControl() { | 413 | void OpenGLState::ApplyClipControl() { |
| 414 | if (UpdateValue(cur_state.clip_control.origin, clip_control.origin)) { | 414 | if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), |
| 415 | glClipControl(clip_control.origin, GL_NEGATIVE_ONE_TO_ONE); | 415 | std::tie(clip_control.origin, clip_control.depth_mode))) { |
| 416 | glClipControl(clip_control.origin, clip_control.depth_mode); | ||
| 416 | } | 417 | } |
| 417 | } | 418 | } |
| 418 | 419 | ||
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index e53c2c5f2..0b5895084 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -150,6 +150,7 @@ public: | |||
| 150 | 150 | ||
| 151 | struct { | 151 | struct { |
| 152 | GLenum origin = GL_LOWER_LEFT; | 152 | GLenum origin = GL_LOWER_LEFT; |
| 153 | GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE; | ||
| 153 | } clip_control; | 154 | } clip_control; |
| 154 | 155 | ||
| 155 | OpenGLState(); | 156 | OpenGLState(); |