Added selective support for thread safe ref/unref such that the rendering

backend now doesn't use thread safe ref counting where multi-buffering exists.
This reduces the overhead of multi-threading.
This commit is contained in:
Robert Osfield
2006-05-02 15:52:46 +00:00
parent 67f56dfd77
commit a8c52a90f0
8 changed files with 29 additions and 11 deletions

View File

@@ -62,6 +62,14 @@ Referenced::Referenced():
if (s_useThreadSafeReferenceCounting) _refMutex = new OpenThreads::Mutex;
}
Referenced::Referenced(bool threadSafeRefUnref):
_refMutex(0),
_refCount(0),
_observers(0)
{
if (threadSafeRefUnref) _refMutex = new OpenThreads::Mutex;
}
Referenced::Referenced(const Referenced&):
_refMutex(0),
_refCount(0),

View File

@@ -992,7 +992,7 @@ void CullVisitor::apply(Projection& node)
_computed_zfar = -FLT_MAX;
ref_ptr<osg::RefMatrix> matrix = createOrReuseMatrix(node.getMatrix());
ref_ptr<RefMatrix> matrix = createOrReuseMatrix(node.getMatrix());
pushProjectionMatrix(matrix.get());
//osg::notify(osg::INFO)<<"Push projection "<<*matrix<<std::endl;
@@ -1074,7 +1074,7 @@ void CullVisitor::apply(osg::CameraNode& camera)
setComputeNearFarMode( camera.getComputeNearFarMode());
osg::RefMatrix& originalModelView = getModelViewMatrix();
RefMatrix& originalModelView = getModelViewMatrix();
if (camera.getReferenceFrame()==osg::Transform::ABSOLUTE_RF)
{