diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-11-01 18:26:33 -0700 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-11-27 11:29:21 -0800 |
commit | fb8ca898d8d47012d46a278c5d39e3010590af1e (patch) | |
tree | 95e9c2c91ec3a6c9a02aabad762ff6a501dc08c6 /retrace | |
parent | 5e78e8fbb214f20c9b75f1d759a4b52cadc36c36 (diff) |
state: Enable glBlendEquationSeparate
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/daemon/glframe_state_enums.cpp | 67 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_override.cpp | 42 |
2 files changed, 78 insertions, 31 deletions
diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp index ec4d184c..32d50706 100644 --- a/retrace/daemon/glframe_state_enums.cpp +++ b/retrace/daemon/glframe_state_enums.cpp @@ -37,36 +37,43 @@ uint32_t glretrace::state_name_to_enum(const std::string &value) { static const std::map<std::string, uint32_t> names { - {"GL_CULL_FACE", GL_CULL_FACE}, - {"GL_CULL_FACE_MODE", GL_CULL_FACE_MODE}, - {"GL_FRONT", GL_FRONT}, {"GL_BACK", GL_BACK}, - {"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_COLOR", GL_BLEND_COLOR}, {"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}, - {"GL_ONE_MINUS_SRC_COLOR", GL_ONE_MINUS_SRC_COLOR}, + {"GL_BLEND_EQUATION_ALPHA", GL_BLEND_EQUATION_ALPHA}, + {"GL_BLEND_EQUATION_RGB", GL_BLEND_EQUATION_RGB}, + {"GL_BLEND_SRC", GL_BLEND_SRC}, + {"GL_BLEND_SRC_ALPHA", GL_BLEND_SRC_ALPHA}, + {"GL_BLEND_SRC_RGB", GL_BLEND_SRC_RGB}, + {"GL_CONSTANT_ALPHA", GL_CONSTANT_ALPHA}, + {"GL_CONSTANT_COLOR", GL_CONSTANT_COLOR}, + {"GL_CULL_FACE", GL_CULL_FACE}, + {"GL_CULL_FACE_MODE", GL_CULL_FACE_MODE}, + {"GL_DST_ALPHA", GL_DST_ALPHA}, {"GL_DST_COLOR", GL_DST_COLOR}, + {"GL_FRONT", GL_FRONT}, + {"GL_FRONT_AND_BACK", GL_FRONT_AND_BACK}, + {"GL_FUNC_ADD", GL_FUNC_ADD}, + {"GL_FUNC_REVERSE_SUBTRACT", GL_FUNC_REVERSE_SUBTRACT}, + {"GL_FUNC_SUBTRACT", GL_FUNC_SUBTRACT}, + {"GL_LINE_SMOOTH", GL_LINE_SMOOTH}, + {"GL_LINE_WIDTH", GL_LINE_WIDTH}, + {"GL_MAX", GL_MAX}, + {"GL_MIN", GL_MIN}, + {"GL_ONE", GL_ONE}, + {"GL_ONE_MINUS_CONSTANT_ALPHA", GL_ONE_MINUS_CONSTANT_ALPHA}, + {"GL_ONE_MINUS_CONSTANT_COLOR", GL_ONE_MINUS_CONSTANT_COLOR}, + {"GL_ONE_MINUS_DST_ALPHA", GL_ONE_MINUS_DST_ALPHA}, {"GL_ONE_MINUS_DST_COLOR", GL_ONE_MINUS_DST_COLOR}, - {"GL_SRC_ALPHA", GL_SRC_ALPHA}, {"GL_ONE_MINUS_SRC_ALPHA", GL_ONE_MINUS_SRC_ALPHA}, - {"GL_DST_ALPHA", GL_DST_ALPHA}, - {"GL_ONE_MINUS_DST_ALPHA", GL_ONE_MINUS_DST_ALPHA}, - {"GL_CONSTANT_COLOR", GL_CONSTANT_COLOR}, - {"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_ONE_MINUS_SRC_COLOR", GL_ONE_MINUS_SRC_COLOR}, + {"GL_SRC_ALPHA", GL_SRC_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}, + {"GL_SRC_COLOR", GL_SRC_COLOR}, + {"GL_ZERO", GL_ZERO}, {"true", 1}, {"false", 0} }; @@ -126,6 +133,16 @@ glretrace::state_enum_to_name(GLint value) { return std::string("GL_ONE_MINUS_CONSTANT_ALPHA"); case GL_SRC_ALPHA_SATURATE: return std::string("GL_SRC_ALPHA_SATURATE"); + case GL_FUNC_ADD: + return std::string("GL_FUNC_ADD"); + case GL_FUNC_SUBTRACT: + return std::string("GL_FUNC_SUBTRACT"); + case GL_FUNC_REVERSE_SUBTRACT: + return std::string("GL_FUNC_REVERSE_SUBTRACT"); + case GL_MIN: + return std::string("GL_MIN"); + case GL_MAX: + return std::string("GL_MAX"); default: assert(false); } @@ -162,6 +179,14 @@ glretrace::state_name_to_choices(const std::string &n) { "GL_ONE_MINUS_CONSTANT_ALPHA", "GL_SRC_ALPHA_SATURATE" }; + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_EQUATION_ALPHA: + return {"GL_FUNC_ADD", + "GL_FUNC_SUBTRACT", + "GL_FUNC_REVERSE_SUBTRACT", + "GL_MIN", + "GL_MAX" + }; case GL_INVALID_ENUM: assert(false); default: diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index ccc4b94a..0af7f4d6 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -74,26 +74,25 @@ StateOverride::getState(const StateKey &item, std::vector<uint32_t> *data) { const auto n = state_name_to_enum(item.name); switch (n) { + case GL_BLEND: case GL_CULL_FACE: - case GL_LINE_SMOOTH: - case GL_BLEND: { + case GL_LINE_SMOOTH: { get_enabled_state(n, data); break; } - case GL_CULL_FACE_MODE: + case GL_BLEND_DST: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: + case GL_BLEND_EQUATION_ALPHA: + case GL_BLEND_EQUATION_RGB: 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: { + case GL_CULL_FACE_MODE: { get_integer_state(n, data); break; } - case GL_BLEND_COLOR: { - get_float_state(n, data); - break; - } + case GL_BLEND_COLOR: case GL_LINE_WIDTH: { get_float_state(n, data); break; @@ -168,6 +167,17 @@ StateOverride::enact_state(const KeyMap &m) const { assert(GL::GetError() == GL_NO_ERROR); break; } + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_EQUATION_ALPHA: { + GLint modeRGB, modeAlpha; + GlFunctions::GetIntegerv(GL_BLEND_EQUATION_RGB, &modeRGB); + GlFunctions::GetIntegerv(GL_BLEND_EQUATION_ALPHA, &modeAlpha); + GlFunctions::BlendEquationSeparate( + n == GL_BLEND_EQUATION_RGB ? i.second[0] : modeRGB, + n == GL_BLEND_EQUATION_ALPHA ? i.second[0] : modeAlpha); + assert(GL::GetError() == GL_NO_ERROR); + break; + } case GL_BLEND_SRC: case GL_BLEND_DST: { GLint src, dst; @@ -321,4 +331,16 @@ StateOverride::onState(SelectionId selId, callback->onState(selId, experimentCount, renderId, k, {data[0] ? "true" : "false"}); } + { + StateKey k("Rendering", "Blend State", "GL_BLEND_EQUATION_RGB"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } + { + StateKey k("Rendering", "Blend State", "GL_BLEND_EQUATION_ALPHA"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } } |