forked from teamnwah/openmw-tes3coop
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
|
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.
|
/// Set texture filtering settings on textures contained in a FlipController.
|
||||||
class SetFilterSettingsControllerVisitor : public SceneUtil::ControllerVisitor
|
class SetFilterSettingsControllerVisitor : public SceneUtil::ControllerVisitor
|
||||||
{
|
{
|
||||||
|
@ -195,7 +209,7 @@ namespace Resource
|
||||||
, mAutoUseNormalMaps(false)
|
, mAutoUseNormalMaps(false)
|
||||||
, mAutoUseSpecularMaps(false)
|
, mAutoUseSpecularMaps(false)
|
||||||
, mInstanceCache(new MultiObjectCache)
|
, mInstanceCache(new MultiObjectCache)
|
||||||
, mSharedStateManager(new osgDB::SharedStateManager)
|
, mSharedStateManager(new SharedStateManager)
|
||||||
, mImageManager(imageManager)
|
, mImageManager(imageManager)
|
||||||
, mNifFileManager(nifFileManager)
|
, mNifFileManager(nifFileManager)
|
||||||
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
||||||
|
@ -592,6 +606,12 @@ namespace Resource
|
||||||
stats->setAttribute(frameNumber, "Compiling", mIncrementalCompileOperation->getToCompile().size());
|
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", mCache->getCacheSize());
|
||||||
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace Resource
|
||||||
{
|
{
|
||||||
class ImageManager;
|
class ImageManager;
|
||||||
class NifFileManager;
|
class NifFileManager;
|
||||||
|
class SharedStateManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace osgUtil
|
namespace osgUtil
|
||||||
|
@ -157,7 +158,7 @@ namespace Resource
|
||||||
|
|
||||||
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
||||||
|
|
||||||
osg::ref_ptr<osgDB::SharedStateManager> mSharedStateManager;
|
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
||||||
OpenThreads::Mutex mSharedStateMutex;
|
OpenThreads::Mutex mSharedStateMutex;
|
||||||
|
|
||||||
Resource::ImageManager* mImageManager;
|
Resource::ImageManager* mImageManager;
|
||||||
|
|
|
@ -259,7 +259,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
||||||
_resourceStatsChildNum = _switch->getNumChildren();
|
_resourceStatsChildNum = _switch->getNumChildren();
|
||||||
_switch->addChild(group, false);
|
_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]);
|
int numLines = sizeof(statNames) / sizeof(statNames[0]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue