Access registered OpenGL texture from another thread

Hi all,

Just a question if someone has experience of implementing thinks similar to:

  1. Thread A using CUDA. Thread registers the OpenGL texture in CUDA. The OpenGL context also belongs to thread A.
  2. Thread B using CUDA and use the same device as thread A.
  3. Can thread B map/unmap and write to the texture resource that thread A has registered?

I know that in CUDA SDK 3 it was seems to not possible. But in CUDA SDK 4.0 it looks like it’s possible. In doc it said that 2 threads using same device - can share memory allocations and cuda arrays. I would be sure it will work if thread A was mapping and unmapping the resource to cudaArray, in that case the cudaArray would be shared between threads. But in my case it is critical that thread B will map and unmap the resource, so cudaGraphicsResource is shared. So I’m not sure here.

Does anyone have experience with that? Will it work?

Thanks