/* find max array index */
GLuint max = max_buffer_index(ctx, count, type, indices,
ctx->Array.ElementArrayBufferObj);
- if (max >= ctx->Array._MaxElement) {
+ if (max >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
_mesa_warning(ctx, "glDrawElements() index=%u is "
- "out of bounds (max=%u)", max, ctx->Array._MaxElement);
+ "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement);
return GL_FALSE;
}
}
if (ctx->Const.CheckArrayBounds) {
GLuint max = max_buffer_index(ctx, count, type, indices,
ctx->Array.ElementArrayBufferObj);
- if (max >= ctx->Array._MaxElement) {
+ if (max >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
}
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
- if (start + count > (GLint) ctx->Array._MaxElement)
+ if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
return GL_FALSE;
}
/** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */
GLbitfield _Enabled;
+
+ /**
+ * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs
+ * we can determine the max legal (in bounds) glDrawElements array index.
+ */
+ GLuint _MaxElement;
};
struct gl_buffer_object *ArrayBufferObj;
struct gl_buffer_object *ElementArrayBufferObj;
#endif
- GLuint _MaxElement; /* Min of all enabled array's maxes */
};
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices ))
return;
- if (end >= ctx->Array._MaxElement) {
+ if (end >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
_mesa_warning(ctx, "glDraw[Range]Elements() index=%u is "
- "out of bounds (max=%u)", end, ctx->Array._MaxElement);
+ "out of bounds (max=%u)", end,
+ ctx->Array.ArrayObj->_MaxElement);
return;
}