CLCREATEEVENTFROMGLS(3clc)
π CLCREATEEVENTFROMGLS π
okay bestie, we're in the 3clc OpenCL manual, and today's main character is a lil function called clCreateEventFromGLsyncKHR β it's giving "bridge between OpenCL and OpenGL" and honestly? iconic behavior. let's get into it π¦
β¨ NAME β¨
clCreateEventFromGLsyncKHR β creates an event object linked to an OpenGL sync object. no cap, that's the whole gig π
cl_event clCreateEventFromGLsyncKHR(cl_context context, GLsync sync,
cl_int *errcode_ret);
πΈ PARAMETERS πΈ
contextβ a valid OpenCL context, and it has to be one created from an OpenGL context or a share group, using thecl_khr_gl_sharing(3clc)extension. like, it's not optional, it's the vibe check π«Άsyncβ the name of a sync object in the GL share group associated withcontext. that's the GL-side bestie you're linking to β¨
π DESCRIPTION π
so here's the tea: you can make an event object by linking it to an OpenGL sync object. once you do that, completion of this event object is equivalent to waiting for completion of the fence command associated with the linked GL sync object. same energy, same finish line, periodt π
π NOTES π
when you query a linked event's parameters with clGetEventInfo(3clc), you get these values back:
- the
CL_EVENT_COMMAND_QUEUEof a linked event isNULL, because the event is not associated with any OpenCL command queue. it's unbothered, unqueued, free π¦ - the
CL_EVENT_COMMAND_TYPEof a linked event isCL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, which means the event is associated with a GL sync object rather than an OpenCL command. it's a GL girlie at heart π - the
CL_EVENT_COMMAND_EXECUTION_STATUSof a linked event is eitherCL_SUBMITTEDβ meaning the fence command associated with the sync object has not yet completed β orCL_COMPLETE, meaning the fence command has completed. it's either "not yet bestie" or "we're done here" π
clCreateEventFromGLsyncKHR performs an implicit clRetainEvent(3clc) on the returned event object. creating a linked event object also places a reference on the linked GL sync object, and when the event object is deleted, that reference gets removed from the GL sync object. so like, it's all tracked, the refcounts are balancing, we love to see it π§
β οΈ important one: events returned fromclCreateEventFromGLsyncKHRmay only be consumed byclEnqueueAcquireGLObjects(3clc). passing such events to any other CL API will generate aCL_INVALID_EVENTerror. do not pass go, do not collect $200 π
π₯ ERRORS π₯
returns a valid OpenCL event object and errcode_ret is set to CL_SUCCESS if the event object is created successfully. otherwise it returns a NULL value, with one of these error values coming back in errcode_ret:
CL_INVALID_CONTEXTifcontextis not a valid context, or was not created from a GL context. wrong context, boo πCL_INVALID_GL_OBJECTifsyncis not the name of a sync object in the GL share group associated withcontext. like, who is that? never met her π
π SPECIFICATION π
OpenCL Specification[1] β the receipts, as always β¨
π SEE ALSO π
cl_khr_gl_event(3clc), clEnqueueAcquireGLObjects(3clc), clRetainEvent(3clc) β go read these next, iykyk π
β AUTHORS β
The Khronos Group. kings of the spec fr fr π
π«Ά COPYRIGHT π«Ά
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
- OpenCL Specification β page 62, section 9.8.4 - Additions to Chapter 5
and that's the whole page bestie π brought to you by The Khronos Group, dated 01/14/2021, filed under CLCREATEEVENTFROMGLS(3clc). slay, go forth and link your events π
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms