diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index a41adc2fc..932f3d8b7 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -922,6 +922,8 @@ namespace MWRender if (stats->collectStats("resource")) { stats->setAttribute(frameNumber, "UnrefQueue", mUnrefQueue->getNumItems()); + + mTerrain->reportStats(frameNumber, stats); } } diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index e2a91749e..bf34d5534 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", "", "Texture", "StateSet", "Node", "Node Instance", "Shape", "Shape Instance", "Image", "Nif", "Keyframe", "Terrain Chunk", "Terrain Texture", "Land", "", "UnrefQueue"}; + const char* statNames[] = {"Compiling", "WorkQueue", "WorkThread", "", "Texture", "StateSet", "Node", "Node Instance", "Shape", "Shape Instance", "Image", "Nif", "Keyframe", "", "Terrain Chunk", "Terrain Texture", "Land", "Composite", "", "UnrefQueue"}; int numLines = sizeof(statNames) / sizeof(statNames[0]); diff --git a/components/terrain/compositemaprenderer.cpp b/components/terrain/compositemaprenderer.cpp index b00dfd2d9..49d72979f 100644 --- a/components/terrain/compositemaprenderer.cpp +++ b/components/terrain/compositemaprenderer.cpp @@ -142,6 +142,12 @@ void CompositeMapRenderer::setImmediate(CompositeMap* compositeMap) } } +unsigned int CompositeMapRenderer::getCompileSetSize() const +{ + OpenThreads::ScopedLock lock(mMutex); + return mCompileSet.size(); +} + CompositeMap::CompositeMap() : mCompiled(0) { diff --git a/components/terrain/compositemaprenderer.hpp b/components/terrain/compositemaprenderer.hpp index f84d2121f..8e53cbdaa 100644 --- a/components/terrain/compositemaprenderer.hpp +++ b/components/terrain/compositemaprenderer.hpp @@ -48,6 +48,8 @@ namespace Terrain /// Mark this composite map to be required for the current frame void setImmediate(CompositeMap* map); + unsigned int getCompileSetSize() const; + private: double mTimeAvailable; diff --git a/components/terrain/quadtreeworld.cpp b/components/terrain/quadtreeworld.cpp index 95252f513..3df49c41c 100644 --- a/components/terrain/quadtreeworld.cpp +++ b/components/terrain/quadtreeworld.cpp @@ -398,5 +398,10 @@ void QuadTreeWorld::preload(View *view, const osg::Vec3f &eyePoint) } } +void QuadTreeWorld::reportStats(unsigned int frameNumber, osg::Stats *stats) +{ + stats->setAttribute(frameNumber, "Composite", mCompositeMapRenderer->getCompileSetSize()); +} + } diff --git a/components/terrain/quadtreeworld.hpp b/components/terrain/quadtreeworld.hpp index edd9779d6..e5ab097b3 100644 --- a/components/terrain/quadtreeworld.hpp +++ b/components/terrain/quadtreeworld.hpp @@ -32,6 +32,8 @@ namespace Terrain void removeView(View* view); void preload(View* view, const osg::Vec3f& eyePoint); + void reportStats(unsigned int frameNumber, osg::Stats* stats); + private: void ensureQuadTreeBuilt(); diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 59c390319..f8613b443 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -90,6 +90,8 @@ namespace Terrain /// @note Thread safe, as long as you do not attempt to load into the same view from multiple threads. virtual void preload(View* view, const osg::Vec3f& eyePoint) {} + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) {} + Storage* getStorage() { return mStorage; } protected: