Made Refernced::setThreadSafeReferenceCounting(bool) a virtual then overrode
this in various scene graph classes to ensure that the scene graph gets updated as well as the objects that the initialial call is made from.
This commit is contained in:
@@ -479,6 +479,20 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
|
||||
|
||||
}
|
||||
|
||||
void Drawable::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
Object::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe);
|
||||
if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe);
|
||||
if (_cullCallback.valid()) _cullCallback->setThreadSafeRefUnref(threadSafe);
|
||||
if (_drawCallback.valid()) _drawCallback->setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_userData.valid()) _userData->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
|
||||
void Drawable::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_stateset.valid()) _stateset->resizeGLObjectBuffers(maxSize);
|
||||
|
||||
@@ -209,6 +209,18 @@ void Geode::compileDrawables(RenderInfo& renderInfo)
|
||||
}
|
||||
}
|
||||
|
||||
void Geode::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
Node::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
for(DrawableList::const_iterator itr=_drawables.begin();
|
||||
itr!=_drawables.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
|
||||
void Geode::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
Node::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
@@ -128,6 +128,7 @@ void GraphicsContext::decrementContextIDUsageCount(unsigned int contextID)
|
||||
GraphicsContext::GraphicsContext():
|
||||
_threadOfLastMakeCurrent(0)
|
||||
{
|
||||
setThreadSafeRefUnref(true);
|
||||
_operationsBlock = new Block;
|
||||
}
|
||||
|
||||
|
||||
@@ -379,6 +379,18 @@ BoundingSphere Group::computeBound() const
|
||||
return bsphere;
|
||||
}
|
||||
|
||||
void Group::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
Node::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
for(NodeList::const_iterator itr=_children.begin();
|
||||
itr!=_children.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
Node::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
@@ -491,6 +491,19 @@ void Node::dirtyBound()
|
||||
}
|
||||
}
|
||||
|
||||
void Node::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
Object::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe);
|
||||
if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe);
|
||||
if (_cullCallback.valid()) _cullCallback->setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
if (_userData.valid()) _userData->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
|
||||
void Node::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_stateset.valid()) _stateset->resizeGLObjectBuffers(maxSize);
|
||||
|
||||
@@ -1983,6 +1983,15 @@ void Program::compileGLObjects( osg::State& state ) const
|
||||
getPCP( contextID )->linkProgram();
|
||||
}
|
||||
|
||||
void Program::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
StateAttribute::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
for( unsigned int i=0; i < _shaderList.size(); ++i )
|
||||
{
|
||||
if (_shaderList[i].valid()) _shaderList[i]->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
|
||||
void Program::dirtyProgram()
|
||||
{
|
||||
|
||||
@@ -1180,6 +1180,30 @@ bool StateSet::checkValidityOfAssociatedModes(osg::State& state) const
|
||||
return modesValid;
|
||||
}
|
||||
|
||||
void StateSet::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
Object::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
for(AttributeList::const_iterator itr = _attributeList.begin();
|
||||
itr!=_attributeList.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
|
||||
for(TextureAttributeList::const_iterator taitr=_textureAttributeList.begin();
|
||||
taitr!=_textureAttributeList.end();
|
||||
++taitr)
|
||||
{
|
||||
for(AttributeList::const_iterator itr = taitr->begin();
|
||||
itr!=taitr->end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StateSet::compileGLObjects(State& state) const
|
||||
{
|
||||
for(AttributeList::const_iterator itr = _attributeList.begin();
|
||||
|
||||
Reference in New Issue
Block a user