The binding could be done more efficiently by comparing the non-NULL pointers in the old and new objects. The only arrays that are "dirty" are the ones that are non-NULL in either object.
{
GET_CURRENT_CONTEXT(ctx);
struct gl_array_object * const oldObj = ctx->Array.ArrayObj;
struct gl_array_object *newObj = NULL;
ASSERT_OUTSIDE_BEGIN_END(ctx);
ASSERT(oldObj != NULL);
if ( oldObj->Name == id )
return; /* rebinding the same array object- no change *//* * Get pointer to new array object (newBufObj) */if (id == 0) {
/* The spec says there is no array object named 0, but we use * one internally because it simplifies things. */
newObj = ctx->Array.DefaultArrayObj;
}
else {
/* non-default array object */
newObj = lookup_arrayobj(ctx, id);
if (!newObj) {
/* If this is a new array object id, allocate an array object now. */
newObj = (*ctx->Driver.NewArrayObject)(ctx, id);
if (!newObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
return;
}
_mesa_save_array_object(ctx, newObj);
}
}
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_ALL;
ctx->Array.ArrayObj = newObj;
/* Pass BindVertexArray call to device driver */if (ctx->Driver.BindArrayObject && newObj)
(*ctx->Driver.BindArrayObject)( ctx, newObj );
}
Generated on Sun May 27 2012 04:57:25 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.