diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-12-12 22:58:56 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-12-12 22:59:16 +0000 |
commit | 09519af2056879ce0ea59f7085ac4b282c7d01d0 (patch) | |
tree | 5d458c30c54c831c7d8398dcb5e95f6e58bb3b7f /helpers | |
parent | c1a7abfdd823e0f9419fea8ca222c7e6c5f666e9 (diff) |
gltrace: Handle primitive restart with user arrays.
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/glsize.hpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/helpers/glsize.hpp b/helpers/glsize.hpp index 15901322..c227f692 100644 --- a/helpers/glsize.hpp +++ b/helpers/glsize.hpp @@ -408,26 +408,48 @@ _glDrawElementsBaseVertex_count(GLsizei count, GLenum type, const GLvoid *indice } GLuint maxindex = 0; + + GLboolean restart_enabled = _glIsEnabled(GL_PRIMITIVE_RESTART); + while ((_glGetError() == GL_INVALID_ENUM)) + ; + + GLuint restart_index = 0; + if (restart_enabled) { + restart_index = (GLuint)_glGetInteger(GL_PRIMITIVE_RESTART_INDEX); + } + GLsizei i; if (type == GL_UNSIGNED_BYTE) { const GLubyte *p = (const GLubyte *)indices; for (i = 0; i < count; ++i) { - if (p[i] > maxindex) { - maxindex = p[i]; + GLuint index = p[i]; + if (restart_enabled && index == restart_index) { + continue; + } + if (index > maxindex) { + maxindex = index; } } } else if (type == GL_UNSIGNED_SHORT) { const GLushort *p = (const GLushort *)indices; for (i = 0; i < count; ++i) { - if (p[i] > maxindex) { - maxindex = p[i]; + GLuint index = p[i]; + if (restart_enabled && index == restart_index) { + continue; + } + if (index > maxindex) { + maxindex = index; } } } else if (type == GL_UNSIGNED_INT) { const GLuint *p = (const GLuint *)indices; for (i = 0; i < count; ++i) { - if (p[i] > maxindex) { - maxindex = p[i]; + GLuint index = p[i]; + if (restart_enabled && index == restart_index) { + continue; + } + if (index > maxindex) { + maxindex = index; } } } else { |