diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-10-31 16:10:01 -0700 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-11-27 11:29:20 -0800 |
commit | f016abdf61cd3ba6c8efd00afc28db65fb3c5fee (patch) | |
tree | 6c2171f3f78a20ac983a2cada81bef531548fe2a /retrace | |
parent | 17607c0606276324ee597b3a5303fde51944d495 (diff) |
State: Handle glBlendFuncSeparate states
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/daemon/glframe_state_enums.cpp | 17 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_override.cpp | 47 |
2 files changed, 62 insertions, 2 deletions
diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp index fbae56bc..ec4d184c 100644 --- a/retrace/daemon/glframe_state_enums.cpp +++ b/retrace/daemon/glframe_state_enums.cpp @@ -28,6 +28,8 @@ #include "glframe_state_enums.hpp" #include <assert.h> +#include <GL/glext.h> + #include <map> #include <string> #include <vector> @@ -42,7 +44,11 @@ glretrace::state_name_to_enum(const std::string &value) { {"GL_FRONT_AND_BACK", GL_FRONT_AND_BACK}, {"GL_BLEND", GL_BLEND}, {"GL_BLEND_SRC", GL_BLEND_SRC}, + {"GL_BLEND_SRC_ALPHA", GL_BLEND_SRC_ALPHA}, + {"GL_BLEND_SRC_RGB", GL_BLEND_SRC_RGB}, {"GL_BLEND_DST", GL_BLEND_DST}, + {"GL_BLEND_DST_ALPHA", GL_BLEND_DST_ALPHA}, + {"GL_BLEND_DST_RGB", GL_BLEND_DST_RGB}, {"GL_ZERO", GL_ZERO}, {"GL_ONE", GL_ONE}, {"GL_SRC_COLOR", GL_SRC_COLOR}, @@ -57,6 +63,7 @@ glretrace::state_name_to_enum(const std::string &value) { {"GL_ONE_MINUS_CONSTANT_COLOR", GL_ONE_MINUS_CONSTANT_COLOR}, {"GL_CONSTANT_ALPHA", GL_CONSTANT_ALPHA}, {"GL_ONE_MINUS_CONSTANT_ALPHA", GL_ONE_MINUS_CONSTANT_ALPHA}, + {"GL_SRC_ALPHA_SATURATE", GL_SRC_ALPHA_SATURATE}, {"GL_BLEND_COLOR", GL_BLEND_COLOR}, {"GL_LINE_WIDTH", GL_LINE_WIDTH}, {"GL_LINE_SMOOTH", GL_LINE_SMOOTH}, @@ -117,6 +124,8 @@ glretrace::state_enum_to_name(GLint value) { return std::string("GL_CONSTANT_ALPHA"); case GL_ONE_MINUS_CONSTANT_ALPHA: return std::string("GL_ONE_MINUS_CONSTANT_ALPHA"); + case GL_SRC_ALPHA_SATURATE: + return std::string("GL_SRC_ALPHA_SATURATE"); default: assert(false); } @@ -132,7 +141,11 @@ glretrace::state_name_to_choices(const std::string &n) { case GL_CULL_FACE_MODE: return {"GL_FRONT", "GL_BACK", "GL_FRONT_AND_BACK"}; case GL_BLEND_SRC: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_SRC_RGB: case GL_BLEND_DST: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: return {"GL_ZERO", "GL_ONE", "GL_SRC_COLOR", @@ -146,7 +159,9 @@ glretrace::state_name_to_choices(const std::string &n) { "GL_CONSTANT_COLOR", "GL_ONE_MINUS_CONSTANT_COLOR", "GL_CONSTANT_ALPHA", - "GL_ONE_MINUS_CONSTANT_ALPHA"}; + "GL_ONE_MINUS_CONSTANT_ALPHA", + "GL_SRC_ALPHA_SATURATE" + }; case GL_INVALID_ENUM: assert(false); default: diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index 003c2713..2dfe5077 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -82,7 +82,11 @@ StateOverride::getState(const StateKey &item, } case GL_CULL_FACE_MODE: case GL_BLEND_SRC: - case GL_BLEND_DST: { + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_SRC_RGB: + case GL_BLEND_DST: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: { get_integer_state(n, data); break; } @@ -180,6 +184,23 @@ StateOverride::enact_state(const KeyMap &m) const { assert(GL::GetError() == GL_NO_ERROR); break; } + case GL_BLEND_SRC_RGB: + case GL_BLEND_DST_RGB: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_DST_ALPHA: + { + GLint src_rgb, dst_rgb, src_alpha, dst_alpha; + GlFunctions::GetIntegerv(GL_BLEND_SRC_RGB, &src_rgb); + GlFunctions::GetIntegerv(GL_BLEND_DST_RGB, &dst_rgb); + GlFunctions::GetIntegerv(GL_BLEND_SRC_ALPHA, &src_alpha); + GlFunctions::GetIntegerv(GL_BLEND_DST_ALPHA, &dst_alpha); + GlFunctions::BlendFuncSeparate( + n == GL_BLEND_SRC_RGB ? i.second[0] : src_rgb, + n == GL_BLEND_DST_RGB ? i.second[0] : dst_rgb, + n == GL_BLEND_SRC_ALPHA ? i.second[0] : src_alpha, + n == GL_BLEND_DST_ALPHA ? i.second[0] : dst_alpha); + break; + } case GL_BLEND_COLOR: { std::vector<float> f(4); IntFloat u; @@ -255,12 +276,36 @@ StateOverride::onState(SelectionId selId, k, {state_enum_to_name(data[0])}); } { + StateKey k("Rendering", "Blend State", "GL_BLEND_SRC_ALPHA"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } + { + StateKey k("Rendering", "Blend State", "GL_BLEND_SRC_RGB"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } + { StateKey k("Rendering", "Blend State", "GL_BLEND_DST"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { + StateKey k("Rendering", "Blend State", "GL_BLEND_DST_ALPHA"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } + { + StateKey k("Rendering", "Blend State", "GL_BLEND_DST_RGB"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } + { StateKey k("Rendering", "Blend State", "GL_BLEND_COLOR"); getState(k, &data); std::vector<std::string> color; |