summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-26 07:34:29 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:32:05 +0100
commit7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a (patch)
tree1bab402ced0e876a89696487d12ae4cb9a6a10ca /src/video_core/renderer_opengl/gl_rasterizer.cpp
parentgl_state: Remove clip control tracking (diff)
downloadyuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar.gz
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar.bz2
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar.lz
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar.xz
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.tar.zst
yuzu-7d9a5e9e30b9e197e5fe3bfd10116e7ea078494a.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp65
1 files changed, 17 insertions, 48 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8f9bb4c93..573f14cab 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -427,32 +427,6 @@ void RasterizerOpenGL::Clear() {
if (regs.clear_buffers.S) {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
use_stencil = true;
- clear_state.stencil.test_enabled = true;
-
- if (regs.clear_flags.stencil) {
- // Stencil affects the clear so fill it with the used masks
- clear_state.stencil.front.test_func = GL_ALWAYS;
- clear_state.stencil.front.test_mask = regs.stencil_front_func_mask;
- clear_state.stencil.front.action_stencil_fail = GL_KEEP;
- clear_state.stencil.front.action_depth_fail = GL_KEEP;
- clear_state.stencil.front.action_depth_pass = GL_KEEP;
- clear_state.stencil.front.write_mask = regs.stencil_front_mask;
- if (regs.stencil_two_side_enable) {
- clear_state.stencil.back.test_func = GL_ALWAYS;
- clear_state.stencil.back.test_mask = regs.stencil_back_func_mask;
- clear_state.stencil.back.action_stencil_fail = GL_KEEP;
- clear_state.stencil.back.action_depth_fail = GL_KEEP;
- clear_state.stencil.back.action_depth_pass = GL_KEEP;
- clear_state.stencil.back.write_mask = regs.stencil_back_mask;
- } else {
- clear_state.stencil.back.test_func = GL_ALWAYS;
- clear_state.stencil.back.test_mask = 0xFFFFFFFF;
- clear_state.stencil.back.write_mask = 0xFFFFFFFF;
- clear_state.stencil.back.action_stencil_fail = GL_KEEP;
- clear_state.stencil.back.action_depth_fail = GL_KEEP;
- clear_state.stencil.back.action_depth_pass = GL_KEEP;
- }
- }
}
if (!use_color && !use_depth && !use_stencil) {
@@ -1011,35 +985,30 @@ void RasterizerOpenGL::SyncDepthTestState() {
void RasterizerOpenGL::SyncStencilTestState() {
auto& maxwell3d = system.GPU().Maxwell3D();
const auto& regs = maxwell3d.regs;
- state.stencil.test_enabled = regs.stencil_enable != 0;
+ oglEnable(GL_STENCIL_TEST, regs.stencil_enable);
if (!regs.stencil_enable) {
return;
}
- state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func);
- state.stencil.front.test_ref = regs.stencil_front_func_ref;
- state.stencil.front.test_mask = regs.stencil_front_func_mask;
- state.stencil.front.action_stencil_fail = MaxwellToGL::StencilOp(regs.stencil_front_op_fail);
- state.stencil.front.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_front_op_zfail);
- state.stencil.front.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_front_op_zpass);
- state.stencil.front.write_mask = regs.stencil_front_mask;
+ glStencilFuncSeparate(GL_FRONT, MaxwellToGL::ComparisonOp(regs.stencil_front_func_func),
+ regs.stencil_front_func_ref, regs.stencil_front_func_mask);
+ glStencilOpSeparate(GL_FRONT, MaxwellToGL::StencilOp(regs.stencil_front_op_fail),
+ MaxwellToGL::StencilOp(regs.stencil_front_op_zfail),
+ MaxwellToGL::StencilOp(regs.stencil_front_op_zpass));
+ glStencilMaskSeparate(GL_FRONT, regs.stencil_front_mask);
+
if (regs.stencil_two_side_enable) {
- state.stencil.back.test_func = MaxwellToGL::ComparisonOp(regs.stencil_back_func_func);
- state.stencil.back.test_ref = regs.stencil_back_func_ref;
- state.stencil.back.test_mask = regs.stencil_back_func_mask;
- state.stencil.back.action_stencil_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_fail);
- state.stencil.back.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_zfail);
- state.stencil.back.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_back_op_zpass);
- state.stencil.back.write_mask = regs.stencil_back_mask;
+ glStencilFuncSeparate(GL_BACK, MaxwellToGL::ComparisonOp(regs.stencil_back_func_func),
+ regs.stencil_back_func_ref, regs.stencil_back_func_mask);
+ glStencilOpSeparate(GL_BACK, MaxwellToGL::StencilOp(regs.stencil_back_op_fail),
+ MaxwellToGL::StencilOp(regs.stencil_back_op_zfail),
+ MaxwellToGL::StencilOp(regs.stencil_back_op_zpass));
+ glStencilMaskSeparate(GL_BACK, regs.stencil_back_mask);
} else {
- state.stencil.back.test_func = GL_ALWAYS;
- state.stencil.back.test_ref = 0;
- state.stencil.back.test_mask = 0xFFFFFFFF;
- state.stencil.back.write_mask = 0xFFFFFFFF;
- state.stencil.back.action_stencil_fail = GL_KEEP;
- state.stencil.back.action_depth_fail = GL_KEEP;
- state.stencil.back.action_depth_pass = GL_KEEP;
+ glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFF);
+ glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP);
+ glStencilMaskSeparate(GL_BACK, 0xFFFFFFFF);
}
}