Apologies if this is mentioned elsewhere but I couldn’t much detail about host threads, just multiple Optix contexts.
My issue is that I would like to render my (progressively path traced SDF fractal) scene using a tile based rendering method, I was hoping this would help keep the interactive preview responsive because after each tile launch Optix would return control to the host code long enough to update the GUI etc. However, because everything is single threaded currently there’s no opportunity for the user to actually stop the render in progress / break out of the tile loop because any variables/buttons events are still only processed after all the tiles have launched and completed.
Before I spend some time making the design more multi-threaded I wanted to double check if this is even possible or a good idea, currently I use the GL interop to use my Optix result buffer directly as a viewport. I don’t believe OpenGL plays well with multiple threads at all, so I’m assuming I would have to do something like
- Launch each tile and place the results in a non-GLBO Optix buffer
- If some 'restart' variable switch has been set to false, break out of the tile render loop and restart
- If some 'stop' variable flag has been set to false, break out of the tile render loop and clean up
- Periodically copy over the contents of the Optix result buffer into an OpenGL buffer for the purpose of visualisation
- If the camera has moved, the viewport resized or if the user closes the main window, set the restart/quit flag
Would this work at all? And would it even improve performance, since now renders will be much slower despite potentially improving the visual feedback speed (the price of launching separate tile renders is going to be much slower than doing it in one go, and copying over entire buffers for the purpose of GL visualisation would be slower than using the GL interop).
Any help is appreciate, thanks!