mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
ico redundency fix + stats counter
Signed-off-by: Bret Curtis <psi29a@gmail.com>
This commit is contained in:
parent
1f891ca46d
commit
69514dfd46
4 changed files with 22 additions and 5 deletions
|
@ -463,14 +463,17 @@ namespace MWRender
|
|||
group->addChild(mergeGroup);
|
||||
|
||||
auto ico = mSceneManager->getIncrementalCompileOperation();
|
||||
if (compile && ico) ico->add(mergeGroup);
|
||||
if (compile && ico)
|
||||
{
|
||||
auto compileSet = new osgUtil::IncrementalCompileOperation::CompileSet(mergeGroup);
|
||||
ico->add(compileSet);
|
||||
compileSet->_subgraphToCompile = group; // for ref counting in SceneManager::updateCache
|
||||
}
|
||||
}
|
||||
|
||||
group->getBound();
|
||||
group->setNodeMask(Mask_Static);
|
||||
osg::UserDataContainer* udc = group->getOrCreateUserDataContainer();
|
||||
udc->addUserObject(templateRefs);
|
||||
udc->addUserObject(mergeGroup); // for ICO ref counting
|
||||
group->getOrCreateUserDataContainer()->addUserObject(templateRefs);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
@ -492,4 +495,10 @@ namespace MWRender
|
|||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mDisabledMutex);
|
||||
mDisabled.clear();
|
||||
}
|
||||
|
||||
void ObjectPaging::reportStats(unsigned int frameNumber, osg::Stats *stats) const
|
||||
{
|
||||
stats->setAttribute(frameNumber, "Object Chunk", mCache->getCacheSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace MWRender
|
|||
void enableObject(const ESM::RefNum & refnum, bool enabled);
|
||||
void clear();
|
||||
|
||||
void reportStats(unsigned int frameNumber, osg::Stats* stats) const override;
|
||||
|
||||
private:
|
||||
Resource::SceneManager* mSceneManager;
|
||||
float mMergeFactor;
|
||||
|
|
|
@ -720,8 +720,13 @@ namespace Resource
|
|||
osgUtil::IncrementalCompileOperation::CompileSets& sets = mIncrementalCompileOperation->getToCompile();
|
||||
for(osgUtil::IncrementalCompileOperation::CompileSets::iterator it = sets.begin(); it != sets.end();)
|
||||
{
|
||||
if ((*it)->_subgraphToCompile->referenceCount() <= 2)
|
||||
int refcount = (*it)->_subgraphToCompile->referenceCount();
|
||||
if ((*it)->_subgraphToCompile->asDrawable()) refcount -= 1; // ref by CompileList.
|
||||
if (refcount <= 2) // ref by ObjectCache + ref by _subgraphToCompile.
|
||||
{
|
||||
// no other ref = not needed anymore.
|
||||
it = sets.erase(it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
|
|
@ -292,6 +292,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|||
"Nif",
|
||||
"Keyframe",
|
||||
"",
|
||||
"Object Chunk",
|
||||
"Terrain Chunk",
|
||||
"Terrain Texture",
|
||||
"Land",
|
||||
|
|
Loading…
Reference in a new issue