summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorMark Janes <mark.a.janes@intel.com>2017-11-28 14:57:08 -0800
committerMark Janes <mark.a.janes@intel.com>2017-11-28 14:57:08 -0800
commitaa1d25a4cb69db0befc0333c81774ced5f8aff04 (patch)
tree019622857a25f6bd80ccfbf71046f6836de03b74 /retrace
parent79dfff5a7b7e8d54ae8c1af6688c18a12f123ace (diff)
State: Enable glPolygonOffset
Diffstat (limited to 'retrace')
-rw-r--r--retrace/daemon/gldispatch/glframe_glhelper.cpp9
-rw-r--r--retrace/daemon/gldispatch/glframe_glhelper.hpp1
-rw-r--r--retrace/daemon/glframe_state_enums.cpp8
-rw-r--r--retrace/daemon/glframe_state_override.cpp50
4 files changed, 64 insertions, 4 deletions
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.cpp b/retrace/daemon/gldispatch/glframe_glhelper.cpp
index 540a1a98..3b281bbb 100644
--- a/retrace/daemon/gldispatch/glframe_glhelper.cpp
+++ b/retrace/daemon/gldispatch/glframe_glhelper.cpp
@@ -128,6 +128,7 @@ static void *pDepthFunc = NULL;
static void *pDepthRangef = NULL;
static void *pDepthMask = NULL;
static void *pFrontFace = NULL;
+static void *pPolygonOffset = NULL;
} // namespace
@@ -354,6 +355,8 @@ GlFunctions::Init(void *lookup_fn) {
assert(pDepthMask);
pFrontFace = _GetProcAddress("glFrontFace");
assert(pFrontFace);
+ pPolygonOffset = _GetProcAddress("glPolygonOffset");
+ assert(pPolygonOffset);
}
GLuint
@@ -1026,3 +1029,9 @@ GlFunctions::FrontFace(GLenum mode) {
typedef void (*FRONTFACE)(GLenum mode);
return ((FRONTFACE)pFrontFace)(mode);
}
+
+void
+GlFunctions::PolygonOffset(GLfloat factor, GLfloat units) {
+ typedef void (*POLYGONOFFSET)(GLfloat factor, GLfloat units);
+ return ((POLYGONOFFSET)pPolygonOffset)(factor, units);
+}
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.hpp b/retrace/daemon/gldispatch/glframe_glhelper.hpp
index 4d443e5d..8c58c8a9 100644
--- a/retrace/daemon/gldispatch/glframe_glhelper.hpp
+++ b/retrace/daemon/gldispatch/glframe_glhelper.hpp
@@ -184,6 +184,7 @@ class GlFunctions {
static void DepthRangef(GLfloat n, GLfloat f);
static void DepthMask(GLboolean flag);
static void FrontFace(GLenum mode);
+ static void PolygonOffset(GLfloat factor, GLfloat units);
private:
GlFunctions();
diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp
index baaa31c4..eea0a0ec 100644
--- a/retrace/daemon/glframe_state_enums.cpp
+++ b/retrace/daemon/glframe_state_enums.cpp
@@ -89,6 +89,9 @@ glretrace::state_name_to_enum(const std::string &value) {
{"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_POLYGON_OFFSET_FACTOR", GL_POLYGON_OFFSET_FACTOR},
+ {"GL_POLYGON_OFFSET_FILL", GL_POLYGON_OFFSET_FILL},
+ {"GL_POLYGON_OFFSET_UNITS", GL_POLYGON_OFFSET_UNITS},
{"GL_SRC_ALPHA", GL_SRC_ALPHA},
{"GL_SRC_ALPHA_SATURATE", GL_SRC_ALPHA_SATURATE},
{"GL_SRC_COLOR", GL_SRC_COLOR},
@@ -158,6 +161,9 @@ glretrace::state_enum_to_name(GLint value) {
{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_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR"},
+ {GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL"},
+ {GL_POLYGON_OFFSET_UNITS, "GL_POLYGON_OFFSET_UNITS"},
{GL_SRC_ALPHA, "GL_SRC_ALPHA"},
{GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE"},
{GL_SRC_COLOR, "GL_SRC_COLOR"},
@@ -181,6 +187,7 @@ glretrace::state_name_to_choices(const std::string &n) {
case GL_DEPTH_WRITEMASK:
case GL_DITHER:
case GL_LINE_SMOOTH:
+ case GL_POLYGON_OFFSET_FILL:
return {"true", "false"};
case GL_BLEND_DST:
case GL_BLEND_DST_ALPHA:
@@ -242,6 +249,7 @@ glretrace::state_name_to_indices(const std::string &n) {
case GL_DEPTH_WRITEMASK:
case GL_DITHER:
case GL_LINE_SMOOTH:
+ case GL_POLYGON_OFFSET_FILL:
return {"Enabled"};
default:
return {};
diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp
index e45cb48e..e6b0e880 100644
--- a/retrace/daemon/glframe_state_override.cpp
+++ b/retrace/daemon/glframe_state_override.cpp
@@ -109,6 +109,7 @@ StateOverride::interpret_value(const StateKey &item,
case GL_DEPTH_WRITEMASK:
case GL_DITHER:
case GL_FRONT_FACE:
+ case GL_POLYGON_OFFSET_FILL:
return state_name_to_enum(value);
// float values
@@ -116,7 +117,9 @@ StateOverride::interpret_value(const StateKey &item,
case GL_COLOR_CLEAR_VALUE:
case GL_DEPTH_CLEAR_VALUE:
case GL_DEPTH_RANGE:
- case GL_LINE_WIDTH: {
+ case GL_LINE_WIDTH:
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS: {
IntFloat i_f;
i_f.f = std::stof(value);
return i_f.i;
@@ -139,7 +142,8 @@ StateOverride::getState(const StateKey &item,
case GL_CULL_FACE:
case GL_DEPTH_TEST:
case GL_DITHER:
- case GL_LINE_SMOOTH: {
+ case GL_LINE_SMOOTH:
+ case GL_POLYGON_OFFSET_FILL: {
data->resize(1);
get_enabled_state(n, data);
break;
@@ -171,7 +175,9 @@ StateOverride::getState(const StateKey &item,
get_float_state(n, data);
break;
case GL_DEPTH_CLEAR_VALUE:
- case GL_LINE_WIDTH: {
+ case GL_LINE_WIDTH:
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS: {
data->resize(1);
get_float_state(n, data);
break;
@@ -253,7 +259,8 @@ StateOverride::enact_state(const KeyMap &m) const {
case GL_CULL_FACE:
case GL_DEPTH_TEST:
case GL_DITHER:
- case GL_LINE_SMOOTH: {
+ case GL_LINE_SMOOTH:
+ case GL_POLYGON_OFFSET_FILL: {
enact_enabled_state(n, i.second[0]);
break;
}
@@ -367,6 +374,19 @@ StateOverride::enact_state(const KeyMap &m) const {
assert(GL::GetError() == GL_NO_ERROR);
break;
}
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS: {
+ GLfloat factor, units;
+ GlFunctions::GetFloatv(GL_POLYGON_OFFSET_FACTOR, &factor);
+ GlFunctions::GetFloatv(GL_POLYGON_OFFSET_UNITS, &units);
+ IntFloat convert;
+ convert.i = i.second[0];
+ GlFunctions::PolygonOffset(
+ n == GL_POLYGON_OFFSET_FACTOR ? convert.f : factor,
+ n == GL_POLYGON_OFFSET_UNITS ? convert.f : units);
+ assert(GL::GetError() == GL_NO_ERROR);
+ break;
+ }
case GL_INVALID_ENUM:
default:
assert(false);
@@ -549,4 +569,26 @@ StateOverride::onState(SelectionId selId,
callback->onState(selId, experimentCount, renderId,
k, {state_enum_to_name(data[0])});
}
+ {
+ StateKey k("Primitive/Polygon", "GL_POLYGON_OFFSET_FACTOR");
+ getState(k, &data);
+ std::string value;
+ floatString(data[0], &value);
+ callback->onState(selId, experimentCount, renderId,
+ k, {value});
+ }
+ {
+ StateKey k("Primitive/Polygon", "GL_POLYGON_OFFSET_FILL");
+ getState(k, &data);
+ callback->onState(selId, experimentCount, renderId,
+ k, {data[0] ? "true" : "false"});
+ }
+ {
+ StateKey k("Primitive/Polygon", "GL_POLYGON_OFFSET_UNITS");
+ getState(k, &data);
+ std::string value;
+ floatString(data[0], &value);
+ callback->onState(selId, experimentCount, renderId,
+ k, {value});
+ }
}