From 1eee891f6e73423a9aa6147f980be5aea799e7ce Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 26 Dec 2019 02:20:08 -0300 Subject: gl_state: Remove clip distances tracking --- src/video_core/engines/maxwell_3d.h | 11 +---------- src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 ++-------- src/video_core/renderer_opengl/gl_state.cpp | 8 -------- src/video_core/renderer_opengl/gl_state.h | 3 --- 4 files changed, 3 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 2134d6e4f..b0fb0fb7d 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -872,16 +872,7 @@ public: INSERT_UNION_PADDING_WORDS(0x35); - union { - BitField<0, 1, u32> c0; - BitField<1, 1, u32> c1; - BitField<2, 1, u32> c2; - BitField<3, 1, u32> c3; - BitField<4, 1, u32> c4; - BitField<5, 1, u32> c5; - BitField<6, 1, u32> c6; - BitField<7, 1, u32> c7; - } clip_distance_enabled; + u32 clip_distance_enabled; u32 samplecnt_enable; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index cb3c81398..f4efddcc0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -969,16 +969,10 @@ void RasterizerOpenGL::SyncDepthClamp() { void RasterizerOpenGL::SyncClipEnabled( const std::array& clip_mask) { - const auto& regs = system.GPU().Maxwell3D().regs; - const std::array reg_state{ - regs.clip_distance_enabled.c0 != 0, regs.clip_distance_enabled.c1 != 0, - regs.clip_distance_enabled.c2 != 0, regs.clip_distance_enabled.c3 != 0, - regs.clip_distance_enabled.c4 != 0, regs.clip_distance_enabled.c5 != 0, - regs.clip_distance_enabled.c6 != 0, regs.clip_distance_enabled.c7 != 0}; - for (std::size_t i = 0; i < Maxwell::Regs::NumClipDistances; ++i) { - state.clip_distance[i] = reg_state[i] && clip_mask[i]; + oglEnable(static_cast(GL_CLIP_DISTANCE0 + i), + clip_mask[i] && ((regs.clip_distance_enabled >> i) & 1)); } } diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 96c3f40f4..5505fee73 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -106,13 +106,6 @@ void OpenGLState::ApplyProgramPipeline() { } } -void OpenGLState::ApplyClipDistances() { - for (std::size_t i = 0; i < clip_distance.size(); ++i) { - Enable(GL_CLIP_DISTANCE0 + static_cast(i), cur_state.clip_distance[i], - clip_distance[i]); - } -} - void OpenGLState::ApplyStencilTest() { Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled); @@ -249,7 +242,6 @@ void OpenGLState::Apply() { ApplyFramebufferState(); ApplyShaderProgram(); ApplyProgramPipeline(); - ApplyClipDistances(); ApplyStencilTest(); ApplyBlending(); ApplyTextures(); diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 6520c88d2..e0bfd16ad 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -54,8 +54,6 @@ public: GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING } draw; - std::array clip_distance = {}; // GL_CLIP_DISTANCE - struct { GLenum origin = GL_LOWER_LEFT; GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE; @@ -76,7 +74,6 @@ public: void ApplyFramebufferState(); void ApplyShaderProgram(); void ApplyProgramPipeline(); - void ApplyClipDistances(); void ApplyStencilTest(); void ApplyTargetBlending(std::size_t target, bool force); void ApplyGlobalBlending(); -- cgit v1.2.3