summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-08-21 01:43:11 +0200
committerSubv <subv2112@gmail.com>2018-08-21 01:43:11 +0200
commitf24ab6d9e6c34c6e8946657d71e7b70c3c06e05a (patch)
tree60a6bda0a1a6335ba22ea5d6e3306358d74676c5 /src/video_core
parentGPU: Added registers for the logicop functionality. (diff)
downloadyuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.gz
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.bz2
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.lz
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.xz
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.tar.zst
yuzu-f24ab6d9e6c34c6e8946657d71e7b70c3c06e05a.zip
Diffstat (limited to 'src/video_core')
-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() {
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
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:
} color; // GL_BLEND_COLOR
} blend;
- GLenum logic_op; // GL_LOGIC_OP_MODE
+ struct {
+ bool enabled; // GL_LOGIC_OP_MODE
+ GLenum operation;
+ } logic_op;
// 3 texture units - one for each that is used in PICA fragment shader emulation
struct TextureUnit {