diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-12-28 22:31:00 -0300 |
|---|---|---|
| committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-28 17:56:42 -0300 |
| commit | ba6f390448987c01ae0e4b7ffe98b77bbd47c6d9 (patch) | |
| tree | 7361f386e668982a6d279d032d2b475291e4e398 /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
| parent | 7f52efdf61d16d6eaa7eea2500ceb28d9f1041e1 (diff) | |
gl_state_tracker: Implement dirty flags for scissors
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 2427b8c07..2ec4c9f55 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1102,12 +1102,28 @@ void RasterizerOpenGL::SyncLogicOpState() { } void RasterizerOpenGL::SyncScissorTest() { - const auto& regs = system.GPU().Maxwell3D().regs; + auto& gpu = system.GPU().Maxwell3D(); + auto& flags = gpu.dirty.flags; + if (!flags[Dirty::Scissors]) { + return; + } + flags[Dirty::Scissors] = false; + + const auto& regs = gpu.regs; for (std::size_t index = 0; index < Maxwell::NumViewports; ++index) { + if (!flags[Dirty::Scissor0 + index]) { + continue; + } + flags[Dirty::Scissor0 + index] = false; + const auto& src = regs.scissor_test[index]; - oglEnablei(GL_SCISSOR_TEST, src.enable, static_cast<GLuint>(index)); - glScissorIndexed(static_cast<GLuint>(index), src.min_x, src.min_y, src.max_x - src.min_x, - src.max_y - src.min_y); + if (src.enable) { + glEnablei(GL_SCISSOR_TEST, static_cast<GLuint>(index)); + glScissorIndexed(static_cast<GLuint>(index), src.min_x, src.min_y, + src.max_x - src.min_x, src.max_y - src.min_y); + } else { + glDisablei(GL_SCISSOR_TEST, static_cast<GLuint>(index)); + } } } |
