Home | Info | Community | Development | myReactOS | Contact Us
[static]
Find the max index in the given element/index buffer
Definition at line 37 of file api_validate.c.
Referenced by _mesa_validate_DrawElements(), and _mesa_validate_DrawRangeElements().
{ const GLubyte *map = NULL; GLuint max = 0; GLint i; if (elementBuf->Name) { /* elements are in a user-defined buffer object. need to map it */ map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_READ_ONLY, elementBuf); /* Actual address is the sum of pointers */ indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); } if (type == GL_UNSIGNED_INT) { for (i = 0; i < count; i++) if (((GLuint *) indices)[i] > max) max = ((GLuint *) indices)[i]; } else if (type == GL_UNSIGNED_SHORT) { for (i = 0; i < count; i++) if (((GLushort *) indices)[i] > max) max = ((GLushort *) indices)[i]; } else { ASSERT(type == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) if (((GLubyte *) indices)[i] > max) max = ((GLubyte *) indices)[i]; } if (map) { ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ctx->Array.ElementArrayBufferObj); } return max; }