summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Subv2018-08-20 18:43:11 -0500
committerGravatar Subv2018-08-20 18:43:11 -0500
commitf24ab6d9e6c34c6e8946657d71e7b70c3c06e05a (patch)
tree60a6bda0a1a6335ba22ea5d6e3306358d74676c5
parentGPU: Added registers for the logicop functionality. (diff)
downloadyuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.gz
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.xz
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.zip
GLState: Allow enabling/disabling GL_COLOR_LOGIC_OP independently from blending.
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp20
-rw-r--r--src/video_core/renderer_opengl/gl_state.h5
2 files changed, 19 insertions, 6 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() {
45 blend.color.blue = 0.0f; 45 blend.color.blue = 0.0f;
46 blend.color.alpha = 0.0f; 46 blend.color.alpha = 0.0f;
47 47
48 logic_op = GL_COPY; 48 logic_op.enabled = false;
49 logic_op.operation = GL_COPY;
49 50
50 for (auto& texture_unit : texture_units) { 51 for (auto& texture_unit : texture_units) {
51 texture_unit.Reset(); 52 texture_unit.Reset();
@@ -148,11 +149,10 @@ void OpenGLState::Apply() const {
148 // Blending 149 // Blending
149 if (blend.enabled != cur_state.blend.enabled) { 150 if (blend.enabled != cur_state.blend.enabled) {
150 if (blend.enabled) { 151 if (blend.enabled) {
152 ASSERT(!logic_op.enabled);
151 glEnable(GL_BLEND); 153 glEnable(GL_BLEND);
152 glDisable(GL_COLOR_LOGIC_OP);
153 } else { 154 } else {
154 glDisable(GL_BLEND); 155 glDisable(GL_BLEND);
155 glEnable(GL_COLOR_LOGIC_OP);
156 } 156 }
157 } 157 }
158 158
@@ -176,8 +176,18 @@ void OpenGLState::Apply() const {
176 glBlendEquationSeparate(blend.rgb_equation, blend.a_equation); 176 glBlendEquationSeparate(blend.rgb_equation, blend.a_equation);
177 } 177 }
178 178
179 if (logic_op != cur_state.logic_op) { 179 // Logic Operation
180 glLogicOp(logic_op); 180 if (logic_op.enabled != cur_state.logic_op.enabled) {
181 if (logic_op.enabled) {
182 ASSERT(!blend.enabled);
183 glEnable(GL_COLOR_LOGIC_OP);
184 } else {
185 glDisable(GL_COLOR_LOGIC_OP);
186 }
187 }
188
189 if (logic_op.operation != cur_state.logic_op.operation) {
190 glLogicOp(logic_op.operation);
181 } 191 }
182 192
183 // Textures 193 // Textures
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index bdb02ba25..219b65a8a 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -83,7 +83,10 @@ public:
83 } color; // GL_BLEND_COLOR 83 } color; // GL_BLEND_COLOR
84 } blend; 84 } blend;
85 85
86 GLenum logic_op; // GL_LOGIC_OP_MODE 86 struct {
87 bool enabled; // GL_LOGIC_OP_MODE
88 GLenum operation;
89 } logic_op;
87 90
88 // 3 texture units - one for each that is used in PICA fragment shader emulation 91 // 3 texture units - one for each that is used in PICA fragment shader emulation
89 struct TextureUnit { 92 struct TextureUnit {