martijnberger/clew

clGetGLContextInfoKHR not found even if cl_khr_gl_sharing is found

Opened this issue · 1 comments

clGetGLContextInfoKHR (https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clGetGLContextInfoKHR.html) is defined in the cl_khr_gl_sharing (https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/cl_khr_gl_sharing.html) extension. However, clew doesn't necessarily always find it.

That's because clGetGLContextInfoKHR is an extension function, and according to https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clGetExtensionFunctionAddress.html

For functions that are queryable with clGetExtensionFunctionAddress, implementations may choose to also export those functions statically from the object libraries implementing those functions. However, portable applications cannot rely on this behavior.

Since clew uses dlsym-like mechanism, it fails to find the function.

AFAIK that's the only extension function currently exposed by clew. We wound need a proper mechanism to get it, i.e. clGetExtensionFunctionAddress() if we don't want to use the platform, or clGetExtensionFunctionAddressForPlatform() if we want to do it right.

That might require introducing another version of clew initialization that is called with a platform ID to initialize the functions for a given platform.

@martijnberger are you still maintaining clew? I could probably do the work for this, but I just want to check if you are accepting pull request, and make sure the design would fit your vision.