diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-11-21 12:54:15 -0800 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-11-27 11:29:21 -0800 |
commit | 10a789b1187cacd232435e336f73963fa37bcdf6 (patch) | |
tree | dbc3088b75ef5270e5c4cc6d0af837c21400a82a /retrace | |
parent | f78f0f7aab22b24f1b368336df10433680d1a31d (diff) |
State: Enable glDepthFunc
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/daemon/gldispatch/glframe_glhelper.cpp | 9 | ||||
-rw-r--r-- | retrace/daemon/gldispatch/glframe_glhelper.hpp | 1 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_enums.cpp | 127 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_override.cpp | 14 |
4 files changed, 91 insertions, 60 deletions
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.cpp b/retrace/daemon/gldispatch/glframe_glhelper.cpp index b4869676..bb419018 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.cpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.cpp @@ -124,6 +124,7 @@ static void *pCullFace = NULL; static void *pLineWidth = NULL; static void *pColorMask = NULL; static void *pClearDepthf = NULL; +static void *pDepthFunc = NULL; } // namespace @@ -342,6 +343,8 @@ GlFunctions::Init(void *lookup_fn) { assert(pColorMask);; pClearDepthf = _GetProcAddress("glClearDepthf"); assert(pClearDepthf); + pDepthFunc = _GetProcAddress("glDepthFunc"); + assert(pDepthFunc); } GLuint @@ -990,3 +993,9 @@ GlFunctions::ClearDepthf(GLfloat d) { typedef void (*CLEARDEPTHF)(GLfloat d); return ((CLEARDEPTHF)pClearDepthf)(d); } + +void +GlFunctions::DepthFunc(GLenum func) { + typedef void (*DEPTHFUNC)(GLenum func); + return ((DEPTHFUNC)pDepthFunc)(func); +} diff --git a/retrace/daemon/gldispatch/glframe_glhelper.hpp b/retrace/daemon/gldispatch/glframe_glhelper.hpp index 06bedea2..e5904610 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.hpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.hpp @@ -180,6 +180,7 @@ class GlFunctions { static void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); static void ClearDepthf(GLfloat d); + static void DepthFunc(GLenum func); private: GlFunctions(); diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp index 810d3071..f7295062 100644 --- a/retrace/daemon/glframe_state_enums.cpp +++ b/retrace/daemon/glframe_state_enums.cpp @@ -37,6 +37,7 @@ uint32_t glretrace::state_name_to_enum(const std::string &value) { static const std::map<std::string, uint32_t> names { + {"GL_ALWAYS", GL_ALWAYS}, {"GL_BACK", GL_BACK}, {"GL_BLEND", GL_BLEND}, {"GL_BLEND_COLOR", GL_BLEND_COLOR}, @@ -55,17 +56,25 @@ glretrace::state_name_to_enum(const std::string &value) { {"GL_CULL_FACE", GL_CULL_FACE}, {"GL_CULL_FACE_MODE", GL_CULL_FACE_MODE}, {"GL_DEPTH_CLEAR_VALUE", GL_DEPTH_CLEAR_VALUE}, + {"GL_DEPTH_FUNC", GL_DEPTH_FUNC}, {"GL_DST_ALPHA", GL_DST_ALPHA}, {"GL_DST_COLOR", GL_DST_COLOR}, + {"GL_EQUAL", GL_EQUAL}, {"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_GEQUAL", GL_GEQUAL}, + {"GL_GREATER", GL_GREATER}, + {"GL_LEQUAL", GL_LEQUAL}, + {"GL_LESS", GL_LESS}, {"GL_LINE_SMOOTH", GL_LINE_SMOOTH}, {"GL_LINE_WIDTH", GL_LINE_WIDTH}, {"GL_MAX", GL_MAX}, {"GL_MIN", GL_MIN}, + {"GL_NEVER", GL_NEVER}, + {"GL_NOTEQUAL", GL_NOTEQUAL}, {"GL_ONE", GL_ONE}, {"GL_ONE_MINUS_CONSTANT_ALPHA", GL_ONE_MINUS_CONSTANT_ALPHA}, {"GL_ONE_MINUS_CONSTANT_COLOR", GL_ONE_MINUS_CONSTANT_COLOR}, @@ -89,66 +98,63 @@ glretrace::state_name_to_enum(const std::string &value) { std::string glretrace::state_enum_to_name(GLint value) { - switch (value) { - case GL_BACK: - return std::string("GL_BACK"); - case GL_BLEND: - return std::string("GL_BLEND"); - case GL_BLEND_DST: - return std::string("GL_BLEND_DST"); - case GL_BLEND_SRC: - return std::string("GL_BLEND_SRC"); - case GL_CONSTANT_ALPHA: - return std::string("GL_CONSTANT_ALPHA"); - case GL_CONSTANT_COLOR: - return std::string("GL_CONSTANT_COLOR"); - case GL_CULL_FACE: - return std::string("CULL_FACE"); - case GL_CULL_FACE_MODE: - return std::string("CULL_FACE_MODE"); - case GL_DST_ALPHA: - return std::string("GL_DST_ALPHA"); - case GL_DST_COLOR: - return std::string("GL_DST_COLOR"); - case GL_FRONT: - return std::string("GL_FRONT"); - case GL_FRONT_AND_BACK: - return std::string("GL_FRONT_AND_BACK"); - case GL_FUNC_ADD: - return std::string("GL_FUNC_ADD"); - case GL_FUNC_REVERSE_SUBTRACT: - return std::string("GL_FUNC_REVERSE_SUBTRACT"); - case GL_FUNC_SUBTRACT: - return std::string("GL_FUNC_SUBTRACT"); - case GL_MAX: - return std::string("GL_MAX"); - case GL_MIN: - return std::string("GL_MIN"); - case GL_ONE: - return std::string("GL_ONE"); - case GL_ONE_MINUS_CONSTANT_ALPHA: - return std::string("GL_ONE_MINUS_CONSTANT_ALPHA"); - case GL_ONE_MINUS_CONSTANT_COLOR: - return std::string("GL_ONE_MINUS_CONSTANT_COLOR"); - case GL_ONE_MINUS_DST_ALPHA: - return std::string("GL_ONE_MINUS_DST_ALPHA"); - case GL_ONE_MINUS_DST_COLOR: - return std::string("GL_ONE_MINUS_DST_COLOR"); - case GL_ONE_MINUS_SRC_ALPHA: - return std::string("GL_ONE_MINUS_SRC_ALPHA"); - case GL_ONE_MINUS_SRC_COLOR: - return std::string("GL_ONE_MINUS_SRC_COLOR"); - case GL_SRC_ALPHA: - return std::string("GL_SRC_ALPHA"); - case GL_SRC_ALPHA_SATURATE: - return std::string("GL_SRC_ALPHA_SATURATE"); - case GL_SRC_COLOR: - return std::string("GL_SRC_COLOR"); - case GL_ZERO: - return std::string("GL_ZERO"); - default: - assert(false); + static const std::map<uint32_t, std::string> names { + {GL_ALWAYS, "GL_ALWAYS"}, + {GL_BACK, "GL_BACK"}, + {GL_BLEND, "GL_BLEND"}, + {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_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_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE"}, + {GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK"}, + {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_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE"}, + {GL_DEPTH_FUNC, "GL_DEPTH_FUNC"}, + {GL_DST_ALPHA, "GL_DST_ALPHA"}, + {GL_DST_COLOR, "GL_DST_COLOR"}, + {GL_EQUAL, "GL_EQUAL"}, + {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_GEQUAL, "GL_GEQUAL"}, + {GL_GREATER, "GL_GREATER"}, + {GL_LEQUAL, "GL_LEQUAL"}, + {GL_LESS, "GL_LESS"}, + {GL_LINE_SMOOTH, "GL_LINE_SMOOTH"}, + {GL_LINE_WIDTH, "GL_LINE_WIDTH"}, + {GL_MAX, "GL_MAX"}, + {GL_MIN, "GL_MIN"}, + {GL_NEVER, "GL_NEVER"}, + {GL_NOTEQUAL, "GL_NOTEQUAL"}, + {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_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_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_SRC_COLOR, "GL_SRC_COLOR"}, + {GL_ZERO, "GL_ZERO"}, + }; + const auto i = names.find(value); + if (i == names.end()) { + assert(false); + return "GL_INVALID_ENUM"; } + return i->second; } std::vector<std::string> @@ -191,6 +197,9 @@ 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_DEPTH_FUNC: + return {"GL_NEVER", "GL_LESS", "GL_EQUAL", "GL_LEQUAL", + "GL_GREATER", "GL_NOTEQUAL", "GL_GEQUAL", "GL_ALWAYS"}; case GL_INVALID_ENUM: assert(false); default: diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index 3c2854a0..f2ff624d 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -122,6 +122,7 @@ StateOverride::interpret_value(const StateKey &item, case GL_CULL_FACE: case GL_CULL_FACE_MODE: case GL_LINE_SMOOTH: + case GL_DEPTH_FUNC: return state_name_to_enum(value); // float values @@ -162,7 +163,8 @@ StateOverride::getState(const StateKey &item, case GL_BLEND_SRC: case GL_BLEND_SRC_ALPHA: case GL_BLEND_SRC_RGB: - case GL_CULL_FACE_MODE: { + case GL_CULL_FACE_MODE: + case GL_DEPTH_FUNC: { data->resize(1); get_integer_state(n, data); break; @@ -336,6 +338,10 @@ StateOverride::enact_state(const KeyMap &m) const { GlFunctions::ClearDepthf(u.f); break; } + case GL_DEPTH_FUNC: { + GlFunctions::DepthFunc(i.second[0]); + break; + } case GL_LINE_WIDTH: { assert(i.second.size() == 1); IntFloat u; @@ -504,4 +510,10 @@ StateOverride::onState(SelectionId selId, floatString(data[0], &value); callback->onState(selId, experimentCount, renderId, k, {value}); } + { + StateKey k("Rendering", "Depth State", "GL_DEPTH_FUNC"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {state_enum_to_name(data[0])}); + } } |