summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-12-30 23:04:16 +0000
committerJose Fonseca <jfonseca@vmware.com>2016-01-04 20:01:37 +0000
commitedc099cff55a6a3f9ad191acfbc8cc39f36228db (patch)
tree393aec2496df9f8e1abfbb1310b6ff60465ead81 /helpers
parent5fe1136361ac4e9d63632f270a04ad11574ae5d8 (diff)
gltrace: Honour range in glDrawRangeElement*.
Based from Roland Scheidegger's patch on https://bugs.freedesktop.org/show_bug.cgi?id=80419#c94 Fixes https://github.com/apitrace/apitrace/issues/407#issuecomment-167866502
Diffstat (limited to 'helpers')
-rw-r--r--helpers/glsize.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/helpers/glsize.hpp b/helpers/glsize.hpp
index dbac9772..bc74d875 100644
--- a/helpers/glsize.hpp
+++ b/helpers/glsize.hpp
@@ -494,10 +494,19 @@ _glDrawElementsBaseVertex_count(GLsizei count, GLenum type, const GLvoid *indice
return maxindex + 1;
}
-#define _glDrawRangeElementsBaseVertex_count(start, end, count, type, indices, basevertex) _glDrawElementsBaseVertex_count(count, type, indices, basevertex)
+static inline GLuint
+_glDrawRangeElementsBaseVertex_count(GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex)
+{
+ if (end < start ||
+ count < 0) {
+ return 0;
+ }
+
+ return end + basevertex + 1;
+}
#define _glDrawElements_count(count, type, indices) _glDrawElementsBaseVertex_count(count, type, indices, 0)
-#define _glDrawRangeElements_count(start, end, count, type, indices) _glDrawElements_count(count, type, indices)
+#define _glDrawRangeElements_count(start, end, count, type, indices) _glDrawRangeElementsBaseVertex_count(start, end, count, type, indices, 0)
#define _glDrawRangeElementsEXT_count _glDrawRangeElements_count
/* FIXME take in consideration instancing */