Added support for reading:

OSG_MINIMUM_COMPILE_TIME_PER_FRAME <float>

and

   OSG_MAXIMUM_OBJECTS_TO_COMPILE_PER_FRAME <int>

environmental variable during the initialization of the DatabasePager
to allow apps to be tweaked for best database pager behavior.
This commit is contained in:
Robert Osfield 2005-05-30 16:15:11 +00:00
parent 84dbb62a5a
commit ac5ffa2bec

View File

@ -5,6 +5,7 @@
#include <osg/Timer>
#include <osg/Texture>
#include <osg/Notify>
#include <osg/ApplicationUsage>
#include <OpenThreads/ScopedLock>
@ -19,6 +20,9 @@
using namespace osgDB;
using namespace OpenThreads;
static osg::ApplicationUsageProxy DatabasePager_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MINIMUM_COMPILE_TIME_PER_FRAME <float>","minimum compile time alloted to compiling GL objects per frame in database pager.");
static osg::ApplicationUsageProxy DatabasePager_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MAXIMUM_OBJECTS_TO_COMPILE_PER_FRAME <int>","maximum number of GL objects to compile per frame in database pager.");
DatabasePager::DatabasePager()
{
//osg::notify(osg::INFO)<<"Constructing DatabasePager()"<<std::endl;
@ -56,6 +60,17 @@ DatabasePager::DatabasePager()
_minimumTimeAvailableForGLCompileAndDeletePerFrame = 0.001; // 1ms.
_maximumNumOfObjectsToCompilePerFrame = 8;
const char* ptr=0;
if( (ptr = getenv("OSG_MINIMUM_COMPILE_TIME_PER_FRAME")) != 0)
{
_minimumTimeAvailableForGLCompileAndDeletePerFrame = atof(ptr);
}
if( (ptr = getenv("OSG_MAXIMUM_OBJECTS_TO_COMPILE_PER_FRAME")) != 0)
{
_maximumNumOfObjectsToCompilePerFrame = atoi(ptr);
}
// make sure a SharedStateManager exists.
//osgDB::Registry::instance()->getOrCreateSharedStateManager();