#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)
{
_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;
}
}
+
+/**
+ * Helper function for determining the string lengths for glShaderSource and
+ * glShaderSourceARB, which is a tad too complex to inline in the specs.
+ */
+template<class T>
+static inline size_t
+_glShaderSource_length(const T * const * string, const GLint *length, GLsizei index)
+{
+ if (length != NULL && length[index] >= 0) {
+ return (size_t)length[index];
+ } else {
+ return strlen(string[index]);
+ }
+}
+
/*
* attribute list, terminated by the given terminator.
*/