Began work on providing support for threading camera cull traversals in parallel with
the previous frames draw traversal. Changes range from osg::State, through osgUtil::RenderBin, through to osgViewer
This commit is contained in:
@@ -25,6 +25,30 @@
|
||||
|
||||
namespace osgViewer {
|
||||
|
||||
class OSGVIEWER_EXPORT EndOfDynamicDrawBlock : public osg::State::DynamicObjectRenderingCompletedCallback
|
||||
{
|
||||
public:
|
||||
|
||||
EndOfDynamicDrawBlock();
|
||||
|
||||
void completed(osg::State* state);
|
||||
|
||||
void block();
|
||||
|
||||
void release();
|
||||
|
||||
void set(unsigned int blockCount);
|
||||
|
||||
protected:
|
||||
|
||||
~EndOfDynamicDrawBlock();
|
||||
|
||||
OpenThreads::Mutex _mut;
|
||||
OpenThreads::Condition _cond;
|
||||
unsigned int _blockCount;
|
||||
};
|
||||
|
||||
|
||||
/** View holds a single view on a scene, this view may be composed of one or more slave cameras.*/
|
||||
class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
{
|
||||
|
||||
@@ -63,6 +63,13 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
/** Get the threading model the rendering traversals will use.*/
|
||||
ThreadingModel getThreadingModel() const { return _threadingModel; }
|
||||
|
||||
/** Set whether the main thread, calling frame(), should be used for the rendering traversals.*/
|
||||
void setUseMainThreadForRenderingTraversals(bool flag);
|
||||
|
||||
/** Get whether the main thread, calling frame(), should be used for the rendering traversals.*/
|
||||
bool getUseMainThreadForRenderingTraversals() const { return _useMainThreadForRenderingTraversal; }
|
||||
|
||||
|
||||
enum BarrierPosition
|
||||
{
|
||||
BeforeSwapBuffers,
|
||||
@@ -148,11 +155,13 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
int _keyEventSetsDone;
|
||||
bool _quitEventSetsDone;
|
||||
|
||||
ThreadingModel _threadingModel;
|
||||
ThreadingModel _threadingModel;
|
||||
bool _useMainThreadForRenderingTraversal;
|
||||
BarrierPosition _endBarrierPosition;
|
||||
|
||||
osg::ref_ptr<osg::BarrierOperation> _startRenderingBarrier;
|
||||
osg::ref_ptr<osg::BarrierOperation> _endRenderingDispatchBarrier;
|
||||
osg::ref_ptr<EndOfDynamicDrawBlock> _endDynamicDrawBlock;
|
||||
|
||||
unsigned int computeNumberOfThreadsIncludingMainRequired();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user