diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 070882bb8..cc23469e1 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -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 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()); } diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 42da9b848..5d54ccb1c 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -15,6 +15,7 @@ namespace Resource { class ImageManager; class NifFileManager; + class SharedStateManager; } namespace osgUtil @@ -157,7 +158,7 @@ namespace Resource osg::ref_ptr mInstanceCache; - osg::ref_ptr mSharedStateManager; + osg::ref_ptr mSharedStateManager; OpenThreads::Mutex mSharedStateMutex; Resource::ImageManager* mImageManager; diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index 5b0f8b935..d696c9ecc 100644 --- a/components/resource/stats.cpp +++ b/components/resource/stats.cpp @@ -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]);