From be97fc884df62d18aa488be7f019e6db6696636b Mon Sep 17 00:00:00 2001 From: FernandoS27 Date: Mon, 8 Oct 2018 21:21:22 -0400 Subject: Implement Scissor Test --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 41e59a457..daae67121 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -976,11 +976,16 @@ void RasterizerOpenGL::SyncAlphaTest() { void RasterizerOpenGL::SyncScissorTest() { const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; - // TODO(Rodrigo): Alpha testing is a legacy OpenGL feature, but it can be - // implemented with a test+discard in fragment shaders. + state.scissor.enabled = (regs.scissor_test.enable != 0); + // TODO(Blinkhawk): Figure if the hardware supports scissor testing per viewport and how it's + // implemented. if (regs.scissor_test.enable != 0) { - LOG_CRITICAL(Render_OpenGL, "Scissor testing is not implemented"); - UNREACHABLE(); + const u32 width = regs.scissor_test.max_x - regs.scissor_test.min_x; + const u32 height = regs.scissor_test.max_y - regs.scissor_test.min_y; + state.scissor.x = regs.scissor_test.min_x; + state.scissor.y = regs.scissor_test.min_y; + state.scissor.width = width; + state.scissor.height = height; } } -- cgit v1.2.3