This exposes cl_khr_gl_sharing and cl_khr_gl_event. These extensions will only actually work when paired with GLOn12 from Mesa, either through WGL or EGL, and only when Mesa is built with the still-in-review https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19242.
As far as implementation details, nothing too crazy. Mesa exports raw D3D12 device, queue, and resources which we then import into CL. Some annoying pieces to note:
This can import faces of a cubemap, which means that an image can now have a nonzero base array index.
This can import mip levels from a mipped resource. Mips were something that was ignored for now, so this adjusts subresource index computation all over the place.
To be able to get at the GL/WGL/EGL functions to do the exporting, sometimes a context needs to be current. This can be a pain. Similarly, to be able to call the functions to make clEnqueueAcquireGLObjects and clCreateEventFromGLsyncKHR work, a context needs to be current, but those are done from worker threads, so we need our own context.
This also fixes the problem with cl_khr_il_program that it wasn't exposed through clGetExtensionFunctionAddress[forPlatform] while exposing the new GL functions.
This passes the CL CTS for GL sharing.
This exposes
cl_khr_gl_sharing
andcl_khr_gl_event
. These extensions will only actually work when paired with GLOn12 from Mesa, either through WGL or EGL, and only when Mesa is built with the still-in-review https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19242.As far as implementation details, nothing too crazy. Mesa exports raw D3D12 device, queue, and resources which we then import into CL. Some annoying pieces to note:
clEnqueueAcquireGLObjects
andclCreateEventFromGLsyncKHR
work, a context needs to be current, but those are done from worker threads, so we need our own context.This also fixes the problem with
cl_khr_il_program
that it wasn't exposed throughclGetExtensionFunctionAddress
[forPlatform] while exposing the new GL functions.