AnsweredAssumed Answered

ocl-ogl interop - clCreateContext returns -1000 if the specified OpenGL context is not current

Question asked by zoomzoom on Aug 14, 2012
Latest reply on Jul 23, 2013 by roger512



According to the OpenCL specification version 1.0 (page 276), if a context is specified during a opengl-opencl interop initialization, the context does not need to be the current context of the thread calling clCreateFunction.


However, calling clCreateFunction to create an OpenCL context that will be associated with an OpenGL context, returns error code -1000 (CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR) if the OpenGL context is not the current context of the calling thread.


My GPU is an HD 7850 running OpenCL 1.2 AMD-APP 938.1


To get the error above, you can take any AMD OpenCL samples (for example, SimpleGL) and add a wglMakeCurrent(NULL, NULL) call just before clCreateContext function call.


I get no such error on NVIDIA GPUs.


Has anyone else encountered this problem? Or have I misread the documentation?


Thank you.