I had the following plan for implementing an asynchronous buffer upload in an OpenGL program:
- Create shared contextes. Render thread has one, worker thread has one.
- Worker thread calls glBufferData. Each call allocates and uploads data completely fresh.
- Render thread probes buffer upload state using fences. Once finished, it starts using the buffer for drawing.
My question now is: Will the glBufferData in the worker thread still affect the performance of the main render thread in some way even if the render thread does not use the unfinished buffer yet?
My fear is that commands from different contexts still end up in the same pipeline and that the syscall emerging from glBufferData will block the commands from the render thread. Or that a swapbuffer on the render thread causes a finish on the worker thread.