OpenCL-openGL interoperablity in multi-threaded environment


I’m using linux (ubuntu11.04) and NVidia GEForce9800 series PCI card.

i’m trying to use “OpenCL-openGL interoperablity” in multi-threaded environment.

Creating and accessing OpenCL functions from thread A and Creating and accessing OpenGL/GLX functions from another thread B.



1.Creation and execution of all GL functions



Creation and execution of all CL functions.

In this scenario i’m trying to demostrate Interoporablity use case:


  1. creation of CL shared context (using GL context) is successful

(NOTE: it works ONLY with OPenCL1.1 driver and with NVIDIA driver version 295.20. When i tried with 290.10, it doesn’t work. results into segmentation fault).

  1. Creation of CL shared buffer is successful from different threads.

  2. However, acquiring GL resource using the created CLsharedBuffer crashes in libNvidia-glcore.

I also confirmed that GL thread is not accessing the buffer.

Also, glFlush() and glFinish() has been called before CL calls are made.

If ‘clEnqueueAcquireGLObjects’ is called from the GL thread, it works fine.

please let me know if i need to take care of any additional handling in case of multi thread.

Also, provide inputs on debugging GPU if applicable.

My requirement is to make it in two different threads.

Appreciate the early response.

thanks in advance for help and support.