diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-05-08 22:48:43 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-05-10 03:25:25 -0700 |
commit | 898d6e6da517052271a3f9828ee966b56075efe3 (patch) | |
tree | 04abc3bfa36659a8e3c057f33ca1ca30dd3f8d0a /wrappers | |
parent | dddc5b8534d68b5315d9b9aaafd45d8a79e36198 (diff) |
gltrace: Only check primitive restart index if supported.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/gltrace.py | 2 | ||||
-rw-r--r-- | wrappers/gltrace_arrays.cpp | 25 | ||||
-rw-r--r-- | wrappers/gltrace_arrays.hpp | 13 |
3 files changed, 23 insertions, 17 deletions
diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py index 065f7608..fb08436f 100644 --- a/wrappers/gltrace.py +++ b/wrappers/gltrace.py @@ -491,7 +491,7 @@ class GlTracer(Tracer): continue print r' _params.%s = %s;' % (paramsMember, arg.name) - print ' GLuint _count = _glDraw_count(_params);' + print ' GLuint _count = _glDraw_count(_ctx, _params);' # Some apps, in particular Quake3, can tell the driver to lock more # vertices than those actually required for the draw call. print ' if (_checkLockArraysEXT) {' diff --git a/wrappers/gltrace_arrays.cpp b/wrappers/gltrace_arrays.cpp index 8986131d..30d70220 100644 --- a/wrappers/gltrace_arrays.cpp +++ b/wrappers/gltrace_arrays.cpp @@ -25,13 +25,14 @@ #include "gltrace_arrays.hpp" +#include "gltrace.hpp" /* FIXME take in consideration instancing */ GLuint -_glDraw_count(const DrawArraysParams ¶ms) +_glDraw_count(gltrace::Context *ctx, const DrawArraysParams ¶ms) { if (!params.count) { return 0; @@ -41,7 +42,7 @@ _glDraw_count(const DrawArraysParams ¶ms) GLuint -_glDraw_count(const DrawElementsParams ¶ms) +_glDraw_count(gltrace::Context *ctx, const DrawElementsParams ¶ms) { if (params.end < params.start || params.count <= 0) { @@ -82,13 +83,13 @@ _glDraw_count(const DrawElementsParams ¶ms) GLuint maxindex = 0; - GLboolean restart_enabled = _glIsEnabled(GL_PRIMITIVE_RESTART); - while ((_glGetError() == GL_INVALID_ENUM)) - ; - + GLboolean restart_enabled = GL_FALSE; GLuint restart_index = 0; - if (restart_enabled) { - restart_index = (GLuint)_glGetInteger(GL_PRIMITIVE_RESTART_INDEX); + if (ctx->features.primitive_restart) { + _glIsEnabled(GL_PRIMITIVE_RESTART); + if (restart_enabled) { + restart_index = (GLuint)_glGetInteger(GL_PRIMITIVE_RESTART_INDEX); + } } GLsizei i; @@ -140,7 +141,7 @@ _glDraw_count(const DrawElementsParams ¶ms) GLuint -_glDraw_count(const MultiDrawArraysParams ¶ms) +_glDraw_count(gltrace::Context *ctx, const MultiDrawArraysParams ¶ms) { GLuint _count = 0; for (GLsizei draw = 0; draw < params.drawcount; ++draw) { @@ -153,7 +154,7 @@ _glDraw_count(const MultiDrawArraysParams ¶ms) } params_draw.instancecount = params.instancecount; params_draw.baseinstance = params.baseinstance; - GLuint _count_draw = _glDraw_count(params_draw); + GLuint _count_draw = _glDraw_count(ctx, params_draw); _count = std::max(_count, _count_draw); } return _count; @@ -161,7 +162,7 @@ _glDraw_count(const MultiDrawArraysParams ¶ms) GLuint -_glDraw_count(const MultiDrawElementsParams ¶ms) +_glDraw_count(gltrace::Context *ctx, const MultiDrawElementsParams ¶ms) { GLuint _count = 0; for (GLsizei draw = 0; draw < params.drawcount; ++draw) { @@ -178,7 +179,7 @@ _glDraw_count(const MultiDrawElementsParams ¶ms) } params_draw.instancecount = params.instancecount; params_draw.baseinstance = params.baseinstance; - GLuint _count_draw = _glDraw_count(params_draw); + GLuint _count_draw = _glDraw_count(ctx, params_draw); _count = std::max(_count, _count_draw); } return _count; diff --git a/wrappers/gltrace_arrays.hpp b/wrappers/gltrace_arrays.hpp index 2ecf893c..9b476f19 100644 --- a/wrappers/gltrace_arrays.hpp +++ b/wrappers/gltrace_arrays.hpp @@ -30,6 +30,11 @@ #include "glsize.hpp" +namespace gltrace { + class Context; +}; + + /* * TODO: Unify all draw params structure into a single structure. */ @@ -80,13 +85,13 @@ struct MultiDrawElementsParams GLuint -_glDraw_count(const DrawArraysParams ¶ms); +_glDraw_count(gltrace::Context *ctx, const DrawArraysParams ¶ms); GLuint -_glDraw_count(const DrawElementsParams ¶ms); +_glDraw_count(gltrace::Context *ctx, const DrawElementsParams ¶ms); GLuint -_glDraw_count(const MultiDrawArraysParams ¶ms); +_glDraw_count(gltrace::Context *ctx, const MultiDrawArraysParams ¶ms); GLuint -_glDraw_count(const MultiDrawElementsParams ¶ms); +_glDraw_count(gltrace::Context *ctx, const MultiDrawElementsParams ¶ms); |