Preliminary work on support for a texture object pool that is designed to help manage resources down the GPU more tightly.

This commit is contained in:
Robert Osfield
2009-09-22 18:45:24 +00:00
parent 26925be4f4
commit 3d75054e2c
21 changed files with 1616 additions and 566 deletions

View File

@@ -80,6 +80,10 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
_numHttpDatabaseThreadsHint = vs._numHttpDatabaseThreadsHint;
_application = vs._application;
_maxTexturePoolSize = vs._maxTexturePoolSize;
_maxVBOPoolSize = vs._maxVBOPoolSize;
_maxFBOPoolSize = vs._maxFBOPoolSize;
}
void DisplaySettings::merge(const DisplaySettings& vs)
@@ -103,6 +107,10 @@ void DisplaySettings::merge(const DisplaySettings& vs)
if (vs._numHttpDatabaseThreadsHint>_numHttpDatabaseThreadsHint) _numHttpDatabaseThreadsHint = vs._numHttpDatabaseThreadsHint;
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;
}
void DisplaySettings::setDefaults()
@@ -147,6 +155,10 @@ void DisplaySettings::setDefaults()
_numDatabaseThreadsHint = 2;
_numHttpDatabaseThreadsHint = 1;
_maxTexturePoolSize = 0;
_maxVBOPoolSize = 0;
_maxFBOPoolSize = 0;
}
void DisplaySettings::setMaxNumberOfGraphicsContexts(unsigned int num)
@@ -186,6 +198,9 @@ static ApplicationUsageProxy DisplaySetting_e14(ApplicationUsage::ENVIRONMENTAL_
static ApplicationUsageProxy DisplaySetting_e15(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_NUM_DATABASE_THREADS <int>","Set the hint for the total number of threads to set up in the DatabasePager.");
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_e20(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_FBO_POOL_SIZE <int>","Set the hint size of frame buffer object pool to manage.");
void DisplaySettings::readEnvironmentalVariables()
{
@@ -382,6 +397,21 @@ void DisplaySettings::readEnvironmentalVariables()
{
_numMultiSamples = atoi(ptr);
}
if( (ptr = getenv("OSG_TEXTURE_POOL_SIZE")) != 0)
{
_maxTexturePoolSize = atoi(ptr);
}
if( (ptr = getenv("OSG_VBO_POOL_SIZE")) != 0)
{
_maxVBOPoolSize = atoi(ptr);
}
if( (ptr = getenv("OSG_FBO_POOL_SIZE")) != 0)
{
_maxFBOPoolSize = atoi(ptr);
}
}
void DisplaySettings::readCommandLine(ArgumentParser& arguments)
@@ -468,4 +498,12 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
while(arguments.read("--num-db-threads",_numDatabaseThreadsHint)) {}
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)) {}
}