diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 5856c2bf9..d0e6c558f 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -216,6 +216,13 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl DrawablePolicy getDrawablePolicy() const { return _drawablePolicy; } + /** Set whether newly loaded textures should have a PixelBufferObject assigned to them to aid download to the GPU.*/ + void setApplyPBOToImages(bool assignPBOToImages) { _assignPBOToImages = assignPBOToImages; } + + /** Get whether newly loaded textures should have a PixelBufferObject assigned to them..*/ + bool getApplyPBOToImages() const { return _assignPBOToImages; } + + /** Set whether newly loaded textures should have their UnrefImageDataAfterApply set to a specified value.*/ void setUnrefImageDataAfterApplyPolicy(bool changeAutoUnRef, bool valueAutoUnRef) { _changeAutoUnRef = changeAutoUnRef; _valueAutoUnRef = valueAutoUnRef; } @@ -439,6 +446,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl DrawablePolicy _drawablePolicy; + bool _assignPBOToImages; bool _changeAutoUnRef; bool _valueAutoUnRef; bool _changeAnisotropy; diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 77f35b89e..5733e2d7b 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -47,6 +47,7 @@ static osg::ApplicationUsageProxy DatabasePager_e0(osg::ApplicationUsage::ENVIRO static osg::ApplicationUsageProxy DatabasePager_e3(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_DATABASE_PAGER_DRAWABLE ","Set the drawable policy for setting of loaded drawable to specified type. mode can be one of DoNotModify, DisplayList, VBO or VertexArrays>."); static osg::ApplicationUsageProxy DatabasePager_e4(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_DATABASE_PAGER_PRIORITY ", "Set the thread priority to DEFAULT, MIN, LOW, NOMINAL, HIGH or MAX."); static osg::ApplicationUsageProxy DatabasePager_e11(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MAX_PAGEDLOD ","Set the target maximum number of PagedLOD to maintain."); +static osg::ApplicationUsageProxy DatabasePager_e12(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_ASSIGN_PBO_TO_IMAGES ","Set whether PixelBufferObjects should be assigned to Images to aid download to the GPU."); // Convert function objects that take pointer args into functions that a // reference to an osg::ref_ptr. This is quite useful for doing STL @@ -297,6 +298,8 @@ public: _changeAutoUnRef(false), _valueAutoUnRef(false), _changeAnisotropy(false), _valueAnisotropy(1.0) { + _assignPBOToImages = _pager->_assignPBOToImages; + _changeAutoUnRef = _pager->_changeAutoUnRef; _valueAutoUnRef = _pager->_valueAutoUnRef; _changeAnisotropy = _pager->_changeAnisotropy; @@ -988,35 +991,43 @@ DatabasePager::DatabasePager() } } + _assignPBOToImages = false; + if( (str = getenv("OSG_ASSIGN_PBO_TO_IMAGES")) != 0) + { + _assignPBOToImages = strcmp(str,"yes")==0 || strcmp(str,"YES")==0 || + strcmp(str,"on")==0 || strcmp(str,"ON")==0; + + OSG_NOTICE<<"OSG_ASSIGN_PBO_TO_IMAGES set to "<<_assignPBOToImages<