Do not block the loading thread while compiling composite maps in the

draw thread
pull/541/head
bzzt 6 years ago committed by Andrei Kortunov
parent 7ccfec4d21
commit c2986b3bd7

@ -59,26 +59,29 @@ void CompositeMapRenderer::drawImplementation(osg::RenderInfo &renderInfo) const
while (!mImmediateCompileSet.empty())
{
CompositeMap* node = *mImmediateCompileSet.begin();
osg::ref_ptr<CompositeMap> node = *mImmediateCompileSet.begin();
mCompiled.insert(node);
mImmediateCompileSet.erase(node);
mMutex.unlock();
compile(*node, renderInfo, nullptr);
mImmediateCompileSet.erase(mImmediateCompileSet.begin());
mMutex.lock();
}
double timeLeft = availableTime;
while (!mCompileSet.empty() && timeLeft > 0)
{
CompositeMap* node = *mCompileSet.begin();
osg::ref_ptr<CompositeMap> node = *mCompileSet.begin();
mMutex.unlock();
compile(*node, renderInfo, &timeLeft);
mMutex.lock();
if (node->mCompiled >= node->mDrawables.size())
{
mCompiled.insert(node);
mCompileSet.erase(mCompileSet.begin());
mCompileSet.erase(node);
}
}
mTimer.setStartTick();

Loading…
Cancel
Save