I think, it should work as long as the CPU device supports cl_khr_gl_sharing extension and its in the list of all CL devices which may be associated with the specified OpenGL context queried using clGetGLContextInfoKHR . You may try following workflow:
// Say, you have declared the context property as below:
cl_context_properties props[] =
{
//OpenCL platform
CL_CONTEXT_PLATFORM, (cl_context_properties) platform,
//OpenGL context
CL_GL_CONTEXT_KHR, (cl_context_properties) hRC,
//HDC used to create the OpenGL context
CL_WGL_HDC_KHR, (cl_context_properties) hDC,
0
};
...
// Get the list of all CL devices which may be associated with the specified OpenGL context.
clGetGLContextInfoKHR(props, CL_DEVICES_FOR_GL_CONTEXT_KHR, listSize, deviceList, NULL));
// Check if the "deviceList" contains the CPU device and if so, find the CPU device from the "deviceList" using clGetDeviceInfo(..,CL_DEVICE_TYPE, …)
// Say, cpu device id is cpuDeviceId
// Then create a context only for CPU device
context = clCreateContext(props, 1, &cpuDeviceId, 0, 0, NULL);
// Now, its possible to share the GL texture or buffer
Regards,