summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/api_arrayelt.c2
-rw-r--r--src/mesa/main/api_validate.c14
-rw-r--r--src/mesa/main/arrayobj.c4
-rw-r--r--src/mesa/main/attrib.c7
-rw-r--r--src/mesa/main/bufferobj.c9
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/get.c2
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/vbo/vbo_exec_array.c42
-rw-r--r--src/mesa/vbo/vbo_save_api.c4
10 files changed, 44 insertions, 44 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index b93a057e68b..4d9ff43b2e1 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1580,7 +1580,7 @@ static void _ae_update_state( struct gl_context *ctx )
aa++;
}
- check_vbo(actx, ctx->Array.ElementArrayBufferObj);
+ check_vbo(actx, arrayObj->ElementArrayBufferObj);
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 1fcf5cd68db..4c7baca863b 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -182,7 +182,7 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
memset(&ib, 0, sizeof(ib));
ib.type = type;
ib.ptr = indices;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
@@ -254,10 +254,10 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
@@ -315,10 +315,10 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds");
return GL_FALSE;
}
@@ -454,10 +454,10 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
_mesa_warning(ctx,
"glDrawElementsInstanced index out of buffer bounds");
return GL_FALSE;
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 1283940f7fd..a0c9b11ebd5 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -133,6 +133,7 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
{
(void) ctx;
unbind_array_object_vbos(ctx, obj);
+ _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL);
_glthread_DESTROY_MUTEX(obj->Mutex);
free(obj);
}
@@ -252,6 +253,9 @@ _mesa_initialize_array_object( struct gl_context *ctx,
#if FEATURE_point_size_array
init_array(ctx, &obj->PointSize, 1, GL_FLOAT);
#endif
+
+ _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj,
+ ctx->Shared->NullBufferObj);
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index f368eecc1b2..30297de1912 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1385,8 +1385,8 @@ save_array_attrib(struct gl_context *ctx,
/* Just reference them here */
_mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj,
src->ArrayBufferObj);
- _mesa_reference_buffer_object(ctx, &dest->ElementArrayBufferObj,
- src->ElementArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj,
+ src->ArrayObj->ElementArrayBufferObj);
}
/**
@@ -1407,7 +1407,7 @@ restore_array_attrib(struct gl_context *ctx,
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
src->ArrayBufferObj->Name);
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
- src->ElementArrayBufferObj->Name);
+ src->ArrayObj->ElementArrayBufferObj->Name);
/* Better safe than sorry?! */
dest->RebindArrays = GL_TRUE;
@@ -1447,7 +1447,6 @@ free_array_attrib_data(struct gl_context *ctx,
_mesa_delete_array_object(ctx, attrib->ArrayObj);
attrib->ArrayObj = 0;
_mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &attrib->ElementArrayBufferObj, NULL);
}
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 8e8fcd59548..23e19f10a7f 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -77,7 +77,7 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
case GL_ARRAY_BUFFER_ARB:
return &ctx->Array.ArrayBufferObj;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
- return &ctx->Array.ElementArrayBufferObj;
+ return &ctx->Array.ArrayObj->ElementArrayBufferObj;
case GL_PIXEL_PACK_BUFFER_EXT:
return &ctx->Pack.BufferObj;
case GL_PIXEL_UNPACK_BUFFER_EXT:
@@ -270,7 +270,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
#if 0
/* unfortunately, these tests are invalid during context tear-down */
ASSERT(ctx->Array.ArrayBufferObj != bufObj);
- ASSERT(ctx->Array.ElementArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.ArrayObj->ElementArrayBufferObj != bufObj);
ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj);
#endif
@@ -531,8 +531,6 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
ctx->Shared->NullBufferObj);
- _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
- ctx->Shared->NullBufferObj);
_mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer,
ctx->Shared->NullBufferObj);
@@ -545,7 +543,6 @@ void
_mesa_free_buffer_objects( struct gl_context *ctx )
{
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
_mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL);
_mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL);
@@ -759,7 +756,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
if (ctx->Array.ArrayBufferObj == bufObj) {
_mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
}
- if (ctx->Array.ElementArrayBufferObj == bufObj) {
+ if (arrayObj->ElementArrayBufferObj == bufObj) {
_mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e0af6ee6749..7f6933ddb5b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1135,7 +1135,6 @@ _mesa_free_context_data( struct gl_context *ctx )
#if FEATURE_ARB_vertex_buffer_object
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
#endif
/* free dispatch tables */
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index d8a063876d8..95bc4a527cd 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1630,7 +1630,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name;
break;
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
- v->value_int = ctx->Array.ElementArrayBufferObj->Name;
+ v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name;
break;
/* ARB_copy_buffer */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e8866c6a4e6..ece3ba413a9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1611,6 +1611,8 @@ struct gl_array_object
* we can determine the max legal (in bounds) glDrawElements array index.
*/
GLuint _MaxElement;
+
+ struct gl_buffer_object *ElementArrayBufferObj;
};
@@ -1641,7 +1643,6 @@ struct gl_array_attrib
/* GL_ARB_vertex_buffer_object */
struct gl_buffer_object *ArrayBufferObj;
- struct gl_buffer_object *ElementArrayBufferObj;
};
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 7023380a1e7..65552a291de 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -270,11 +270,11 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
const void *elemMap;
GLint i, k;
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
elemMap = ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.ElementArrayBufferObj->Size,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
elements = ADD_POINTERS(elements, elemMap);
}
@@ -310,8 +310,8 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
}
}
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.ElementArrayBufferObj);
+ if (_mesa_is_bufferobj(arrayObj->ElementArrayBufferObj)) {
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj);
}
unmap_array_buffer(ctx, &arrayObj->Vertex);
@@ -727,15 +727,15 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLvoid *map =
ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.ElementArrayBufferObj->Size,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
switch (type) {
case GL_UNSIGNED_BYTE:
{
const GLubyte *us = (const GLubyte *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size; i++) {
printf("%02x ", us[i]);
if (i % 32 == 31)
printf("\n");
@@ -747,7 +747,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLushort *us = (const GLushort *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 2; i++) {
printf("%04x ", us[i]);
if (i % 16 == 15)
printf("\n");
@@ -759,7 +759,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLuint *us = (const GLuint *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 4; i++) {
printf("%08x ", us[i]);
if (i % 8 == 7)
printf("\n");
@@ -771,7 +771,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
;
}
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.ElementArrayBufferObj);
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj);
}
@@ -807,7 +807,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
ib.count = count;
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = indices;
prim[0].begin = 1;
@@ -909,8 +909,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"\tThis should probably be fixed in the application.",
start, end, count, type, indices,
ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- (int) ctx->Array.ElementArrayBufferObj->Size);
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
+ (int) ctx->Array.ArrayObj->ElementArrayBufferObj->Size);
}
if (0)
@@ -924,7 +924,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
*/
if (0) {
GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
if (max >= ctx->Array.ArrayObj->_MaxElement) {
if (warnCount < 10) {
_mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
@@ -934,8 +934,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"\tSkipping the glDrawRangeElements() call",
start, end, count, type, indices, max,
ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- (int) ctx->Array.ElementArrayBufferObj->Size);
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
+ (int) ctx->Array.ArrayObj->ElementArrayBufferObj->Size);
}
}
/* XXX we could also find the min index and compare to 'start'
@@ -958,7 +958,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
"base %d\n",
start, end, type, count,
- ctx->Array.ElementArrayBufferObj->Name,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
basevertex);
}
@@ -1171,13 +1171,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
*/
- if (!_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
+ if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj))
fallback = GL_TRUE;
if (!fallback) {
ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = (void *)min_index_ptr;
for (i = 0; i < primcount; i++) {
@@ -1204,7 +1204,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
for (i = 0; i < primcount; i++) {
ib.count = count[i];
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = indices[i];
prim[0].begin = 1;
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 64da7ac4993..9d8bada04cf 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1119,9 +1119,9 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
_ae_map_vbos(ctx);
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj))
indices =
- ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices);
+ ADD_POINTERS(ctx->Array.ArrayObj->ElementArrayBufferObj->Pointer, indices);
vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK |
VBO_SAVE_PRIM_NO_CURRENT_UPDATE));