diff options
| author | 2018-07-14 00:38:12 -0700 | |
|---|---|---|
| committer | 2018-07-14 00:38:12 -0700 | |
| commit | 81739a5448140d9b8d65c202e8fbd1a50392a71e (patch) | |
| tree | d8461d109d4e7f8282fff56899e1f07e41fbe241 /src | |
| parent | Merge pull request #657 from bunnei/dual-vs (diff) | |
| parent | GPU: Always enable the depth write when clearing the depth buffer. (diff) | |
| download | yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.gz yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.xz yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.zip | |
Merge pull request #660 from Subv/depth_write
GPU: Always enable the depth write when clearing the depth buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 4072a12b4..1da9e137c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -322,9 +322,6 @@ std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_c | |||
| 322 | bool using_depth_fb) { | 322 | bool using_depth_fb) { |
| 323 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 323 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; |
| 324 | 324 | ||
| 325 | // Sync the depth test state before configuring the framebuffer surfaces. | ||
| 326 | SyncDepthTestState(); | ||
| 327 | |||
| 328 | // TODO(bunnei): Implement this | 325 | // TODO(bunnei): Implement this |
| 329 | const bool has_stencil = false; | 326 | const bool has_stencil = false; |
| 330 | 327 | ||
| @@ -389,6 +386,13 @@ void RasterizerOpenGL::Clear() { | |||
| 389 | if (regs.clear_buffers.Z) { | 386 | if (regs.clear_buffers.Z) { |
| 390 | clear_mask |= GL_DEPTH_BUFFER_BIT; | 387 | clear_mask |= GL_DEPTH_BUFFER_BIT; |
| 391 | use_depth_fb = true; | 388 | use_depth_fb = true; |
| 389 | |||
| 390 | // Always enable the depth write when clearing the depth buffer. The depth write mask is | ||
| 391 | // ignored when clearing the buffer in the Switch, but OpenGL obeys it so we set it to true. | ||
| 392 | state.depth.test_enabled = true; | ||
| 393 | state.depth.write_mask = GL_TRUE; | ||
| 394 | state.depth.test_func = GL_ALWAYS; | ||
| 395 | state.Apply(); | ||
| 392 | } | 396 | } |
| 393 | 397 | ||
| 394 | if (clear_mask == 0) | 398 | if (clear_mask == 0) |
| @@ -423,6 +427,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 423 | auto [dirty_color_surface, dirty_depth_surface] = | 427 | auto [dirty_color_surface, dirty_depth_surface] = |
| 424 | ConfigureFramebuffers(true, regs.zeta.Address() != 0); | 428 | ConfigureFramebuffers(true, regs.zeta.Address() != 0); |
| 425 | 429 | ||
| 430 | SyncDepthTestState(); | ||
| 426 | SyncBlendState(); | 431 | SyncBlendState(); |
| 427 | SyncCullMode(); | 432 | SyncCullMode(); |
| 428 | 433 | ||