diff options
author | Andres Rodriguez <[email protected]> | 2017-10-06 17:17:54 -0400 |
---|---|---|
committer | Andres Rodriguez <[email protected]> | 2018-01-30 15:13:49 -0500 |
commit | 67d5d08682c4975a025182a7bf58a4768753e677 (patch) | |
tree | bfca34272dd4eee12b89e32dfedbe4169b8d1df7 /src/mesa/main/shared.c | |
parent | 8e635f7d65752cd5af362036fd50ff3957275510 (diff) |
mesa: add support for semaphore object creation/import/delete v3
Used by EXT_semmaphore and EXT_semaphore_fd
v2: Removed unnecessary dummy callback initialization
v3: Fixed attempting to free the DummySemaphoreObject
Signed-off-by: Andres Rodriguez <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
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); |