Implementated experimental reuse of PBO's after download

This commit is contained in:
Robert Osfield
2011-02-07 14:19:58 +00:00
parent e0924886bd
commit 4b4754c3cf
5 changed files with 49 additions and 7 deletions

View File

@@ -741,7 +741,7 @@ GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject)
// place at back of active list
addToBack(glbo.get());
OSG_INFO<<"Reusing orphaned GLBufferObject, _numOfGLBufferObjects="<<_numOfGLBufferObjects<<std::endl;
//OSG_NOTICE<<"Reusing orphaned GLBufferObject, _numOfGLBufferObjects="<<_numOfGLBufferObjects<<" target="<<std::hex<<_profile._target<<std::dec<<std::endl;
return glbo.release();
}
@@ -1231,12 +1231,14 @@ void GLBufferObject::releaseGLBufferObject(unsigned int contextID, GLBufferObjec
//
// BufferObject
//
BufferObject::BufferObject()
BufferObject::BufferObject():
_copyDataAndReleaseGLBufferObject(false)
{
}
BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
Object(bo,copyop)
Object(bo,copyop),
_copyDataAndReleaseGLBufferObject(bo._copyDataAndReleaseGLBufferObject)
{
}

View File

@@ -1958,6 +1958,13 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
if (pbo)
{
state.unbindPixelBufferObject();
BufferObject* bo = image->getBufferObject();
if (bo->getCopyDataAndReleaseGLBufferObject())
{
//OSG_NOTICE<<"Release PBO"<<std::endl;
bo->releaseGLObjects(&state);
}
}
#ifdef DO_TIMING