Thank you a lot for your answers, makes all sense to me now!
[QUOTE=Dark Photon;1280308]
Ah yes. I remember hitting this. Are you working on an NVidia GPU? If so, there’s a work-around for this. Just let me know.
I am curious how you’re detecting that the driver did this migration behind-the-scenes.[/QUOTE]
Exactly, I am on NVIDIA. Currently I try to change the app to use glBufferStorage instead of glBufferData for the initial datatransfer in the hope that this will keep it in video memory. If there is another workarround I’m very eager to hear. I was seeing worse than expected performance on the GPU, profiling with NSIGHT does not indicate any kind of bottleneck, so I created a Debug context and added a debug callback with glDebugMessageCallback and that gives me the following output:
----------opengl-callback-message----------
message: Buffer detailed info: Trying to allocate VBO (1687) with size:, 50.00 Mb to location: VID
------------------------------ //looking good, this is what I want
----------opengl-callback-message----------
message: Buffer detailed info: Buffer object 1687 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
------------------------------ //why is the driver stating that hint is static_draw? I am passing GL_DYNAMIC_DRAW with glBufferData!
----------opengl-callback-message----------
message: Buffer detailed info: Buffer object 1687 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) has been mapped in HOST memory.
------------------------------ //this happens when mapping the buffer. Now it recognizes it is dynamic_draw and maps it into HOST memory
----------opengl-callback-message----------
message: Buffer detailed info: Freeing VBO (1687) with size:, 50.00 Mb from location: VID
------------------------------ //now it’s freeing the buffer from video memory, this is not what I want!
----------opengl-callback-message----------
message: Buffer detailed info: Trying to allocate VBO (1687) with size:, 50.00 Mb to location: SYSHEAP
------------------------------ //now the driver is reallocating the VBO on the System Heap, this is not what I want!
----------opengl-callback-message----------
message: Buffer detailed info: Buffer object 1687 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (1), and GL_ARRAY_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) stored in SYSTEM HEAP memory has been updated.
----------opengl-callback-message----------
message: Buffer detailed info: Buffer object 1687 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (1), and GL_ARRAY_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) will use SYSTEM HEAP memory as the source for buffer object operations.
------------------------------ //not good