CLGL interop causes CL_INVALID_KERNEL_ARGS

Hi.

I am currently porting a CUDA program to OpenCL that needs to share the framebuffer between OpenCL and OpenGL.

In order to get the basics working I am testing with a kernel that simply sets the color of all pixels to white.

The context is created for interop and clCreateFromGLBuffer returns CL_SUCCESS. I am also using glFinish(), enqueueAcquireGLObjects(), enqueueReleaseGLObjects() and commandQueue.finish() around the kernel launch

In the first frame everything works. If I pause it after the draw call, the image is white.

In the second frame, however, the function clEnqueueNDRangeKernel returns an error: CL_INVALID_KERNEL_ARGS

between the two frames the cl_mem object is released and the clCreateFromGLBuffer function is called again CL_SUCCESSfully

This release and create is done instead of cudaGLMapBufferObject / cudaGLUnmapBufferObject, because I wanted to keep the program logic intact and don’t know what you have to do in OpenCL instead of calling those two functions

System:
x64
Geforce GTX 280 (driver version 197.xx)
GL interop SDK samples work

Has anyone seen this behaviour before and can help me?

Thanks for reading.