diff options
author | bunnei <bunneidev@gmail.com> | 2019-07-21 06:59:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-21 06:59:52 +0200 |
commit | 27e10e0442dfd347387c6eaf148b27f5cc38bcaf (patch) | |
tree | c078fc3f0e62e55fc92a0c8b582666deece0a968 /src/video_core/renderer_opengl/gl_state.cpp | |
parent | Update README.md (diff) | |
parent | Maxwell3D: Reorganize and address feedback (diff) | |
download | yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.gz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.bz2 yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.lz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.xz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.zst yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_state.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 0eae98afe..f4777d0b0 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -165,6 +165,25 @@ OpenGLState::OpenGLState() { alpha_test.ref = 0.0f; } +void OpenGLState::SetDefaultViewports() { + for (auto& item : viewports) { + item.x = 0; + item.y = 0; + item.width = 0; + item.height = 0; + item.depth_range_near = 0.0f; + item.depth_range_far = 1.0f; + item.scissor.enabled = false; + item.scissor.x = 0; + item.scissor.y = 0; + item.scissor.width = 0; + item.scissor.height = 0; + } + + depth_clamp.far_plane = false; + depth_clamp.near_plane = false; +} + void OpenGLState::ApplyDefaultState() { glEnable(GL_BLEND); glDisable(GL_FRAMEBUFFER_SRGB); @@ -526,7 +545,7 @@ void OpenGLState::ApplySamplers() const { } } -void OpenGLState::Apply() const { +void OpenGLState::Apply() { MICROPROFILE_SCOPE(OpenGL_State); ApplyFramebufferState(); ApplyVertexArrayState(); @@ -536,19 +555,31 @@ void OpenGLState::Apply() const { ApplyPointSize(); ApplyFragmentColorClamp(); ApplyMultisample(); + if (dirty.color_mask) { + ApplyColorMask(); + dirty.color_mask = false; + } ApplyDepthClamp(); - ApplyColorMask(); ApplyViewport(); - ApplyStencilTest(); + if (dirty.stencil_state) { + ApplyStencilTest(); + dirty.stencil_state = false; + } ApplySRgb(); ApplyCulling(); ApplyDepth(); ApplyPrimitiveRestart(); - ApplyBlending(); + if (dirty.blend_state) { + ApplyBlending(); + dirty.blend_state = false; + } ApplyLogicOp(); ApplyTextures(); ApplySamplers(); - ApplyPolygonOffset(); + if (dirty.polygon_offset) { + ApplyPolygonOffset(); + dirty.polygon_offset = false; + } ApplyAlphaTest(); } |