I'm working on an OpenGL video player implementation, I'm playing multiple videos simultaneously through textures. I create 2 PBO's, each large enough to contain one frame from each video. On any given update, I have one PBO mapped and writing new frames to it asynchronously, while the other is unmapped and used as a source for glTexSubImage2D to upload previously written data to textures. On alternate frames, the PBO's get swapped (ie old mapped pbo becomes texture upload source, old texture upload source gets mapped for writing).
I had read about the glMapBuffer sync issues, and stalling the CPU, so I used the 'orphaning' technique. I call glBufferData with a NULL ptr to inform OpenGL I dont need the old buffer memory just before mapping it. According to my research, I should get a new buffer quickly without forcing synchronization with the render pipeline that may still be using the old buffer.
Here is the problem: glMapBuffer is still slow! The PBO is admittedly semi-large-ish (ie 22MB), but I am running on modern hardware and am seeing average glMapBuffer calls stalling for 10ms. Is this normal? Are there other ways to quickly execute this call?
Edited by Grumple, 13 June 2013 - 07:01 AM.