Resizing OpenGL buffers after cudaGraphicsGLRegisterBuffer

Previously I’ve been using cudaGLRegisterBufferObject with linux/cuda5 but after switching to windows to give vs/nsight a shot the function is missing completely. Since it seems it’s deprecated anyway I’ve tried the new method:

  1. cudaGraphicsGLRegisterBuffer
  2. cudaGraphicsMapResources
  3. cudaGraphicsResourceGetMappedPointer
    This works just fine until I want to resize the buffer, at which point my cuda kernel starts reading bad data (unlike with cudaGLRegisterBufferObject). If I unregister and re-register the OpenGL buffer it works fine again. Is this expected behaviour or should CUDA be keeping track of the buffer position and size itself?

I know I’m responding to a very old thread but I’m having exactly the same problem.

I can’t afford the overhead of unregistering and reregistering the OpenGL buffer. Is there really no efficient way to resize a buffer that is shared between OpenGL and CUDA?