Introduced new GLBufferObject pool for managing the memory footprint taken up by VertexBufferObejct, ElementBufferObject and PixelBufferObject.

This commit is contained in:
Robert Osfield
2009-10-03 09:25:23 +00:00
parent f75013d534
commit 32b21dbb89
16 changed files with 1455 additions and 532 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -82,8 +82,7 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
_application = vs._application;
_maxTexturePoolSize = vs._maxTexturePoolSize;
_maxVBOPoolSize = vs._maxVBOPoolSize;
_maxFBOPoolSize = vs._maxFBOPoolSize;
_maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize;
}
void DisplaySettings::merge(const DisplaySettings& vs)
@@ -109,8 +108,7 @@ void DisplaySettings::merge(const DisplaySettings& vs)
if (_application.empty()) _application = vs._application;
if (vs._maxTexturePoolSize>_maxTexturePoolSize) _maxTexturePoolSize = vs._maxTexturePoolSize;
if (vs._maxVBOPoolSize>_maxVBOPoolSize) _maxVBOPoolSize = vs._maxVBOPoolSize;
if (vs._maxFBOPoolSize>_maxFBOPoolSize) _maxFBOPoolSize = vs._maxFBOPoolSize;
if (vs._maxBufferObjectPoolSize>_maxBufferObjectPoolSize) _maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize;
}
void DisplaySettings::setDefaults()
@@ -157,8 +155,7 @@ void DisplaySettings::setDefaults()
_numHttpDatabaseThreadsHint = 1;
_maxTexturePoolSize = 0;
_maxVBOPoolSize = 0;
_maxFBOPoolSize = 0;
_maxBufferObjectPoolSize = 0;
}
void DisplaySettings::setMaxNumberOfGraphicsContexts(unsigned int num)
@@ -199,7 +196,7 @@ static ApplicationUsageProxy DisplaySetting_e15(ApplicationUsage::ENVIRONMENTAL_
static ApplicationUsageProxy DisplaySetting_e16(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_NUM_HTTP_DATABASE_THREADS <int>","Set the hint for the total number of threads dedicated to http requests to set up in the DatabasePager.");
static ApplicationUsageProxy DisplaySetting_e17(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MULTI_SAMPLES <int>","Set the hint for the number of samples to use when multi-sampling.");
static ApplicationUsageProxy DisplaySetting_e18(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_TEXTURE_POOL_SIZE <int>","Set the hint size of texture pool to manage.");
static ApplicationUsageProxy DisplaySetting_e19(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_VBO_POOL_SIZE <int>","Set the hint size of vertex buffer object pool to manage.");
static ApplicationUsageProxy DisplaySetting_e19(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_BUFFER_OBJECT_POOL_SIZE <int>","Set the hint size of vertex buffer object pool to manage.");
static ApplicationUsageProxy DisplaySetting_e20(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_FBO_POOL_SIZE <int>","Set the hint size of frame buffer object pool to manage.");
void DisplaySettings::readEnvironmentalVariables()
@@ -403,14 +400,9 @@ void DisplaySettings::readEnvironmentalVariables()
_maxTexturePoolSize = atoi(ptr);
}
if( (ptr = getenv("OSG_VBO_POOL_SIZE")) != 0)
if( (ptr = getenv("OSG_BUFFER_OBJECT_POOL_SIZE")) != 0)
{
_maxVBOPoolSize = atoi(ptr);
}
if( (ptr = getenv("OSG_FBO_POOL_SIZE")) != 0)
{
_maxFBOPoolSize = atoi(ptr);
_maxBufferObjectPoolSize = atoi(ptr);
}
}
@@ -500,8 +492,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
while(arguments.read("--num-http-threads",_numHttpDatabaseThreadsHint)) {}
while(arguments.read("--texture-pool-size",_maxTexturePoolSize)) {}
while(arguments.read("--vbo-pool-size",_maxVBOPoolSize)) {}
while(arguments.read("--fbo-pool-size",_maxFBOPoolSize)) {}
while(arguments.read("--buffer-object-pool-size",_maxBufferObjectPoolSize)) {}
}

View File

@@ -53,7 +53,7 @@ void osg::flushAllDeletedGLObjects(unsigned int contextID)
void osg::discardAllDeletedGLObjects(unsigned int contextID)
{
osg::GLBufferObject::discardDeletedBufferObjects(contextID);
osg::GLBufferObject::discardAllDeletedBufferObjects(contextID);
osg::Drawable::discardAllDeletedDisplayLists(contextID);
osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID);
osg::FrameBufferObject::discardDeletedFrameBufferObjects(contextID);

View File

@@ -89,8 +89,7 @@ State::State():
_glMaxTextureUnits = 1;
_maxTexturePoolSize = 0;
_maxVBOPoolSize = 0;
_maxFBOPoolSize = 0;
_maxBufferObjectPoolSize = 0;
}
State::~State()
@@ -232,16 +231,11 @@ void State::setMaxTexturePoolSize(unsigned int size)
osg::notify(osg::NOTICE)<<"_maxTexturePoolSize="<<_maxTexturePoolSize<<std::endl;
}
void State::setMaxVBOPoolSize(unsigned int size)
void State::setMaxBufferObjectPoolSize(unsigned int size)
{
_maxVBOPoolSize = size;
osg::notify(osg::NOTICE)<<"_maxVBOPoolSize="<<_maxVBOPoolSize<<std::endl;
}
void State::setMaxFBOPoolSize(unsigned int size)
{
_maxFBOPoolSize = size;
osg::notify(osg::NOTICE)<<"_maxFBOPoolSize="<<_maxFBOPoolSize<<std::endl;
_maxBufferObjectPoolSize = size;
osg::GLBufferObjectManager::getGLBufferObjectManager(getContextID())->setMaxGLBufferObjectPoolSize(_maxBufferObjectPoolSize);
osg::notify(osg::NOTICE)<<"_maxBufferObjectPoolSize="<<_maxBufferObjectPoolSize<<std::endl;
}
void State::pushStateSet(const StateSet* dstate)

View File

@@ -175,7 +175,7 @@ Texture::TextureObjectSet::~TextureObjectSet()
bool Texture::TextureObjectSet::checkConsistency() const
{
return true;
// return true;
// osg::notify(osg::NOTICE)<<"TextureObjectSet::checkConsistency()"<<std::endl;
// check consistency of linked list.
@@ -265,7 +265,7 @@ void Texture::TextureObjectSet::flushAllDeletedTextureObjects()
GLuint id = (*itr)->id();
// osg::notify(osg::NOTICE)<<"Deleting textureobject id="<<id<<std::endl;
osg::notify(osg::NOTICE)<<"Deleting textureobject id="<<id<<std::endl;
glDeleteTextures( 1L, &id);
}
@@ -327,7 +327,7 @@ void Texture::TextureObjectSet::flushDeletedTextureObjects(double currentTime, d
GLuint id = (*itr)->id();
// osg::notify(osg::NOTICE)<<"Deleting textureobject id="<<id<<std::endl;
osg::notify(osg::NOTICE)<<"Deleting textureobject id="<<id<<std::endl;
glDeleteTextures( 1L, &id);