I am getting the cudaOperatingSystemError
63 304 when I try to call cuGraphicsGLRegisterImage.
I have a program that works using a test setup where the code in question is in the same thread as the OGL stuff. I then have another program (the one that fails) which is the target project, that runs the code in question on a different thread from the OGL stuff.
I have only one graphics card, and the OGL part of the program (the bad version) is using that same graphics card (GTX1080).
My cuda version is 9.1 and my GTX driver is 397.64.
Do I need to somehow pass in a OGL context or something into the thread where this call is called?
P.S. I read through https://devtalk.nvidia.com/default/topic/1006671/?comment=5138848, but nothing seemed to work. Based on this post I added cudaGLSetGLDevice(0) to my code, with no change.
Here is my call:
res = cuGraphicsGLRegisterImage(&cuInpTexRes, m_inputTexture, GL_TEXTURE_2D, CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY);
I came across this https://devtalk.nvidia.com/default/topic/492442/opengl-interoperability-and-cpu-multithreading/ which says that the call above needs to be on the same thread as the OpenGL calls so the context is the same. However, even when I do this I get the OS error.