mesa: Rename ElementArrayBufferObj to IndexBufferObj.
DirectX and most hardware documentation use the term "Index Buffer" to
refer to a buffer containing indexes into arrays of vertex data, which
allows random access to vertex data, rather than sequential access.
OpenGL uses a different term for this concept: "Element Array Buffer".
However, "Index Buffer" has become much more widespread. A quick
Google search shows 29,300 hits for "Element Array Buffer" vs.
82,300 hits for "Index Buffer."
Arguably, "Index Buffer" is clearer: an "element of an array" (or list)
usually refers to an actual item stored in the array, not the index used
to refer to it.
The terminology is also already used in Mesa: some VBO module code for
dealing with ElementArrayBufferObj names local variables "ib".
Completely generated by:
$ find . -type f -print0 | xargs -0 sed -i \
's/ElementArrayBufferObj/IndexBufferObj/g'
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index fdda1dc..29a57c8 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1600,7 +1600,7 @@
aa++;
}
- check_vbo(actx, vao->ElementArrayBufferObj);
+ check_vbo(actx, vao->IndexBufferObj);
ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
ASSERT(aa - actx->arrays < 32);
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 41dfc38..af469e0 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -180,7 +180,7 @@
memset(&ib, 0, sizeof(ib));
ib.type = type;
ib.ptr = indices;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
@@ -435,10 +435,10 @@
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
@@ -493,12 +493,12 @@
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
for (i = 0; i < primcount; i++) {
if (index_bytes(type, count[i]) >
- ctx->Array.VAO->ElementArrayBufferObj->Size) {
+ ctx->Array.VAO->IndexBufferObj->Size) {
_mesa_warning(ctx,
"glMultiDrawElements index out of buffer bounds");
return GL_FALSE;
@@ -570,10 +570,10 @@
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) {
_mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds");
return GL_FALSE;
}
@@ -769,10 +769,10 @@
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) {
_mesa_warning(ctx,
"glDrawElementsInstanced index out of buffer bounds");
return GL_FALSE;
@@ -901,7 +901,7 @@
* If no element array buffer is bound, an INVALID_OPERATION error is
* generated.
*/
- if (!_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no buffer bound to GL_ELEMENT_ARRAY_BUFFER)", name);
return GL_FALSE;
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 0caae43..46ccbdc 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -116,7 +116,7 @@
{
(void) ctx;
unbind_array_object_vbos(ctx, obj);
- _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL);
+ _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL);
_glthread_DESTROY_MUTEX(obj->Mutex);
free(obj->Label);
free(obj);
@@ -257,7 +257,7 @@
}
}
- _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj,
+ _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj,
ctx->Shared->NullBufferObj);
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 5b5c48d..0045280 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1486,7 +1486,7 @@
copy_array_object(ctx, dest->VAO, src->VAO);
/* skip ArrayBufferObj */
- /* skip ElementArrayBufferObj */
+ /* skip IndexBufferObj */
}
/**
@@ -1506,8 +1506,8 @@
/* Just reference them here */
_mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj,
src->ArrayBufferObj);
- _mesa_reference_buffer_object(ctx, &dest->VAO->ElementArrayBufferObj,
- src->VAO->ElementArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &dest->VAO->IndexBufferObj,
+ src->VAO->IndexBufferObj);
}
/**
@@ -1552,10 +1552,10 @@
}
if (!arb_vao
- || src->VAO->ElementArrayBufferObj->Name == 0
- || _mesa_IsBuffer(src->VAO->ElementArrayBufferObj->Name))
+ || src->VAO->IndexBufferObj->Name == 0
+ || _mesa_IsBuffer(src->VAO->IndexBufferObj->Name))
_mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,
- src->VAO->ElementArrayBufferObj->Name);
+ src->VAO->IndexBufferObj->Name);
}
/**
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 7c966a7..ca55ef9 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -80,7 +80,7 @@
case GL_ARRAY_BUFFER_ARB:
return &ctx->Array.ArrayBufferObj;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
- return &ctx->Array.VAO->ElementArrayBufferObj;
+ return &ctx->Array.VAO->IndexBufferObj;
case GL_PIXEL_PACK_BUFFER_EXT:
return &ctx->Pack.BufferObj;
case GL_PIXEL_UNPACK_BUFFER_EXT:
@@ -451,7 +451,7 @@
#if 0
/* unfortunately, these tests are invalid during context tear-down */
ASSERT(ctx->Array.ArrayBufferObj != bufObj);
- ASSERT(ctx->Array.VAO->ElementArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.VAO->IndexBufferObj != bufObj);
ASSERT(ctx->Array.VAO->Vertex.BufferObj != bufObj);
#endif
@@ -1102,7 +1102,7 @@
if (ctx->Array.ArrayBufferObj == bufObj) {
_mesa_BindBuffer( GL_ARRAY_BUFFER_ARB, 0 );
}
- if (vao->ElementArrayBufferObj == bufObj) {
+ if (vao->IndexBufferObj == bufObj) {
_mesa_BindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 4464e7d..f22acff 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -839,7 +839,7 @@
ctx->Array.VAO->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name;
break;
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
- v->value_int = ctx->Array.VAO->ElementArrayBufferObj->Name;
+ v->value_int = ctx->Array.VAO->IndexBufferObj->Name;
break;
/* ARB_copy_buffer */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c9b954b..609c63f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1605,7 +1605,7 @@
*/
GLuint _MaxElement;
- struct gl_buffer_object *ElementArrayBufferObj;
+ struct gl_buffer_object *IndexBufferObj;
};
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 43ac03b..b316f09 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -291,11 +291,11 @@
const void *elemMap;
GLint i, k;
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
elemMap = ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.VAO->ElementArrayBufferObj->Size,
+ ctx->Array.VAO->IndexBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.VAO->ElementArrayBufferObj);
+ ctx->Array.VAO->IndexBufferObj);
elements = ADD_POINTERS(elements, elemMap);
}
@@ -323,8 +323,8 @@
}
}
- if (_mesa_is_bufferobj(vao->ElementArrayBufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj);
+ if (_mesa_is_bufferobj(vao->IndexBufferObj)) {
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj);
}
for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
@@ -883,15 +883,15 @@
{
const GLvoid *map =
ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.VAO->ElementArrayBufferObj->Size,
+ ctx->Array.VAO->IndexBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.VAO->ElementArrayBufferObj);
+ ctx->Array.VAO->IndexBufferObj);
switch (type) {
case GL_UNSIGNED_BYTE:
{
const GLubyte *us = (const GLubyte *) map;
GLint i;
- for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size; i++) {
+ for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size; i++) {
printf("%02x ", us[i]);
if (i % 32 == 31)
printf("\n");
@@ -903,7 +903,7 @@
{
const GLushort *us = (const GLushort *) map;
GLint i;
- for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 2; i++) {
+ for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 2; i++) {
printf("%04x ", us[i]);
if (i % 16 == 15)
printf("\n");
@@ -915,7 +915,7 @@
{
const GLuint *us = (const GLuint *) map;
GLint i;
- for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 4; i++) {
+ for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 4; i++) {
printf("%08x ", us[i]);
if (i % 8 == 7)
printf("\n");
@@ -927,7 +927,7 @@
;
}
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj);
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj);
}
#endif
@@ -955,7 +955,7 @@
ib.count = count;
ib.type = type;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices;
prim[0].begin = 1;
@@ -1097,7 +1097,7 @@
"(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
"base %d\n",
start, end, type, count,
- ctx->Array.VAO->ElementArrayBufferObj->Name,
+ ctx->Array.VAO->IndexBufferObj->Name,
basevertex);
}
@@ -1350,13 +1350,13 @@
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
*/
- if (!_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj))
+ if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj))
fallback = GL_TRUE;
if (!fallback) {
ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
ib.type = type;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = (void *)min_index_ptr;
for (i = 0; i < primcount; i++) {
@@ -1387,7 +1387,7 @@
continue;
ib.count = count[i];
ib.type = type;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices[i];
prim[0].begin = 1;
@@ -1657,7 +1657,7 @@
ib.count = 0; /* unknown */
ib.type = type;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
memset(prim, 0, sizeof(prim));
@@ -1701,11 +1701,11 @@
vbo_bind_arrays(ctx);
- /* NOTE: ElementArrayBufferObj is guaranteed to be a VBO. */
+ /* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
ib.type = type;
- ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
prim[0].begin = 1;
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 01c4c0e..98ab686 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1138,9 +1138,9 @@
_ae_map_vbos(ctx);
- if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj))
+ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj))
indices =
- ADD_POINTERS(ctx->Array.VAO->ElementArrayBufferObj->Pointer, indices);
+ ADD_POINTERS(ctx->Array.VAO->IndexBufferObj->Pointer, indices);
vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK |
VBO_SAVE_PRIM_NO_CURRENT_UPDATE));