I want to transfer contents of a very large memory chunk to a sufficiently large GPU buffer and then immediately alter the contents of memory on CPU. Something like this in pseudo-code:
glBindBuffer(/*very_large_buffer*/);
glBufferSubData(/*very_large_memory_chunk*/);
memset(/*zeros*/, /*very_large_memory_chunk*/);
In this code, what does glBufferSubData
actually do? Does it transfer very_large_memory_chunk somewhere before return or just schedules the transfer operation for possibly later execution? So if I start altering the CPU buffer immediately, is it possible that partially altered memory will be transfered, yielding garbage in GPU's very_large_buffer?
Note that I'm not asking about rendering calls. I know that if the buffer is used for rendering, transfer operations will wait until rendering is complete and vice versa. I want to know if OpenGL behaves the alike way in CPU-to-GPU transfer operations.