diff options
Diffstat (limited to 'src/mesa/main/shared.c')
-rw-r--r-- | src/mesa/main/shared.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index e3417a4df30..b0338d78b05 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -136,6 +136,8 @@ _mesa_alloc_shared_state(struct gl_context *ctx) _mesa_key_pointer_equal); shared->MemoryObjects = _mesa_NewHashTable(); + shared->SemaphoreObjects = _mesa_NewHashTable(); + return shared; fail: @@ -316,6 +318,16 @@ delete_memory_object_cb(GLuint id, void *data, void *userData) ctx->Driver.DeleteMemoryObject(ctx, memObj); } +/** + * Callback for deleting a memory object. Called by _mesa_HashDeleteAll(). + */ +static void +delete_semaphore_object_cb(GLuint id, void *data, void *userData) +{ + struct gl_semaphore_object *semObj = (struct gl_semaphore_object *) data; + struct gl_context *ctx = (struct gl_context *) userData; + ctx->Driver.DeleteSemaphoreObject(ctx, semObj); +} /** * Deallocate a shared state object and all children structures. @@ -435,6 +447,11 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) _mesa_DeleteHashTable(shared->MemoryObjects); } + if (shared->SemaphoreObjects) { + _mesa_HashDeleteAll(shared->SemaphoreObjects, delete_semaphore_object_cb, ctx); + _mesa_DeleteHashTable(shared->SemaphoreObjects); + } + simple_mtx_destroy(&shared->Mutex); mtx_destroy(&shared->TexMutex); |