From e6ace388156735d3f5e2942cafc3d5f5d46b121b Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 25 May 2015 18:39:03 -0400 Subject: Pica: Implement LogicOp function. --- src/video_core/renderer_opengl/gl_state.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/video_core/renderer_opengl/gl_state.cpp') diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 0d7ba198..9c5f38f9 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -32,6 +32,8 @@ OpenGLState::OpenGLState() { blend.color.blue = 0.0f; blend.color.alpha = 0.0f; + logic_op = GL_COPY; + for (auto& texture_unit : texture_units) { texture_unit.enabled_2d = false; texture_unit.texture_2d = 0; @@ -99,8 +101,13 @@ void OpenGLState::Apply() { if (blend.enabled != cur_state.blend.enabled) { if (blend.enabled) { glEnable(GL_BLEND); + + cur_state.logic_op = GL_COPY; + glLogicOp(cur_state.logic_op); + glDisable(GL_COLOR_LOGIC_OP); } else { glDisable(GL_BLEND); + glEnable(GL_COLOR_LOGIC_OP); } } @@ -118,6 +125,10 @@ void OpenGLState::Apply() { glBlendFuncSeparate(blend.src_rgb_func, blend.dst_rgb_func, blend.src_a_func, blend.dst_a_func); } + if (logic_op != cur_state.logic_op) { + glLogicOp(logic_op); + } + // Textures for (unsigned texture_index = 0; texture_index < ARRAY_SIZE(texture_units); ++texture_index) { if (texture_units[texture_index].enabled_2d != cur_state.texture_units[texture_index].enabled_2d) { -- cgit v1.2.3