Aded option for doing a glFlush() after compiling texture objects, with a dedicated compile thread default to issuing the glFlush.

This commit is contained in:
Robert Osfield 2010-08-09 16:19:50 +00:00
parent acbaf3962c
commit b1aedf30e0
2 changed files with 11 additions and 6 deletions

View File

@ -305,12 +305,12 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
/** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph.
* note, should only be called from the draw thread.
* Note, must only be called from a valid graphics context. */
virtual void compileGLObjects(osg::State& state,double& availableTime);
virtual void compileGLObjects(osg::State& state,double& availableTime, bool doFlush = false);
/** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph.
* note, should only be called from the draw thread.
* Note, must only be called from a valid graphics context. */
virtual void compileAllGLObjects(osg::State& state);
virtual void compileAllGLObjects(osg::State& state, bool doFlush = false);
/** Report how many items are in the _fileRequestList queue */
unsigned int getFileRequestListSize() const { return _fileRequestQueue->size() + _httpRequestQueue->size(); }

View File

@ -2026,7 +2026,7 @@ void DatabasePager::CompileOperation::operator () (osg::GraphicsContext* context
{
// OSG_NOTICE<<"Background thread compiling"<<std::endl;
if (_databasePager.valid()) _databasePager->compileAllGLObjects(*(context->getState()));
if (_databasePager.valid()) _databasePager->compileAllGLObjects(*(context->getState()), true);
}
@ -2037,13 +2037,13 @@ bool DatabasePager::requiresExternalCompileGLObjects(unsigned int contextID) con
return osg::GraphicsContext::getCompileContext(contextID)==0;
}
void DatabasePager::compileAllGLObjects(osg::State& state)
void DatabasePager::compileAllGLObjects(osg::State& state, bool doFlush)
{
double availableTime = DBL_MAX;
compileGLObjects(state, availableTime);
compileGLObjects(state, availableTime, doFlush);
}
void DatabasePager::compileGLObjects(osg::State& state, double& availableTime)
void DatabasePager::compileGLObjects(osg::State& state, double& availableTime, bool doFlush)
{
// OSG_NOTICE<<"DatabasePager::compileGLObjects "<<_frameNumber<<std::endl;
@ -2180,6 +2180,11 @@ void DatabasePager::compileGLObjects(osg::State& state, double& availableTime)
if (allCompiled)
{
if (doFlush)
{
glFlush();
}
// we've compiled all of the current databaseRequest so we can now pop it off the
// to compile list and place it on the merge list.
OSG_INFO<<"All compiled"<<std::endl;