summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Janes <mark.a.janes@intel.com>2017-10-31 16:24:08 -0700
committerMark Janes <mark.a.janes@intel.com>2017-11-27 11:29:21 -0800
commit5e78e8fbb214f20c9b75f1d759a4b52cadc36c36 (patch)
tree3d2418681bd050bf09382f082cab8355ff809a30
parentf016abdf61cd3ba6c8efd00afc28db65fb3c5fee (diff)
state: Refactor glBlendFunc
The implementation of glBlendEquation was clearer and more organized than the initial implementation of glBlendFunc. This commit change glBlendFunc to use the clearer mechanism.
-rw-r--r--retrace/daemon/glframe_state_override.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp
index 2dfe5077..ccc4b94a 100644
--- a/retrace/daemon/glframe_state_override.cpp
+++ b/retrace/daemon/glframe_state_override.cpp
@@ -168,19 +168,15 @@ StateOverride::enact_state(const KeyMap &m) const {
assert(GL::GetError() == GL_NO_ERROR);
break;
}
- case GL_BLEND_SRC: {
- GLint dst;
- GlFunctions::GetIntegerv(GL_BLEND_DST, &dst);
- assert(GL::GetError() == GL_NO_ERROR);
- GlFunctions::BlendFunc(i.second[0], dst);
- assert(GL::GetError() == GL_NO_ERROR);
- break;
- }
+ case GL_BLEND_SRC:
case GL_BLEND_DST: {
- GLint src;
- GlFunctions::GetIntegerv(GL_BLEND_DST, &src);
+ GLint src, dst;
+ GlFunctions::GetIntegerv(GL_BLEND_DST, &dst);
+ GlFunctions::GetIntegerv(GL_BLEND_SRC, &src);
assert(GL::GetError() == GL_NO_ERROR);
- GlFunctions::BlendFunc(src, i.second[0]);
+ GlFunctions::BlendFunc(
+ n == GL_BLEND_SRC ? i.second[0] : src,
+ n == GL_BLEND_DST ? i.second[0] : dst);
assert(GL::GetError() == GL_NO_ERROR);
break;
}