Re: [osg-users] Explicitly synchronize all viewer cameras?
Hi, thank you for your input. I've resolved the problem by marking a couple more StateSets as dynamic. Maybe it would be a good idea to include the threading + dynamic nodes hint in the official documentation? Personally I wasnt aware that data variance settings influence threading behavior. I was under the impression that it was mainly for the osgOptimizer class. Adding it to the documentation may safe other beginners some headaches. Thank you! Cheers, Philipp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68022#68022 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Explicitly synchronize all viewer cameras?
Hi Philipp, The osg::Stats class can be used to collect stats on all the traversals. Have a look how the StatsHandler gets the stats, see src/osgViewer/StatsHander.cpp. Robert. On 5 July 2016 at 08:29, Philipp Meyer wrote: > Hi, > > thanks for your (as always) really quick response! > I'm trying to achieve various things. As a simple example, I want to measure > the time it takes to render 1 frame (CPU and GPU time). > For that, I used something along the lines of: > > >> //.. >> start = highPrecisionTimer.now(); >> viewer->advance(); >> viewer->eventTraversal(); >> viewer->updateTraversal(); >> viewer->renderingTraversals(); >> >> //at this point, I would need some sort of barrier (like joining all >> threads?) >> >> glFinish() //make sure GPU is done, too. >> end = highPrecisionTimer.now(); >> //... > > > But since I switched to ThreadPerCamera, to my understanding, this will no > longer work. How would I go about something simple like this? Is there any > example code I could look at regarding the graphicsOperation and barrier? > > Thank you! > > Cheers, > Philipp > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=68003#68003 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Explicitly synchronize all viewer cameras?
Hi, thanks for your (as always) really quick response! I'm trying to achieve various things. As a simple example, I want to measure the time it takes to render 1 frame (CPU and GPU time). For that, I used something along the lines of: > //.. > start = highPrecisionTimer.now(); > viewer->advance(); > viewer->eventTraversal(); > viewer->updateTraversal(); > viewer->renderingTraversals(); > > //at this point, I would need some sort of barrier (like joining all threads?) > > glFinish() //make sure GPU is done, too. > end = highPrecisionTimer.now(); > //... But since I switched to ThreadPerCamera, to my understanding, this will no longer work. How would I go about something simple like this? Is there any example code I could look at regarding the graphicsOperation and barrier? Thank you! Cheers, Philipp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68003#68003 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Explicitly synchronize all viewer cameras?
Hi Philipp, The ThreadPerCamera is just shorthand for CullThreadPerCameraDrawThreadPerContext, which will explain a bit more what's actually happening - it's meant to allow the draw thread to progress in parallel with the next frame. There is a mechanism built into the backend to hold back the next frame if there are any Drawables or StateSet's with their DataVariance marked as DYNAMIC, however, if your whole scene is STATIC then this will allow the next frame to advance. There isn't any default additional mechanism for holding back the next frame. There are mechanisms for doing a swap ready check for multi-context systems which does something similar to what you are after. A another different take would be to insert an GraphicsOperation prior to the sawp buffers that has a barrier that you can control, a bit like the swap buffers one. I have to ask though, what exactly are you trying to achieve here, what's the end feature that you are after, it may well be that you are trying to solve the problem in the completely the wrong way. Robert On 4 July 2016 at 15:25, Philipp Meyer wrote: > Hi, > > I'm using multiple cameras and want them to render the scene in parallel to > increase GPU load. For that, I set the threading model of my Viewer to > "ThreadPerCamera". > > That all works fine, however, I'm facing the issue that the viewer seems to > begin the next frame before the current frame is completed. (Or with other > words: viewer.renderingTraversals() does not seem to block long enough for my > needs). > > I can not have that happen because of some additional logic I'm performing in > my program main loop. Is there any way I can wait until all cameras have > completed their frame? Ive messed with the viewers end barrier and frame > policies with no success. Some older tutorials also mention a "sync()" > method, however it does not seem to exist any longer. I also cant find any > other methods within the viewer related to synchronization. > > Thank you! > > Cheers, > Philipp > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=67983#67983 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Explicitly synchronize all viewer cameras?
Hi, I'm using multiple cameras and want them to render the scene in parallel to increase GPU load. For that, I set the threading model of my Viewer to "ThreadPerCamera". That all works fine, however, I'm facing the issue that the viewer seems to begin the next frame before the current frame is completed. (Or with other words: viewer.renderingTraversals() does not seem to block long enough for my needs). I can not have that happen because of some additional logic I'm performing in my program main loop. Is there any way I can wait until all cameras have completed their frame? Ive messed with the viewers end barrier and frame policies with no success. Some older tutorials also mention a "sync()" method, however it does not seem to exist any longer. I also cant find any other methods within the viewer related to synchronization. Thank you! Cheers, Philipp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=67983#67983 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org