diff options
author | Brian Paul <[email protected]> | 2009-06-19 17:58:47 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-19 18:11:52 -0600 |
commit | 12cf98f5fc5eaa4743134387ce3f8e584aa20bc4 (patch) | |
tree | e5cda3e5920ae3102319844fd594c2e60495dff4 /src/mesa/main/arrayobj.c | |
parent | bda551898a09e4a07491dcf394bb2981dced0012 (diff) |
mesa: move vertex array objects from shared state to per-context
The ARB version requires VAOs to be per-context while the Apple extension
was ambiguous.
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r-- | src/mesa/main/arrayobj.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index c03353b78f5..e078f69ff95 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -63,10 +63,11 @@ static INLINE struct gl_array_object * lookup_arrayobj(GLcontext *ctx, GLuint id) { - return (id == 0) - ? NULL - : (struct gl_array_object *) _mesa_HashLookup(ctx->Shared->ArrayObjects, - id); + if (id == 0) + return NULL; + else + return (struct gl_array_object *) + _mesa_HashLookup(ctx->Array.Objects, id); } @@ -252,7 +253,7 @@ save_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ - _mesa_HashInsert(ctx->Shared->ArrayObjects, obj->Name, obj); + _mesa_HashInsert(ctx->Array.Objects, obj->Name, obj); } } @@ -266,7 +267,7 @@ remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* remove from hash table */ - _mesa_HashRemove(ctx->Shared->ArrayObjects, obj->Name); + _mesa_HashRemove(ctx->Array.Objects, obj->Name); } } @@ -425,8 +426,6 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) return; } - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - for (i = 0; i < n; i++) { struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]); @@ -450,8 +449,6 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) _mesa_reference_array_object(ctx, &obj, NULL); } } - - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } @@ -478,12 +475,7 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) return; } - /* - * This must be atomic (generation and allocation of array object IDs) - */ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - - first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ArrayObjects, n); + first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n); /* Allocate new, empty array objects and return identifiers */ for (i = 0; i < n; i++) { @@ -492,15 +484,12 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) obj = (*ctx->Driver.NewArrayObject)( ctx, name ); if (!obj) { - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE"); return; } save_array_object(ctx, obj); arrays[i] = first + i; } - - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } @@ -521,9 +510,7 @@ _mesa_IsVertexArrayAPPLE( GLuint id ) if (id == 0) return GL_FALSE; - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); obj = lookup_arrayobj(ctx, id); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); return (obj != NULL) ? GL_TRUE : GL_FALSE; } |