Problem with GL interop (cuGLMapBufferObject) repeatable crash in cuGLMapBufferObject running in Qt


I am playing around with the H264 decoder example in the cuda SDK and I have ported this example to a Qt application, rendering to a QGLWidget.

The decoding works fine and I can see the decoded images rendered as expected. I have a tab widget with multiple tabs each displaying a different QGLWidget. If I switch tabs to any other tab than the one that the cuda process started on, I get a crash in

cutilDrvSafeCallNoSync( cuGLMapBufferObject( o_pImageData, o_pImagePitch, m_glPBO ) );

with error message CUDA_ERROR_INVALID_HANDLE.

Has anyone succesfuly integrated cuda with Qt, or can someone shed some light on this?

Much appreciated,

I haven’t done anything with that widget or QT, but your problem seems to be quite similar to a problem that I was having with a multiwindow openGL setup. I was getting that error on mapping the buffer also. The problem for me was that I was creating the buffer object on a different subwindow than the one that was using it. When i changed them to be the same it was fixed. Maybe make a buffer for each tab or calling glSetWindow first?

Thanks for the tip! Recreating the GLImage when I switch between tabs solved the problem.