X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=helpers%2Fglsize.hpp;h=c4fe9bf9c866b5aa19c0b4283a9acf3998c39102;hb=ddf6d2c5e347f8ca25dad4d9be4a1494d8929d30;hp=fe267e1aa8a49d2b0a736368ea4c511ad1ef62f2;hpb=df20f3357343ffec18c3f23ceded1774adb4904c;p=apitrace diff --git a/helpers/glsize.hpp b/helpers/glsize.hpp index fe267e1..c4fe9bf 100644 --- a/helpers/glsize.hpp +++ b/helpers/glsize.hpp @@ -329,6 +329,21 @@ _glArrayPointer_size(GLint size, GLenum type, GLsizei stride, GLsizei count) #define _glVertexAttribPointerARB_size(size, type, normalized, stride, count) _glArrayPointer_size(size, type, stride, count) #define _glVertexAttribPointerNV_size(size, type, stride, count) _glArrayPointer_size(size, type, stride, count) +/** + * Same as glGetIntegerv, but passing the result in the return value. + */ +static inline GLint +_glGetInteger(GLenum pname) { + GLint param = 0; + _glGetIntegerv(pname, ¶m); + return param; +} + +static inline GLint +_element_array_buffer_binding(void) { + return _glGetInteger(GL_ELEMENT_ARRAY_BUFFER_BINDING); +} + static inline GLuint _glDrawArrays_count(GLint first, GLsizei count) { @@ -349,13 +364,12 @@ static inline GLuint _glDrawElementsBaseVertex_count(GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { GLvoid *temp = 0; - GLint element_array_buffer = 0; if (!count) { return 0; } - _glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &element_array_buffer); + GLint element_array_buffer = _element_array_buffer_binding(); if (element_array_buffer) { // Read indices from index buffer object GLintptr offset = (GLintptr)indices;