From d868d3e991dd66cfe80120f1917409eee6d60c10 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Tue, 21 Nov 2017 12:23:31 -0800 Subject: State: Enable glClearDepthf --- retrace/daemon/gldispatch/glframe_glhelper.cpp | 11 +++++++++++ retrace/daemon/gldispatch/glframe_glhelper.hpp | 1 + retrace/daemon/glframe_state_enums.cpp | 1 + retrace/daemon/glframe_state_override.cpp | 15 +++++++++++++++ 4 files changed, 28 insertions(+) (limited to 'retrace') diff --git a/retrace/daemon/gldispatch/glframe_glhelper.cpp b/retrace/daemon/gldispatch/glframe_glhelper.cpp index a326aebb..b4869676 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.cpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.cpp @@ -123,6 +123,8 @@ static void *pFinish = NULL; static void *pCullFace = NULL; static void *pLineWidth = NULL; static void *pColorMask = NULL; +static void *pClearDepthf = NULL; + } // namespace static void * _GetProcAddress(const char *name) { @@ -338,6 +340,8 @@ GlFunctions::Init(void *lookup_fn) { assert(pLineWidth); pColorMask = _GetProcAddress("glColorMask"); assert(pColorMask);; + pClearDepthf = _GetProcAddress("glClearDepthf"); + assert(pClearDepthf); } GLuint @@ -979,3 +983,10 @@ GlFunctions::ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); return ((COLORMASK)pColorMask)(red, green, blue, alpha); } + + +void +GlFunctions::ClearDepthf(GLfloat d) { + typedef void (*CLEARDEPTHF)(GLfloat d); + return ((CLEARDEPTHF)pClearDepthf)(d); +} diff --git a/retrace/daemon/gldispatch/glframe_glhelper.hpp b/retrace/daemon/gldispatch/glframe_glhelper.hpp index 7383c7a9..06bedea2 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.hpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.hpp @@ -179,6 +179,7 @@ class GlFunctions { static void LineWidth(GLfloat width); static void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + static void ClearDepthf(GLfloat d); private: GlFunctions(); diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp index e070a637..d1aef2db 100644 --- a/retrace/daemon/glframe_state_enums.cpp +++ b/retrace/daemon/glframe_state_enums.cpp @@ -54,6 +54,7 @@ glretrace::state_name_to_enum(const std::string &value) { {"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_DST_ALPHA", GL_DST_ALPHA}, {"GL_DST_COLOR", GL_DST_COLOR}, {"GL_FRONT", GL_FRONT}, diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index 01e8bbad..219c70aa 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -126,6 +126,7 @@ StateOverride::interpret_value(const StateKey &item, // float values case GL_BLEND_COLOR: + case GL_DEPTH_CLEAR_VALUE: case GL_COLOR_CLEAR_VALUE: case GL_LINE_WIDTH: { IntFloat i_f; @@ -176,6 +177,7 @@ StateOverride::getState(const StateKey &item, data->resize(4); get_float_state(n, data); break; + case GL_DEPTH_CLEAR_VALUE: case GL_LINE_WIDTH: { data->resize(1); get_float_state(n, data); @@ -329,6 +331,12 @@ StateOverride::enact_state(const KeyMap &m) const { i.second[3]); break; } + case GL_DEPTH_CLEAR_VALUE: { + IntFloat u; + u.i = i.second[0]; + GlFunctions::ClearDepthf(u.f); + break; + } case GL_LINE_WIDTH: { assert(i.second.size() == 1); IntFloat u; @@ -486,4 +494,11 @@ StateOverride::onState(SelectionId selId, {data[3] ? "true" : "false"}); } } + { + StateKey k("Rendering", "Depth State", "GL_DEPTH_CLEAR_VALUE"); + getState(k, &data); + std::string value; + floatString(data[0], &value); + callback->onState(selId, experimentCount, renderId, k, {value}); + } } -- cgit v1.2.3