From Jannik Heller, fix for race condition in orphanded BufferObject handling.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14877 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
4f423ff66b
commit
f72b62a065
@ -221,7 +221,7 @@ class OSG_EXPORT GLBufferObject : public Referenced
|
|||||||
|
|
||||||
bool isPBOSupported() const { return _extensions->isPBOSupported; }
|
bool isPBOSupported() const { return _extensions->isPBOSupported; }
|
||||||
|
|
||||||
static GLBufferObject* createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject);
|
static osg::ref_ptr<GLBufferObject> createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject);
|
||||||
|
|
||||||
static void deleteAllBufferObjects(unsigned int contextID);
|
static void deleteAllBufferObjects(unsigned int contextID);
|
||||||
static void discardAllBufferObjects(unsigned int contextID);
|
static void discardAllBufferObjects(unsigned int contextID);
|
||||||
@ -287,8 +287,8 @@ class OSG_EXPORT GLBufferObjectSet : public Referenced
|
|||||||
void discardAllDeletedGLBufferObjects();
|
void discardAllDeletedGLBufferObjects();
|
||||||
void flushDeletedGLBufferObjects(double currentTime, double& availableTime);
|
void flushDeletedGLBufferObjects(double currentTime, double& availableTime);
|
||||||
|
|
||||||
GLBufferObject* takeFromOrphans(BufferObject* bufferObject);
|
osg::ref_ptr<GLBufferObject> takeFromOrphans(BufferObject* bufferObject);
|
||||||
GLBufferObject* takeOrGenerate(BufferObject* bufferObject);
|
osg::ref_ptr<GLBufferObject> takeOrGenerate(BufferObject* bufferObject);
|
||||||
|
|
||||||
void moveToBack(GLBufferObject* to);
|
void moveToBack(GLBufferObject* to);
|
||||||
void addToBack(GLBufferObject* to);
|
void addToBack(GLBufferObject* to);
|
||||||
@ -353,7 +353,7 @@ class OSG_EXPORT GLBufferObjectManager : public osg::Referenced
|
|||||||
bool hasSpace(unsigned int size) const { return (_currGLBufferObjectPoolSize+size)<=_maxGLBufferObjectPoolSize; }
|
bool hasSpace(unsigned int size) const { return (_currGLBufferObjectPoolSize+size)<=_maxGLBufferObjectPoolSize; }
|
||||||
bool makeSpace(unsigned int size);
|
bool makeSpace(unsigned int size);
|
||||||
|
|
||||||
GLBufferObject* generateGLBufferObject(const osg::BufferObject* bufferObject);
|
osg::ref_ptr<GLBufferObject> generateGLBufferObject(const osg::BufferObject* bufferObject);
|
||||||
|
|
||||||
void handlePendingOrphandedGLBufferObjects();
|
void handlePendingOrphandedGLBufferObjects();
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ bool GLBufferObjectSet::makeSpace(unsigned int& size)
|
|||||||
return size==0;
|
return size==0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject)
|
osg::ref_ptr<GLBufferObject> GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject)
|
||||||
{
|
{
|
||||||
// take front of orphaned list.
|
// take front of orphaned list.
|
||||||
ref_ptr<GLBufferObject> glbo = _orphanedGLBufferObjects.front();
|
ref_ptr<GLBufferObject> glbo = _orphanedGLBufferObjects.front();
|
||||||
@ -604,11 +604,11 @@ GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject)
|
|||||||
|
|
||||||
//OSG_NOTICE<<"Reusing orphaned GLBufferObject, _numOfGLBufferObjects="<<_numOfGLBufferObjects<<" target="<<std::hex<<_profile._target<<std::dec<<std::endl;
|
//OSG_NOTICE<<"Reusing orphaned GLBufferObject, _numOfGLBufferObjects="<<_numOfGLBufferObjects<<" target="<<std::hex<<_profile._target<<std::dec<<std::endl;
|
||||||
|
|
||||||
return glbo.release();
|
return glbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLBufferObject* GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject)
|
osg::ref_ptr<GLBufferObject> GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject)
|
||||||
{
|
{
|
||||||
// see if we can recyle GLBufferObject from the orphan list
|
// see if we can recyle GLBufferObject from the orphan list
|
||||||
{
|
{
|
||||||
@ -657,7 +657,7 @@ GLBufferObject* GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject)
|
|||||||
glbo->setBufferObject(bufferObject);
|
glbo->setBufferObject(bufferObject);
|
||||||
glbo->setProfile(_profile);
|
glbo->setProfile(_profile);
|
||||||
|
|
||||||
return glbo.release();
|
return glbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -885,7 +885,7 @@ bool GLBufferObjectManager::makeSpace(unsigned int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLBufferObject* GLBufferObjectManager::generateGLBufferObject(const BufferObject* bufferObject)
|
osg::ref_ptr<GLBufferObject> GLBufferObjectManager::generateGLBufferObject(const BufferObject* bufferObject)
|
||||||
{
|
{
|
||||||
ElapsedTime elapsedTime(&(getGenerateTime()));
|
ElapsedTime elapsedTime(&(getGenerateTime()));
|
||||||
++getNumberGenerated();
|
++getNumberGenerated();
|
||||||
@ -1051,7 +1051,7 @@ osg::ref_ptr<GLBufferObjectManager>& GLBufferObjectManager::getGLBufferObjectMan
|
|||||||
return s_GLBufferObjectManager[contextID];
|
return s_GLBufferObjectManager[contextID];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLBufferObject* GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject)
|
osg::ref_ptr<GLBufferObject> GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject)
|
||||||
{
|
{
|
||||||
return GLBufferObjectManager::getGLBufferObjectManager(contextID)->generateGLBufferObject(bufferObject);
|
return GLBufferObjectManager::getGLBufferObjectManager(contextID)->generateGLBufferObject(bufferObject);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user