diff options
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 | 5 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_override.cpp | 61 |
4 files changed, 65 insertions, 11 deletions
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.cpp b/retrace/daemon/gldispatch/glframe_glhelper.cpp index 3b281bbb..028d2ad6 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.cpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.cpp @@ -129,6 +129,7 @@ static void *pDepthRangef = NULL; static void *pDepthMask = NULL; static void *pFrontFace = NULL; static void *pPolygonOffset = NULL; +static void *pSampleCoverage = NULL; } // namespace @@ -357,6 +358,8 @@ GlFunctions::Init(void *lookup_fn) { assert(pFrontFace); pPolygonOffset = _GetProcAddress("glPolygonOffset"); assert(pPolygonOffset); + pSampleCoverage = _GetProcAddress("glSampleCoverage"); + assert(pSampleCoverage); } GLuint @@ -1035,3 +1038,9 @@ GlFunctions::PolygonOffset(GLfloat factor, GLfloat units) { typedef void (*POLYGONOFFSET)(GLfloat factor, GLfloat units); return ((POLYGONOFFSET)pPolygonOffset)(factor, units); } + +void +GlFunctions::SampleCoverage(GLfloat value, GLboolean invert) { + typedef void (*SAMPLECOVERAGE)(GLfloat value, GLboolean invert); + return ((SAMPLECOVERAGE)pSampleCoverage)(value, invert); +} diff --git a/retrace/daemon/gldispatch/glframe_glhelper.hpp b/retrace/daemon/gldispatch/glframe_glhelper.hpp index 8c58c8a9..d2614762 100644 --- a/retrace/daemon/gldispatch/glframe_glhelper.hpp +++ b/retrace/daemon/gldispatch/glframe_glhelper.hpp @@ -185,6 +185,7 @@ class GlFunctions { static void DepthMask(GLboolean flag); static void FrontFace(GLenum mode); static void PolygonOffset(GLfloat factor, GLfloat units); + static void SampleCoverage(GLfloat value, GLboolean invert); private: GlFunctions(); diff --git a/retrace/daemon/glframe_state_enums.cpp b/retrace/daemon/glframe_state_enums.cpp index eea0a0ec..53b1ed91 100644 --- a/retrace/daemon/glframe_state_enums.cpp +++ b/retrace/daemon/glframe_state_enums.cpp @@ -92,6 +92,8 @@ glretrace::state_name_to_enum(const std::string &value) { {"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_SAMPLE_COVERAGE_INVERT", GL_SAMPLE_COVERAGE_INVERT}, + {"GL_SAMPLE_COVERAGE_VALUE", GL_SAMPLE_COVERAGE_VALUE}, {"GL_SRC_ALPHA", GL_SRC_ALPHA}, {"GL_SRC_ALPHA_SATURATE", GL_SRC_ALPHA_SATURATE}, {"GL_SRC_COLOR", GL_SRC_COLOR}, @@ -164,6 +166,8 @@ glretrace::state_enum_to_name(GLint value) { {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_SAMPLE_COVERAGE_INVERT, "GL_SAMPLE_COVERAGE_INVERT"}, + {GL_SAMPLE_COVERAGE_VALUE, "GL_SAMPLE_COVERAGE_VALUE"}, {GL_SRC_ALPHA, "GL_SRC_ALPHA"}, {GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE"}, {GL_SRC_COLOR, "GL_SRC_COLOR"}, @@ -188,6 +192,7 @@ glretrace::state_name_to_choices(const std::string &n) { case GL_DITHER: case GL_LINE_SMOOTH: case GL_POLYGON_OFFSET_FILL: + case GL_SAMPLE_COVERAGE_INVERT: return {"true", "false"}; case GL_BLEND_DST: case GL_BLEND_DST_ALPHA: diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index e6b0e880..fee29d67 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -110,6 +110,7 @@ StateOverride::interpret_value(const StateKey &item, case GL_DITHER: case GL_FRONT_FACE: case GL_POLYGON_OFFSET_FILL: + case GL_SAMPLE_COVERAGE_INVERT: return state_name_to_enum(value); // float values @@ -119,7 +120,9 @@ StateOverride::interpret_value(const StateKey &item, case GL_DEPTH_RANGE: case GL_LINE_WIDTH: case GL_POLYGON_OFFSET_FACTOR: - case GL_POLYGON_OFFSET_UNITS: { + case GL_POLYGON_OFFSET_UNITS: + case GL_SAMPLE_COVERAGE_VALUE: + { IntFloat i_f; i_f.f = std::stof(value); return i_f.i; @@ -164,11 +167,18 @@ StateOverride::getState(const StateKey &item, break; } case GL_COLOR_WRITEMASK: - case GL_DEPTH_WRITEMASK: { - data->resize(4); - get_bool_state(n, data); - break; - } + { + data->resize(4); + get_bool_state(n, data); + break; + } + case GL_DEPTH_WRITEMASK: + case GL_SAMPLE_COVERAGE_INVERT: + { + data->resize(1); + get_bool_state(n, data); + break; + } case GL_BLEND_COLOR: case GL_COLOR_CLEAR_VALUE: data->resize(4); @@ -177,11 +187,13 @@ StateOverride::getState(const StateKey &item, case GL_DEPTH_CLEAR_VALUE: case GL_LINE_WIDTH: case GL_POLYGON_OFFSET_FACTOR: - case GL_POLYGON_OFFSET_UNITS: { - data->resize(1); - get_float_state(n, data); - break; - } + case GL_POLYGON_OFFSET_UNITS: + case GL_SAMPLE_COVERAGE_VALUE: + { + data->resize(1); + get_float_state(n, data); + break; + } case GL_DEPTH_RANGE: { data->resize(2); get_float_state(n, data); @@ -387,6 +399,19 @@ StateOverride::enact_state(const KeyMap &m) const { assert(GL::GetError() == GL_NO_ERROR); break; } + case GL_SAMPLE_COVERAGE_INVERT: + case GL_SAMPLE_COVERAGE_VALUE: { + GLfloat value; + GLboolean invert; + GlFunctions::GetFloatv(GL_SAMPLE_COVERAGE_VALUE, &value); + GlFunctions::GetBooleanv(GL_SAMPLE_COVERAGE_INVERT, &invert); + IntFloat convert; + convert.i = i.second[0]; + GlFunctions::SampleCoverage( + n == GL_SAMPLE_COVERAGE_VALUE ? convert.f : value, + n == GL_SAMPLE_COVERAGE_INVERT ? i.second[0] : invert); + break; + } case GL_INVALID_ENUM: default: assert(false); @@ -591,4 +616,18 @@ StateOverride::onState(SelectionId selId, callback->onState(selId, experimentCount, renderId, k, {value}); } + { + StateKey k("Fragment/Multisample", "GL_SAMPLE_COVERAGE_VALUE"); + getState(k, &data); + std::string value; + floatString(data[0], &value); + callback->onState(selId, experimentCount, renderId, + k, {value}); + } + { + StateKey k("Fragment/Multisample", "GL_SAMPLE_COVERAGE_INVERT"); + getState(k, &data); + callback->onState(selId, experimentCount, renderId, + k, {data[0] ? "true" : "false"}); + } } |