+/**
+ * Update the fields of a vertex array object.
+ * We need to do a few special things for arrays that live in
+ * vertex buffer objects.
+ *
+ * \param array the array to update
+ * \param dirtyBit which bit to set in ctx->Array.NewState for this array
+ * \param elementSize size of each array element, in bytes
+ * \param size components per element (1, 2, 3 or 4)
+ * \param type datatype of each component (GL_FLOAT, GL_INT, etc)
+ * \param stride stride between elements, in elements
+ * \param normalized are integer types converted to floats in [-1, 1]?
+ * \param ptr the address (or offset inside VBO) of the array data
+ */
+static void
+update_array(GLcontext *ctx, struct gl_client_array *array,
+ GLbitfield dirtyBit, GLsizei elementSize,
+ GLint size, GLenum type, GLenum format,
+ GLsizei stride, GLboolean normalized, const GLvoid *ptr)
+{
+ ASSERT(format == GL_RGBA || format == GL_BGRA);
+ array->Size = size;
+ array->Type = type;
+ array->Format = format;
+ array->Stride = stride;
+ array->StrideB = stride ? stride : elementSize;
+ array->Normalized = normalized;
+ array->Ptr = (const GLubyte *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_reference_buffer_object(ctx, &array->BufferObj,
+ ctx->Array.ArrayBufferObj);
+
+ /* Compute the index of the last array element that's inside the buffer.
+ * Later in glDrawArrays we'll check if start + count > _MaxElement to
+ * be sure we won't go out of bounds.
+ */
+ if (ctx->Array.ArrayBufferObj->Name)
+ array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size
+ - (GLsizeiptrARB) array->Ptr + array->StrideB
+ - elementSize) / array->StrideB;
+ else
+#endif
+ array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */