From 07a954e67f786fad4b6324837489af705788a6b9 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 26 Dec 2019 02:27:26 -0300 Subject: gl_state: Remove clip control tracking --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 11 ++++++----- src/video_core/renderer_opengl/gl_state.cpp | 8 -------- src/video_core/renderer_opengl/gl_state.h | 6 ------ src/video_core/renderer_opengl/gl_texture_cache.cpp | 1 + src/video_core/renderer_opengl/renderer_opengl.cpp | 1 + 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f4efddcc0..8f9bb4c93 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -467,6 +467,9 @@ void RasterizerOpenGL::Clear() { SyncScissorTest(); } + // TODO: Signal state tracker about these changes + glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); + UNIMPLEMENTED_IF(regs.clear_flags.viewport); clear_state.Apply(); @@ -950,11 +953,9 @@ void RasterizerOpenGL::SyncViewport() { if (regs.screen_y_control.y_negate != 0) { flip_y = !flip_y; } - state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; - state.clip_control.depth_mode = - regs.depth_mode == Tegra::Engines::Maxwell3D::Regs::DepthMode::ZeroToOne - ? GL_ZERO_TO_ONE - : GL_NEGATIVE_ONE_TO_ONE; + glClipControl(flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT, + regs.depth_mode == Maxwell::DepthMode::ZeroToOne ? GL_ZERO_TO_ONE + : GL_NEGATIVE_ONE_TO_ONE); } void RasterizerOpenGL::SyncDepthClamp() { diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 5505fee73..69a8a4eb1 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -195,13 +195,6 @@ void OpenGLState::ApplyBlending() { cur_state.independant_blend.enabled = independant_blend.enabled; } -void OpenGLState::ApplyClipControl() { - if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), - std::tie(clip_control.origin, clip_control.depth_mode))) { - glClipControl(clip_control.origin, clip_control.depth_mode); - } -} - void OpenGLState::ApplyRenderBuffer() { if (cur_state.renderbuffer != renderbuffer) { cur_state.renderbuffer = renderbuffer; @@ -247,7 +240,6 @@ void OpenGLState::Apply() { ApplyTextures(); ApplySamplers(); ApplyImages(); - ApplyClipControl(); ApplyRenderBuffer(); } diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index e0bfd16ad..6ea625c56 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -54,11 +54,6 @@ public: GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING } draw; - struct { - GLenum origin = GL_LOWER_LEFT; - GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE; - } clip_control; - GLuint renderbuffer{}; // GL_RENDERBUFFER_BINDING OpenGLState(); @@ -81,7 +76,6 @@ public: void ApplyTextures(); void ApplySamplers(); void ApplyImages(); - void ApplyClipControl(); void ApplyRenderBuffer(); /// Resets any references to the given resource diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index ed2daf74c..85d41f826 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -539,6 +539,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view, // TODO(Rodrigo): Find out if rasterizer discard affects blits glDisable(GL_RASTERIZER_DISCARD); glDisablei(GL_SCISSOR_TEST, 0); + glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); u32 buffers{}; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index d18adaddc..a4cf6a489 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -585,6 +585,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { glCullFace(GL_BACK); glFrontFace(GL_CW); glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); glViewport(0, 0, layout.width, layout.height); glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE, -- cgit v1.2.3