diff options
| author | bunnei <bunneidev@gmail.com> | 2018-08-22 01:05:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-22 01:05:25 -0400 |
| commit | 125d7122ac6c369d461d4219aaecfe4563362c01 (patch) | |
| tree | 19dfc78904b0cced2abfa05aaebd5fa2a8f88a85 /src/video_core/renderer_opengl/gl_state.cpp | |
| parent | 92b85fad70084d8f37a97939cbb18e131f531b11 (diff) | |
| parent | 2b9eee4d1ed13e98de21d88d8920288b58d7f4eb (diff) | |
Merge pull request #1124 from Subv/logic_ops
GPU: Implemented logic ops.
Diffstat (limited to 'src/video_core/renderer_opengl/gl_state.cpp')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 1d1975179..13399ceb8 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -45,7 +45,8 @@ OpenGLState::OpenGLState() { blend.color.blue = 0.0f; blend.color.alpha = 0.0f; - logic_op = GL_COPY; + logic_op.enabled = false; + logic_op.operation = GL_COPY; for (auto& texture_unit : texture_units) { texture_unit.Reset(); @@ -148,11 +149,10 @@ void OpenGLState::Apply() const { // Blending if (blend.enabled != cur_state.blend.enabled) { if (blend.enabled) { + ASSERT(!logic_op.enabled); glEnable(GL_BLEND); - glDisable(GL_COLOR_LOGIC_OP); } else { glDisable(GL_BLEND); - glEnable(GL_COLOR_LOGIC_OP); } } @@ -176,8 +176,18 @@ void OpenGLState::Apply() const { glBlendEquationSeparate(blend.rgb_equation, blend.a_equation); } - if (logic_op != cur_state.logic_op) { - glLogicOp(logic_op); + // Logic Operation + if (logic_op.enabled != cur_state.logic_op.enabled) { + if (logic_op.enabled) { + ASSERT(!blend.enabled); + glEnable(GL_COLOR_LOGIC_OP); + } else { + glDisable(GL_COLOR_LOGIC_OP); + } + } + + if (logic_op.operation != cur_state.logic_op.operation) { + glLogicOp(logic_op.operation); } // Textures |
