diff options
| author | 2019-12-25 21:57:10 -0300 | |
|---|---|---|
| committer | 2020-02-28 16:53:35 -0300 | |
| commit | 2a662fea363027817a73a62a5e4a9d0066fb43ee (patch) | |
| tree | ebedf3ebea5fde257e7c91e03e0ae07cecd4aca7 /src | |
| parent | gl_state: Remove depth tracking (diff) | |
| download | yuzu-2a662fea363027817a73a62a5e4a9d0066fb43ee.tar.gz yuzu-2a662fea363027817a73a62a5e4a9d0066fb43ee.tar.xz yuzu-2a662fea363027817a73a62a5e4a9d0066fb43ee.zip | |
gl_state: Remove depth clamp tracking
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 3 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 6 |
4 files changed, 13 insertions, 25 deletions
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) { | |||
| 977 | viewport.depth_range_far = src.depth_range_far; | 977 | viewport.depth_range_far = src.depth_range_far; |
| 978 | viewport.depth_range_near = src.depth_range_near; | 978 | viewport.depth_range_near = src.depth_range_near; |
| 979 | } | 979 | } |
| 980 | state.depth_clamp.far_plane = regs.view_volume_clip_control.depth_clamp_far != 0; | ||
| 981 | state.depth_clamp.near_plane = regs.view_volume_clip_control.depth_clamp_near != 0; | ||
| 982 | 980 | ||
| 983 | bool flip_y = false; | 981 | bool flip_y = false; |
| 984 | if (regs.viewport_transform[0].scale_y < 0.0) { | 982 | if (regs.viewport_transform[0].scale_y < 0.0) { |
| @@ -994,6 +992,16 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { | |||
| 994 | : GL_NEGATIVE_ONE_TO_ONE; | 992 | : GL_NEGATIVE_ONE_TO_ONE; |
| 995 | } | 993 | } |
| 996 | 994 | ||
| 995 | void RasterizerOpenGL::SyncDepthClamp() { | ||
| 996 | const auto& regs = system.GPU().Maxwell3D().regs; | ||
| 997 | const auto& state = regs.view_volume_clip_control; | ||
| 998 | |||
| 999 | UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near, | ||
| 1000 | "Unimplemented Depth clamp separation!"); | ||
| 1001 | |||
| 1002 | oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near); | ||
| 1003 | } | ||
| 1004 | |||
| 997 | void RasterizerOpenGL::SyncClipEnabled( | 1005 | void RasterizerOpenGL::SyncClipEnabled( |
| 998 | const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) { | 1006 | const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) { |
| 999 | 1007 | ||
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: | |||
| 132 | /// Syncs the viewport and depth range to match the guest state | 132 | /// Syncs the viewport and depth range to match the guest state |
| 133 | void SyncViewport(OpenGLState& current_state); | 133 | void SyncViewport(OpenGLState& current_state); |
| 134 | 134 | ||
| 135 | /// Syncs the depth clamp state | ||
| 136 | void SyncDepthClamp(); | ||
| 137 | |||
| 135 | /// Syncs the clip enabled status to match the guest state | 138 | /// Syncs the clip enabled status to match the guest state |
| 136 | void SyncClipEnabled( | 139 | void SyncClipEnabled( |
| 137 | const std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances>& clip_mask); | 140 | const std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances>& 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; | |||
| 87 | 87 | ||
| 88 | void OpenGLState::SetDefaultViewports() { | 88 | void OpenGLState::SetDefaultViewports() { |
| 89 | viewports.fill(Viewport{}); | 89 | viewports.fill(Viewport{}); |
| 90 | |||
| 91 | depth_clamp.far_plane = false; | ||
| 92 | depth_clamp.near_plane = false; | ||
| 93 | } | 90 | } |
| 94 | 91 | ||
| 95 | void OpenGLState::ApplyFramebufferState() { | 92 | void OpenGLState::ApplyFramebufferState() { |
| @@ -140,19 +137,6 @@ void OpenGLState::ApplyMultisample() { | |||
| 140 | multisample_control.alpha_to_one); | 137 | multisample_control.alpha_to_one); |
| 141 | } | 138 | } |
| 142 | 139 | ||
| 143 | void OpenGLState::ApplyDepthClamp() { | ||
| 144 | if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && | ||
| 145 | depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { | ||
| 146 | return; | ||
| 147 | } | ||
| 148 | cur_state.depth_clamp = depth_clamp; | ||
| 149 | |||
| 150 | UNIMPLEMENTED_IF_MSG(depth_clamp.far_plane != depth_clamp.near_plane, | ||
| 151 | "Unimplemented Depth Clamp Separation!"); | ||
| 152 | |||
| 153 | Enable(GL_DEPTH_CLAMP, depth_clamp.far_plane || depth_clamp.near_plane); | ||
| 154 | } | ||
| 155 | |||
| 156 | void OpenGLState::ApplySRgb() { | 140 | void OpenGLState::ApplySRgb() { |
| 157 | if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled) | 141 | if (cur_state.framebuffer_srgb.enabled == framebuffer_srgb.enabled) |
| 158 | return; | 142 | return; |
| @@ -362,7 +346,6 @@ void OpenGLState::Apply() { | |||
| 362 | ApplyMultisample(); | 346 | ApplyMultisample(); |
| 363 | ApplyRasterizerDiscard(); | 347 | ApplyRasterizerDiscard(); |
| 364 | ApplyColorMask(); | 348 | ApplyColorMask(); |
| 365 | ApplyDepthClamp(); | ||
| 366 | ApplyViewport(); | 349 | ApplyViewport(); |
| 367 | ApplyStencilTest(); | 350 | ApplyStencilTest(); |
| 368 | ApplySRgb(); | 351 | 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: | |||
| 26 | bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB | 26 | bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB |
| 27 | } fragment_color_clamp; | 27 | } fragment_color_clamp; |
| 28 | 28 | ||
| 29 | struct { | ||
| 30 | bool far_plane = false; | ||
| 31 | bool near_plane = false; | ||
| 32 | } depth_clamp; // GL_DEPTH_CLAMP | ||
| 33 | |||
| 34 | bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD | 29 | bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD |
| 35 | 30 | ||
| 36 | struct ColorMask { | 31 | struct ColorMask { |
| @@ -139,7 +134,6 @@ public: | |||
| 139 | void ApplyTextures(); | 134 | void ApplyTextures(); |
| 140 | void ApplySamplers(); | 135 | void ApplySamplers(); |
| 141 | void ApplyImages(); | 136 | void ApplyImages(); |
| 142 | void ApplyDepthClamp(); | ||
| 143 | void ApplyClipControl(); | 137 | void ApplyClipControl(); |
| 144 | void ApplyRenderBuffer(); | 138 | void ApplyRenderBuffer(); |
| 145 | 139 | ||