PDA

View Full Version : glBufferData latency?



scratt
06-12-2008, 06:10 AM
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..

scratt
06-12-2008, 10:00 PM
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.

Ilian Dinev
06-13-2008, 01:11 AM
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).

scratt
06-13-2008, 01:40 AM
Thanks. Bed time reading I think! :)

yooyo
06-13-2008, 04:06 AM
There is no any latency in glBufferData. Even more you can get more speed if you use glMapBuffer + some optimized memcpy code + glUnmapBuffer.

scratt
06-13-2008, 11:32 PM
Hmm.. I did not know that about glMapBuffer, but will give it a look. Thanks.

Lord crc
06-14-2008, 09:07 AM
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.