Invalid share group error when trying to create OpenCL context from OpenGL

I am getting CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR (error -1000) from clCreateContext(...) in my Windows application which has OpenGL window already initialized.

The code is:

cl_platform_id platforms[4];
cl_uint numOfPlatforms;

clGetPlatformIDs(4, platforms, &numOfPlatforms);

cl_context_properties props[] =
    CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
    CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
    CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0]),

cl_device_id devices[4];
cl_uint numOfDevices;

clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_GPU, 4, devices, &numOfDevices);

cl_int createContextError;
auto clContext = clCreateContext(props, 1, devices, &pfn_notify, NULL, &createContextError);

I have checked extensions of current device and it does support cl_khr_gl_sharing.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.