diff options
| author | 2022-10-10 20:32:38 +0100 | |
|---|---|---|
| committer | 2022-10-10 20:59:57 +0100 | |
| commit | 4496030ea9bd873d101628a8eb943b976ec7b07a (patch) | |
| tree | d26b116981aa0dd9eaec5e951976d59a63322de4 /src/video_core/renderer_opengl | |
| parent | Merge pull request #9043 from german77/vector_data (diff) | |
| download | yuzu-4496030ea9bd873d101628a8eb943b976ec7b07a.tar.gz yuzu-4496030ea9bd873d101628a8eb943b976ec7b07a.tar.xz yuzu-4496030ea9bd873d101628a8eb943b976ec7b07a.zip | |
Fix stencil func registers, make clip control equivalent to how it was before, but surely wrong.
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.cpp | 14 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index cce00cea8..e5c09a969 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -658,8 +658,13 @@ void RasterizerOpenGL::SyncDepthClamp() { | |||
| 658 | } | 658 | } |
| 659 | flags[Dirty::DepthClampEnabled] = false; | 659 | flags[Dirty::DepthClampEnabled] = false; |
| 660 | 660 | ||
| 661 | oglEnable(GL_DEPTH_CLAMP, maxwell3d->regs.viewport_clip_control.geometry_clip != | 661 | bool depth_clamp_disabled{maxwell3d->regs.viewport_clip_control.geometry_clip == |
| 662 | Maxwell::ViewportClipControl::GeometryClip::Passthrough); | 662 | Maxwell::ViewportClipControl::GeometryClip::Passthrough || |
| 663 | maxwell3d->regs.viewport_clip_control.geometry_clip == | ||
| 664 | Maxwell::ViewportClipControl::GeometryClip::FrustumXYZ || | ||
| 665 | maxwell3d->regs.viewport_clip_control.geometry_clip == | ||
| 666 | Maxwell::ViewportClipControl::GeometryClip::FrustumZ}; | ||
| 667 | oglEnable(GL_DEPTH_CLAMP, !depth_clamp_disabled); | ||
| 663 | } | 668 | } |
| 664 | 669 | ||
| 665 | void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) { | 670 | void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) { |
| @@ -746,19 +751,19 @@ void RasterizerOpenGL::SyncStencilTestState() { | |||
| 746 | oglEnable(GL_STENCIL_TEST, regs.stencil_enable); | 751 | oglEnable(GL_STENCIL_TEST, regs.stencil_enable); |
| 747 | 752 | ||
| 748 | glStencilFuncSeparate(GL_FRONT, MaxwellToGL::ComparisonOp(regs.stencil_front_op.func), | 753 | glStencilFuncSeparate(GL_FRONT, MaxwellToGL::ComparisonOp(regs.stencil_front_op.func), |
| 749 | regs.stencil_front_func.ref, regs.stencil_front_func.func_mask); | 754 | regs.stencil_front_ref, regs.stencil_front_func_mask); |
| 750 | glStencilOpSeparate(GL_FRONT, MaxwellToGL::StencilOp(regs.stencil_front_op.fail), | 755 | glStencilOpSeparate(GL_FRONT, MaxwellToGL::StencilOp(regs.stencil_front_op.fail), |
| 751 | MaxwellToGL::StencilOp(regs.stencil_front_op.zfail), | 756 | MaxwellToGL::StencilOp(regs.stencil_front_op.zfail), |
| 752 | MaxwellToGL::StencilOp(regs.stencil_front_op.zpass)); | 757 | MaxwellToGL::StencilOp(regs.stencil_front_op.zpass)); |
| 753 | glStencilMaskSeparate(GL_FRONT, regs.stencil_front_func.mask); | 758 | glStencilMaskSeparate(GL_FRONT, regs.stencil_front_mask); |
| 754 | 759 | ||
| 755 | if (regs.stencil_two_side_enable) { | 760 | if (regs.stencil_two_side_enable) { |
| 756 | glStencilFuncSeparate(GL_BACK, MaxwellToGL::ComparisonOp(regs.stencil_back_op.func), | 761 | glStencilFuncSeparate(GL_BACK, MaxwellToGL::ComparisonOp(regs.stencil_back_op.func), |
| 757 | regs.stencil_back_func.ref, regs.stencil_back_func.mask); | 762 | regs.stencil_back_ref, regs.stencil_back_mask); |
| 758 | glStencilOpSeparate(GL_BACK, MaxwellToGL::StencilOp(regs.stencil_back_op.fail), | 763 | glStencilOpSeparate(GL_BACK, MaxwellToGL::StencilOp(regs.stencil_back_op.fail), |
| 759 | MaxwellToGL::StencilOp(regs.stencil_back_op.zfail), | 764 | MaxwellToGL::StencilOp(regs.stencil_back_op.zfail), |
| 760 | MaxwellToGL::StencilOp(regs.stencil_back_op.zpass)); | 765 | MaxwellToGL::StencilOp(regs.stencil_back_op.zpass)); |
| 761 | glStencilMaskSeparate(GL_BACK, regs.stencil_back_func.mask); | 766 | glStencilMaskSeparate(GL_BACK, regs.stencil_back_mask); |
| 762 | } else { | 767 | } else { |
| 763 | glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFF); | 768 | glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFF); |
| 764 | glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP); | 769 | glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP); |
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index e2c709aac..a359f96f1 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp | |||
| @@ -100,14 +100,12 @@ void SetupDirtyDepthTest(Tables& tables) { | |||
| 100 | 100 | ||
| 101 | void SetupDirtyStencilTest(Tables& tables) { | 101 | void SetupDirtyStencilTest(Tables& tables) { |
| 102 | static constexpr std::array offsets = { | 102 | static constexpr std::array offsets = { |
| 103 | OFF(stencil_enable), OFF(stencil_front_op.func), | 103 | OFF(stencil_enable), OFF(stencil_front_op.func), OFF(stencil_front_ref), |
| 104 | OFF(stencil_front_func.ref), OFF(stencil_front_func.func_mask), | 104 | OFF(stencil_front_func_mask), OFF(stencil_front_op.fail), OFF(stencil_front_op.zfail), |
| 105 | OFF(stencil_front_op.fail), OFF(stencil_front_op.zfail), | 105 | OFF(stencil_front_op.zpass), OFF(stencil_front_mask), OFF(stencil_two_side_enable), |
| 106 | OFF(stencil_front_op.zpass), OFF(stencil_front_func.mask), | 106 | OFF(stencil_back_op.func), OFF(stencil_back_ref), OFF(stencil_back_func_mask), |
| 107 | OFF(stencil_two_side_enable), OFF(stencil_back_op.func), | 107 | OFF(stencil_back_op.fail), OFF(stencil_back_op.zfail), OFF(stencil_back_op.zpass), |
| 108 | OFF(stencil_back_func.ref), OFF(stencil_back_func.func_mask), | 108 | OFF(stencil_back_mask)}; |
| 109 | OFF(stencil_back_op.fail), OFF(stencil_back_op.zfail), | ||
| 110 | OFF(stencil_back_op.zpass), OFF(stencil_back_func.mask)}; | ||
| 111 | for (const auto offset : offsets) { | 109 | for (const auto offset : offsets) { |
| 112 | tables[0][offset] = StencilTest; | 110 | tables[0][offset] = StencilTest; |
| 113 | } | 111 | } |