summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-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
8 files changed, 21 insertions, 21 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;
};