osgoculusviewer icon indicating copy to clipboard operation
osgoculusviewer copied to clipboard

Is SingleThreaded the mandatory threading option?

Open rickyviking opened this issue 5 years ago • 4 comments

Hi @bjornblissing,

the viewer example forces the osg threading model to SingleThreaded - see here. Is this actually mandatory? With CPU-bound scenes, using other schemes such as DrawThreadPerContext might help to improve the framerate.

rickyviking avatar Jun 17 '19 20:06 rickyviking

If I remember correctly the single threaded model is the model with the lowest latency. Other threading models may add another frame of latency, at least according to Robert's answer in this old thread: http://forum.openscenegraph.org/viewtopic.php?p=62642#62642

However this might be an old and outdated truth.

bjornblissing avatar Jun 17 '19 21:06 bjornblissing

One way to test other threading models would be to use the Oculus Debug Tool to print some performance diagnostics and then changing between different threading models. For your application some other threading model might be more preferable compared to running single threaded.

https://developer.oculus.com/documentation/pcsdk/latest/concepts/dg-debug-tool/

bjornblissing avatar Jun 18 '19 07:06 bjornblissing

Thank you, I will definitely give it a try and report back here!

Besides the latency, I was wandering if there were any other issue related to how fbo cameras are sent to the Oculus or similar sync problems, as the comment above the line which forces SingleThreaded states: // Force single threaded to make sure that no other thread can use the GL context

rickyviking avatar Jun 18 '19 15:06 rickyviking

Hi @bjornblissing apparently there are no issues using other threading models - I've mostly used DrawThreadPerContext and investigating if/how much performance gain I get from that.

As a side question (we might open another issue if appropriate) I'd like to know what is the suggested way to add the osg stats (and possibly other HUDs) on top of the preview window. Is there a clean way to render those cameras after blitting the texture from Oculus to the preview window?

rickyviking avatar Jul 19 '19 14:07 rickyviking