forked from mirror/openmw-tes3mp
Add SharedStateManager to the stats panel
This commit is contained in:
parent
732212070d
commit
d75a3fd0fb
3 changed files with 24 additions and 3 deletions
|
@ -105,6 +105,20 @@ namespace
|
|||
namespace Resource
|
||||
{
|
||||
|
||||
class SharedStateManager : public osgDB::SharedStateManager
|
||||
{
|
||||
public:
|
||||
unsigned int getNumSharedTextures() const
|
||||
{
|
||||
return _sharedTextureList.size();
|
||||
}
|
||||
|
||||
unsigned int getNumSharedStateSets() const
|
||||
{
|
||||
return _sharedStateSetList.size();
|
||||
}
|
||||
};
|
||||
|
||||
/// Set texture filtering settings on textures contained in a FlipController.
|
||||
class SetFilterSettingsControllerVisitor : public SceneUtil::ControllerVisitor
|
||||
{
|
||||
|
@ -195,7 +209,7 @@ namespace Resource
|
|||
, mAutoUseNormalMaps(false)
|
||||
, mAutoUseSpecularMaps(false)
|
||||
, mInstanceCache(new MultiObjectCache)
|
||||
, mSharedStateManager(new osgDB::SharedStateManager)
|
||||
, mSharedStateManager(new SharedStateManager)
|
||||
, mImageManager(imageManager)
|
||||
, mNifFileManager(nifFileManager)
|
||||
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
||||
|
@ -592,6 +606,12 @@ namespace Resource
|
|||
stats->setAttribute(frameNumber, "Compiling", mIncrementalCompileOperation->getToCompile().size());
|
||||
}
|
||||
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mSharedStateMutex);
|
||||
stats->setAttribute(frameNumber, "Texture", mSharedStateManager->getNumSharedTextures());
|
||||
stats->setAttribute(frameNumber, "StateSet", mSharedStateManager->getNumSharedStateSets());
|
||||
}
|
||||
|
||||
stats->setAttribute(frameNumber, "Node", mCache->getCacheSize());
|
||||
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Resource
|
|||
{
|
||||
class ImageManager;
|
||||
class NifFileManager;
|
||||
class SharedStateManager;
|
||||
}
|
||||
|
||||
namespace osgUtil
|
||||
|
@ -157,7 +158,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
||||
|
||||
osg::ref_ptr<osgDB::SharedStateManager> mSharedStateManager;
|
||||
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
||||
OpenThreads::Mutex mSharedStateMutex;
|
||||
|
||||
Resource::ImageManager* mImageManager;
|
||||
|
|
|
@ -259,7 +259,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|||
_resourceStatsChildNum = _switch->getNumChildren();
|
||||
_switch->addChild(group, false);
|
||||
|
||||
const char* statNames[] = {"Compiling", "WorkQueue", "WorkThread", "", "Node", "Node Instance", "Shape", "Shape Instance", "Image", "Nif", "Keyframe", "Terrain Cell", "Terrain Texture", "", "UnrefQueue"};
|
||||
const char* statNames[] = {"Compiling", "WorkQueue", "WorkThread", "", "Texture", "StateSet", "Node", "Node Instance", "Shape", "Shape Instance", "Image", "Nif", "Keyframe", "Terrain Cell", "Terrain Texture", "", "UnrefQueue"};
|
||||
|
||||
int numLines = sizeof(statNames) / sizeof(statNames[0]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue