mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
mesa: unify creation of real semaphore objects
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35866>
This commit is contained in:
parent
6c64ad934f
commit
488b1704e7
1 changed files with 23 additions and 24 deletions
|
|
@ -745,6 +745,20 @@ server_signal_semaphore(struct gl_context *ctx,
|
|||
*/
|
||||
static struct gl_semaphore_object DummySemaphoreObject;
|
||||
|
||||
static struct gl_semaphore_object *
|
||||
create_real_semaphore(struct gl_context *ctx, GLuint semaphore, struct gl_semaphore_object *semObj, const char *func)
|
||||
{
|
||||
if (semObj == &DummySemaphoreObject) {
|
||||
semObj = semaphoreobj_alloc(ctx, semaphore);
|
||||
if (!semObj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return NULL;
|
||||
}
|
||||
_mesa_HashInsert(&ctx->Shared->SemaphoreObjects, semaphore, semObj);
|
||||
}
|
||||
return semObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a semaphore object.
|
||||
* Not removed from hash table here.
|
||||
|
|
@ -1156,14 +1170,9 @@ _mesa_ImportSemaphoreFdEXT(GLuint semaphore,
|
|||
if (!semObj)
|
||||
return;
|
||||
|
||||
if (semObj == &DummySemaphoreObject) {
|
||||
semObj = semaphoreobj_alloc(ctx, semaphore);
|
||||
if (!semObj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return;
|
||||
}
|
||||
_mesa_HashInsert(&ctx->Shared->SemaphoreObjects, semaphore, semObj);
|
||||
}
|
||||
semObj = create_real_semaphore(ctx, semaphore, semObj, func);
|
||||
if (!semObj)
|
||||
return;
|
||||
|
||||
import_semaphoreobj_fd(ctx, semObj, fd);
|
||||
}
|
||||
|
|
@ -1198,14 +1207,9 @@ _mesa_ImportSemaphoreWin32HandleEXT(GLuint semaphore,
|
|||
if (!semObj)
|
||||
return;
|
||||
|
||||
if (semObj == &DummySemaphoreObject) {
|
||||
semObj = semaphoreobj_alloc(ctx, semaphore);
|
||||
if (!semObj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return;
|
||||
}
|
||||
_mesa_HashInsert(&ctx->Shared->SemaphoreObjects, semaphore, semObj);
|
||||
}
|
||||
semObj = create_real_semaphore(ctx, semaphore, semObj, func);
|
||||
if (!semObj)
|
||||
return;
|
||||
|
||||
enum pipe_fd_type type = handleType == GL_HANDLE_TYPE_D3D12_FENCE_EXT ?
|
||||
PIPE_FD_TYPE_TIMELINE_SEMAPHORE : PIPE_FD_TYPE_SYNCOBJ;
|
||||
|
|
@ -1242,14 +1246,9 @@ _mesa_ImportSemaphoreWin32NameEXT(GLuint semaphore,
|
|||
if (!semObj)
|
||||
return;
|
||||
|
||||
if (semObj == &DummySemaphoreObject) {
|
||||
semObj = semaphoreobj_alloc(ctx, semaphore);
|
||||
if (!semObj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return;
|
||||
}
|
||||
_mesa_HashInsert(&ctx->Shared->SemaphoreObjects, semaphore, semObj);
|
||||
}
|
||||
semObj = create_real_semaphore(ctx, semaphore, semObj, func);
|
||||
if (!semObj)
|
||||
return;
|
||||
|
||||
enum pipe_fd_type type = handleType == GL_HANDLE_TYPE_D3D12_FENCE_EXT ?
|
||||
PIPE_FD_TYPE_TIMELINE_SEMAPHORE : PIPE_FD_TYPE_SYNCOBJ;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue