glBufferData latency?

Stupid question (probably) but I just want to make sure I am not making a wrong assumption…

If I issue a glBufferData command to copy data to the GPU, is there any latency before I can use that data to draw with? I know there is, obviously… But do I need to worry about it, or will the command return once the copy is complete?

I am experiencing a weird effect with about 2 million vertices I am splitting across several buffers, and the only explanation I can come up with is that the data is not getting there by the time I try to draw it initially…

Don’t worry, solved it.

But out of curiosity can anyone point me to a good source of info about how the data is actually transferred. I would like to have a low level understanding so I can try to optimize some very large data transfers I am doing, and see if there is any way to multi-thread them.

afaik, nVidia’s VAR/fence extension + ATi’s full gpu documentation show nicely what dataformats for which elements are directly supported by hardware, so your drivers won’t need to transcode the data. Also primitive-types you draw matter - some make the driver transcode. And afaik drawing triangles in wireframe-mode, also transcodes (diminished performance hints this).

Thanks. Bed time reading I think! :slight_smile:

There is no any latency in glBufferData. Even more you can get more speed if you use glMapBuffer + some optimized memcpy code + glUnmapBuffer.

Hmm… I did not know that about glMapBuffer, but will give it a look. Thanks.

For MapBuffer to be fast, you should call BufferSubData with a NULL data pointer first, then MapBuffer. This will allow the driver to be smart and optimize stuff.