• Advertisement
Sign in to follow this  

glMapBufferARB aligned to 16bytes

This topic is 3761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the past, to copy data in to my OGL VBO's, I obtain a pointer to the data using glMapBufferARB then do a memcopy from a copy i have in been keeping in main memory. Now, I Have added some SSE code to my engine, so need 16byte alignment any anything using my maths. I also want to remove the overhead of calling memcopy from my copy to the data buffer pointed to by glMapBufferARB. I was thinking I could write the data strait in to it instead of using an intermediate buffer, but this would mean glMapBufferARB needs memory aligned to 16 bytes. Is there some way I can make it do this?

Share this post


Link to post
Share on other sites
Advertisement
Add 16 bytes to your allocation size and adjust the pointer to skip unaligned memory.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eric Lengyel
glMapBufferARB is slow. You should write your data into your own buffer and then use glBufferSubDataARB to load it into the buffer object. No alignment issues.


Humm,

Say you have a VBO which you are filling with new dynamic data each frame, and your CPU side code filling the VBO requires 16byte alignment (as per the original topic).

Assuming alignment wasn't an issue, you are saying that when you glMapBuffer() (say with the DYNAMIC DRAW option?) the GL driver sets up a mapping between GPU memory and the CPU address space such that when the program accesses that memory it is writing/reading through the bus to the GPU, and that is slow?

And perhaps that glBufferSubData() simply does a DMA write of the data at one time to the GPU, which is faster than the glMapBuffer()?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement