From 2a662fea363027817a73a62a5e4a9d0066fb43ee Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 25 Dec 2019 21:57:10 -0300 Subject: gl_state: Remove depth clamp tracking --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 12 ++++++++++-- src/video_core/renderer_opengl/gl_rasterizer.h | 3 +++ src/video_core/renderer_opengl/gl_state.cpp | 17 ----------------- src/video_core/renderer_opengl/gl_state.h | 6 ------ 4 files changed, 13 insertions(+), 25 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 6bb6f9f47..acdae849c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -977,8 +977,6 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { viewport.depth_range_far = src.depth_range_far; viewport.depth_range_near = src.depth_range_near; } - state.depth_clamp.far_plane = regs.view_volume_clip_control.depth_clamp_far != 0; - state.depth_clamp.near_plane = regs.view_volume_clip_control.depth_clamp_near != 0; bool flip_y = false; if (regs.viewport_transform[0].scale_y < 0.0) { @@ -994,6 +992,16 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { : GL_NEGATIVE_ONE_TO_ONE; } +void RasterizerOpenGL::SyncDepthClamp() { + const auto& regs = system.GPU().Maxwell3D().regs; + const auto& state = regs.view_volume_clip_control; + + UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near, + "Unimplemented Depth clamp separation!"); + + oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near); +} + void RasterizerOpenGL::SyncClipEnabled( const std::array& clip_mask) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 68abe9a21..8afc3c205 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -132,6 +132,9 @@ private: /// Syncs the viewport and depth range to match the guest state void SyncViewport(OpenGLState& current_state); + /// Syncs the depth clamp state + void SyncDepthClamp(); + /// Syncs the clip enabled status to match the guest state void SyncClipEnabled( const std::array& clip_mask); diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 45fa3042d..6b5eea342 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -87,9 +87,6 @@ OpenGLState::OpenGLState() = default; void OpenGLState::SetDefaultViewports() { viewports.fill(Viewport{}); - - depth_clamp.far_plane = false; - depth_clamp.near_plane = false; } void OpenGLState::ApplyFramebufferState() { @@ -140,19 +137,6 @@ void OpenGLState::ApplyMultisample() { multisample_control.alpha_to_one); } -void OpenGLState::ApplyDepthClamp() { - if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && - depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { - return; - } - cur_state.depth_clamp = depth_clamp; - - UNIMPLEMENTED_IF_MSG(depth_clamp.far_plane != depth_clamp.near_plane, - "Unimplemented Depth Clamp Separation!"); - - Enable(GL_DEPTH_CLAMP, depth_clamp.far_plane || depth_clamp.near_plane); -} - void OpenGLState::ApplySRgb() { if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled) return; @@ -362,7 +346,6 @@ void OpenGLState::Apply() { ApplyMultisample(); ApplyRasterizerDiscard(); ApplyColorMask(); - ApplyDepthClamp(); ApplyViewport(); ApplyStencilTest(); ApplySRgb(); diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 036eeae97..366753714 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -26,11 +26,6 @@ public: bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB } fragment_color_clamp; - struct { - bool far_plane = false; - bool near_plane = false; - } depth_clamp; // GL_DEPTH_CLAMP - bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD struct ColorMask { @@ -139,7 +134,6 @@ public: void ApplyTextures(); void ApplySamplers(); void ApplyImages(); - void ApplyDepthClamp(); void ApplyClipControl(); void ApplyRenderBuffer(); -- cgit v1.2.3