Re:C++11 lock-free command buffers for multi-thread rendering
by warmwaffles on Monday June 17, 2019 @02:03PM
(#20205703)
It's an interesting idea, but you still have single threaded rendering in the end with OpenGL. However, you are able to keep that thread constantly busy which is a big plus.
[ Parent
| on HN ]
Re:C++11 lock-free command buffers for multi-thread rendering
by tuxalin on Monday June 17, 2019 @05:14PM
(#20207450)
Indeed, that's a limitation of OpenGL which is addressed with Vulkan, however you can still use this with Vulkan and make use of the other features like: command sorting, less verbose API or command keys.
However, in most cases you wouldn't need the lock-free aspect of it (i.e. should be configurable), since in the end you would dispatch commands from their own threads, as monocasa well-pointed, that is something I do plan to do at some point (a solution better suited for Vulkan/D3D12), but sadly didn't had the free time.
Re:C++11 lock-free command buffers for multi-thread rendering
by monocasa on Monday June 17, 2019 @02:18PM
(#20205878)
This fits really well with the single submission queue model, particularly if you're careful to use AZDO style OpenGL. You merge sort the lists once you're done with the frame, and then you have a pretty good approximation of the minimum state changes needed as you iterate through the sorted list on your submission thread.
Now, the better implementations I've seen use per thread lists during queueing so you don't need any of the barriers or atomics here at all, but this is a good first pass.
Re:C++11 lock-free command buffers for multi-thread rendering
by warmwaffles on Monday June 17, 2019 @07:16PM
(#20208249)
Agreed, this is actually a fun exercise to think about