diff options
author | Rodolfo Bogado <rodolfoosvaldobogado@gmail.com> | 2018-11-23 16:11:21 +0100 |
---|---|---|
committer | Rodolfo Bogado <rodolfoosvaldobogado@gmail.com> | 2018-11-27 00:56:32 +0100 |
commit | dfdbfa69e5290239b839a3c1600e171c15e86290 (patch) | |
tree | 3a7b357d35949c0b0b0025abc2ff007cb8b4f0d5 /src/video_core/renderer_opengl/gl_state.cpp | |
parent | Merge pull request #1794 from Tinob/master (diff) | |
download | yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar.gz yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar.bz2 yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar.lz yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar.xz yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.tar.zst yuzu-dfdbfa69e5290239b839a3c1600e171c15e86290.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index b3bfad6a0..dc0a5ed5e 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -92,7 +92,8 @@ OpenGLState::OpenGLState() { point.size = 1; fragment_color_clamp.enabled = false; - + depth_clamp.far_plane = false; + depth_clamp.near_plane = false; polygon_offset.fill_enable = false; polygon_offset.line_enable = false; polygon_offset.point_enable = false; @@ -147,7 +148,7 @@ void OpenGLState::ApplyCulling() const { } void OpenGLState::ApplyColorMask() const { - if (GLAD_GL_ARB_viewport_array && independant_blend.enabled) { + if (independant_blend.enabled) { for (size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) { const auto& updated = color_mask[i]; const auto& current = cur_state.color_mask[i]; @@ -264,7 +265,7 @@ void OpenGLState::EmulateViewportWithScissor() { } void OpenGLState::ApplyViewport() const { - if (GLAD_GL_ARB_viewport_array && geometry_shaders.enabled) { + if (geometry_shaders.enabled) { for (GLuint i = 0; i < static_cast<GLuint>(Tegra::Engines::Maxwell3D::Regs::NumViewports); i++) { const auto& current = cur_state.viewports[i]; @@ -525,6 +526,21 @@ void OpenGLState::ApplyVertexBufferState() const { } } +void OpenGLState::ApplyDepthClamp() const { + if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && + depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { + return; + } + if (depth_clamp.far_plane != depth_clamp.near_plane) { + UNIMPLEMENTED_MSG("Unimplemented Depth Clamp Separation!"); + } + if (depth_clamp.far_plane || depth_clamp.near_plane) { + glEnable(GL_DEPTH_CLAMP); + } else { + glDisable(GL_DEPTH_CLAMP); + } +} + void OpenGLState::Apply() const { ApplyFramebufferState(); ApplyVertexBufferState(); @@ -556,11 +572,9 @@ void OpenGLState::Apply() const { if (point.size != cur_state.point.size) { glPointSize(point.size); } - if (GLAD_GL_ARB_color_buffer_float) { - if (fragment_color_clamp.enabled != cur_state.fragment_color_clamp.enabled) { - glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB, - fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE); - } + if (fragment_color_clamp.enabled != cur_state.fragment_color_clamp.enabled) { + glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB, + fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE); } if (multisample_control.alpha_to_coverage != cur_state.multisample_control.alpha_to_coverage) { if (multisample_control.alpha_to_coverage) { @@ -576,7 +590,7 @@ void OpenGLState::Apply() const { glDisable(GL_SAMPLE_ALPHA_TO_ONE); } } - + ApplyDepthClamp(); ApplyColorMask(); ApplyViewport(); ApplyStencilTest(); |