X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fshared.c;h=643ad3354e7e617a6778ac9268443de3955b0108;hb=dc8b139aa23899b00baa919fd7f46c74bf4ef205;hp=ad6e6ce7cd3cef671397e4a662166cec0d5fe1da;hpb=7ccb00b1acacb57cefca1ae789246983ef4831d9;p=mesa.git diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index ad6e6ce7cd3..643ad3354e7 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -43,7 +43,9 @@ #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif - +#if FEATURE_ARB_sync +#include "syncobj.h" +#endif /** * Allocate and initialize a shared context state structure. @@ -127,6 +129,10 @@ _mesa_alloc_shared_state(GLcontext *ctx) shared->RenderBuffers = _mesa_NewHashTable(); #endif +#if FEATURE_ARB_sync + make_empty_list(& shared->SyncObjects); +#endif + return shared; } @@ -196,7 +202,7 @@ delete_bufferobj_cb(GLuint id, void *data, void *userData) { struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data; GLcontext *ctx = (GLcontext *) userData; - if (bufObj->Pointer) { + if (_mesa_bufferobj_mapped(bufObj)) { ctx->Driver.UnmapBuffer(ctx, 0, bufObj); bufObj->Pointer = NULL; } @@ -336,6 +342,17 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) ctx->Driver.DeleteBuffer(ctx, shared->NullBufferObj); #endif +#if FEATURE_ARB_sync + { + struct simple_node *node; + struct simple_node *temp; + + foreach_s(node, temp, & shared->SyncObjects) { + _mesa_unref_sync_object(ctx, (struct gl_sync_object *) node); + } + } +#endif + /* * Free texture objects (after FBOs since some textures might have * been bound to FBOs).