summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-12-12 22:58:56 +0000
committerJosé Fonseca <jfonseca@vmware.com>2014-12-12 22:59:16 +0000
commit09519af2056879ce0ea59f7085ac4b282c7d01d0 (patch)
tree5d458c30c54c831c7d8398dcb5e95f6e58bb3b7f /helpers
parentc1a7abfdd823e0f9419fea8ca222c7e6c5f666e9 (diff)
gltrace: Handle primitive restart with user arrays.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/glsize.hpp34
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 {