OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1720 Discussions

cl_khr_gl_sharing extension present but CL_DEVICES_FOR_GL_CONTEXT_KHR returns no devices

New Contributor I


I'm following the GL/CL interop Intel tutorial on a Linux 4.9 kernel distro with an Intel N4200/HD Graphics 505.

The device reports having the "cl_khr_gl_sharing" extension and i've loaded the "clGetGLContextInfoKHR" function.

But when I try to get cl devices for gl context, I get 0 devices. This is the code:

// Create CL context properties, add GLX context & handle to DC
cl_context_properties properties[] = {
CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), // GLX Context
CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), // GLX Display
CL_CONTEXT_PLATFORM, (cl_context_properties)platform, // OpenCL platform
// Find CL capable devices in the current GL context
cl_device_id devices[32]; size_t size;
clGetGLContextInfoKHR(properties, CL_DEVICES_FOR_GL_CONTEXT_KHR, 32 * sizeof(cl_device_id), devices, &size);

Is Linux not supported? I'm using the official Linux OpenCL drivers.



0 Kudos
0 Replies