From Paul Martz, Added ViewerBase::s/getEndBarrierOperation(..) method to allow user control of how viewers are sync'd.

This commit is contained in:
Robert Osfield 2012-01-24 17:21:14 +00:00
parent 884f480202
commit b0b98d49b8
2 changed files with 12 additions and 1 deletions

View File

@ -107,6 +107,15 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
/** Get the end barrier position.*/
BarrierPosition getEndBarrierPosition() const { return _endBarrierPosition; }
/** Set the end barrier operation. \c op may be one of GL_FLUSH, GL_FINISH,
* or NO_OPERATION. NO_OPERATION is the default. Per BarrierOperation::operator()(),
* a glFlush() command, glFinish() command, or no additional OpenGL command will be
* issued before entering the end barrier. */
void setEndBarrierOperation(const osg::BarrierOperation::PreBlockOp& op) { _endBarrierOperation = op; }
/** Get the end barrier operation. */
osg::BarrierOperation::PreBlockOp getEndBarrierOperation() const { return _endBarrierOperation; }
/** Set the done flag to signal the viewer's work is done and should exit the frame loop.*/
@ -309,6 +318,7 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
BarrierPosition _endBarrierPosition;
osg::BarrierOperation::PreBlockOp _endBarrierOperation;
osg::ref_ptr<osg::BarrierOperation> _startRenderingBarrier;
osg::ref_ptr<osg::BarrierOperation> _endRenderingDispatchBarrier;

View File

@ -60,6 +60,7 @@ void ViewerBase::viewerBaseInit()
_threadingModel = AutomaticSelection;
_threadsRunning = false;
_endBarrierPosition = AfterSwapBuffers;
_endBarrierOperation = osg::BarrierOperation::NO_OPERATION;
_requestRedraw = true;
_requestContinousUpdate = false;
@ -355,7 +356,7 @@ void ViewerBase::startThreading()
if (numThreadsOnEndBarrier>1)
{
_endRenderingDispatchBarrier = new osg::BarrierOperation(numThreadsOnEndBarrier, osg::BarrierOperation::NO_OPERATION);
_endRenderingDispatchBarrier = new osg::BarrierOperation(numThreadsOnEndBarrier, _endBarrierOperation);
}