Hi, I have an OpenGL buffer that I have mapped to CUDA using the deprecated API, and I would like to copy the data that is inside it, this is what I’ve tried so far, but I’m getting an invalid argument error:
// ... create OpenGL buffer ... // Register OpenGL buffer COMPUTE_SAFE(cudaGLRegisterBufferObject(vertexBufferID)); // Map to cuda memory int* buffer; COMPUTE_SAFE(cudaGLMapBufferObject(reinterpret_cast<void**>(&buffer), vertexBufferID)); // Create a copy of the buffer int* bufferCopy; COMPUTE_SAFE(cudaMalloc((void**)&bufferCopy, elementCount * sizeof(int))); // Note that the following line produces the error COMPUTE_SAFE(cudaMemcpy(bufferCopy, buffer, elementCount * sizeof(int), cudaMemcpyDeviceToDevice)); // ... Free the memory and unmap the vertex buffer ...
Note that I’ve written this inside of a browser and have not tested this, however it should still produce the same error. Also note that the OpenGL interop works just fine without the
Any help is greatly appreciated.