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/varray.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/varray.c')
-rw-r--r-- | src/mesa/main/varray.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index f04c137c6d3..3fbc730dc2a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -30,6 +30,7 @@ #include "context.h" #include "enable.h" #include "enums.h" +#include "hash.h" #include "mtypes.h" #include "varray.h" #include "arrayobj.h" @@ -1120,4 +1121,29 @@ _mesa_init_varray(GLcontext *ctx) _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ + + ctx->Array.Objects = _mesa_NewHashTable(); +} + + +/** + * Callback for deleting an array object. Called by _mesa_HashDeleteAll(). + */ +static void +delete_arrayobj_cb(GLuint id, void *data, void *userData) +{ + struct gl_array_object *arrayObj = (struct gl_array_object *) data; + GLcontext *ctx = (GLcontext *) userData; + _mesa_delete_array_object(ctx, arrayObj); +} + + +/** + * Free vertex array state for given context. + */ +void +_mesa_free_varray_data(GLcontext *ctx) +{ + _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx); + _mesa_DeleteHashTable(ctx->Array.Objects); } |