From Tim Moore, "I noticed that the "Materials" statistic in the camera scene stats display seemed to be identical to the number of drawables. In fact, it displays the nummat member of osgUtil::Statistics, but that variable has nothing to do with materials. nummat tracks the number of matrices associated with Drawable objects in a RenderBin; as I understand it, Drawables pretty much always have a model-view matrix tied to them in RenderBins, so this statistic doesn't seem very useful. So, I added statistics for the number of StateGraph objects in RenderBins and also for the number of Drawables in the "fine grain ordering" of RenderBins. The latter corresponds to the number of Drawables in the scene that are sorted by some criteria other than graphics state; usually that is distance for semi-transparent objects, though it could be traversal order. These two statistics give an idea of the number of graphic state changes happening in a visible scene: each StateGraph implies a state change, and there could be a change for each sorted object too. You can also subtract the number of sorted Drawables from the total number of Drawables and get an idea of how many Drawables are being drawn for each StateGraph.
"
This commit is contained in:
parent
92a6b0020d
commit
7c38643a77
@ -110,6 +110,8 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor
|
|||||||
void addBins(int np) { nbins+= np; }
|
void addBins(int np) { nbins+= np; }
|
||||||
|
|
||||||
void setBinNo(int n) { _binNo=n;}
|
void setBinNo(int n) { _binNo=n;}
|
||||||
|
void addStateGraphs(int n) { numStateGraphs += n; }
|
||||||
|
void addOrderedLeaves(int n) { numOrderedLeaves += n; }
|
||||||
|
|
||||||
void add(const Statistics& stats);
|
void add(const Statistics& stats);
|
||||||
|
|
||||||
@ -123,12 +125,13 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor
|
|||||||
/// deprecated
|
/// deprecated
|
||||||
PrimitiveCountMap::iterator GetPrimitivesEnd() { return _primitives_count.end(); }
|
PrimitiveCountMap::iterator GetPrimitivesEnd() { return _primitives_count.end(); }
|
||||||
|
|
||||||
int numDrawables, nummat, nbins;
|
int numDrawables, nummat, nbins, numStateGraphs;
|
||||||
int nlights;
|
int nlights;
|
||||||
int depth; // depth into bins - eg 1.1,1.2,1.3 etc
|
int depth; // depth into bins - eg 1.1,1.2,1.3 etc
|
||||||
int _binNo;
|
int _binNo;
|
||||||
StatsType stattype;
|
StatsType stattype;
|
||||||
int nimpostor; // number of impostors rendered
|
int nimpostor; // number of impostors rendered
|
||||||
|
int numOrderedLeaves; // leaves from RenderBin fine grain ordering
|
||||||
|
|
||||||
unsigned int _vertexCount;
|
unsigned int _vertexCount;
|
||||||
PrimitiveValueMap _primitiveCount;
|
PrimitiveValueMap _primitiveCount;
|
||||||
|
@ -522,7 +522,7 @@ bool RenderBin::getStats(Statistics& stats) const
|
|||||||
|
|
||||||
// different by return type - collects the stats in this renderrBin
|
// different by return type - collects the stats in this renderrBin
|
||||||
bool statsCollected = false;
|
bool statsCollected = false;
|
||||||
|
stats.addOrderedLeaves(_renderLeafList.size());
|
||||||
// draw fine grained ordering.
|
// draw fine grained ordering.
|
||||||
for(RenderLeafList::const_iterator dw_itr = _renderLeafList.begin();
|
for(RenderLeafList::const_iterator dw_itr = _renderLeafList.begin();
|
||||||
dw_itr != _renderLeafList.end();
|
dw_itr != _renderLeafList.end();
|
||||||
@ -543,7 +543,7 @@ bool RenderBin::getStats(Statistics& stats) const
|
|||||||
}
|
}
|
||||||
statsCollected = true;
|
statsCollected = true;
|
||||||
}
|
}
|
||||||
|
stats.addStateGraphs(_stateGraphList.size());
|
||||||
for(StateGraphList::const_iterator oitr=_stateGraphList.begin();
|
for(StateGraphList::const_iterator oitr=_stateGraphList.begin();
|
||||||
oitr!=_stateGraphList.end();
|
oitr!=_stateGraphList.end();
|
||||||
++oitr)
|
++oitr)
|
||||||
|
@ -43,6 +43,8 @@ void Statistics::reset()
|
|||||||
nlights=0;
|
nlights=0;
|
||||||
nbins=0;
|
nbins=0;
|
||||||
nimpostor=0;
|
nimpostor=0;
|
||||||
|
numStateGraphs=0;
|
||||||
|
numOrderedLeaves=0;
|
||||||
|
|
||||||
_vertexCount=0;
|
_vertexCount=0;
|
||||||
_primitiveCount.clear();
|
_primitiveCount.clear();
|
||||||
@ -111,6 +113,8 @@ void Statistics::add(const Statistics& stats)
|
|||||||
nlights += stats.nlights;
|
nlights += stats.nlights;
|
||||||
nbins += stats.nbins;
|
nbins += stats.nbins;
|
||||||
nimpostor += stats.nimpostor;
|
nimpostor += stats.nimpostor;
|
||||||
|
numStateGraphs += stats.numStateGraphs;
|
||||||
|
numOrderedLeaves += stats.numOrderedLeaves;
|
||||||
|
|
||||||
_vertexCount += stats._vertexCount;
|
_vertexCount += stats._vertexCount;
|
||||||
// _primitiveCount += stats._primitiveCount;
|
// _primitiveCount += stats._primitiveCount;
|
||||||
|
@ -380,8 +380,9 @@ void Renderer::cull()
|
|||||||
stats->setAttribute(frameNumber, "Visible number of lights", static_cast<double>(sceneStats.nlights));
|
stats->setAttribute(frameNumber, "Visible number of lights", static_cast<double>(sceneStats.nlights));
|
||||||
stats->setAttribute(frameNumber, "Visible number of render bins", static_cast<double>(sceneStats.nbins));
|
stats->setAttribute(frameNumber, "Visible number of render bins", static_cast<double>(sceneStats.nbins));
|
||||||
stats->setAttribute(frameNumber, "Visible depth", static_cast<double>(sceneStats.depth));
|
stats->setAttribute(frameNumber, "Visible depth", static_cast<double>(sceneStats.depth));
|
||||||
stats->setAttribute(frameNumber, "Visible number of materials", static_cast<double>(sceneStats.nummat));
|
stats->setAttribute(frameNumber, "Number of StateGraphs", static_cast<double>(sceneStats.numStateGraphs));
|
||||||
stats->setAttribute(frameNumber, "Visible number of impostors", static_cast<double>(sceneStats.nimpostor));
|
stats->setAttribute(frameNumber, "Visible number of impostors", static_cast<double>(sceneStats.nimpostor));
|
||||||
|
stats->setAttribute(frameNumber, "Number of ordered leaves", static_cast<double>(sceneStats.numOrderedLeaves));
|
||||||
|
|
||||||
osgUtil::Statistics::PrimitiveCountMap& pcm = sceneStats.getPrimitiveCountMap();
|
osgUtil::Statistics::PrimitiveCountMap& pcm = sceneStats.getPrimitiveCountMap();
|
||||||
stats->setAttribute(frameNumber, "Visible number of GL_POINTS", static_cast<double>(pcm[GL_POINTS]));
|
stats->setAttribute(frameNumber, "Visible number of GL_POINTS", static_cast<double>(pcm[GL_POINTS]));
|
||||||
@ -598,8 +599,9 @@ void Renderer::cull_draw()
|
|||||||
stats->setAttribute(frameNumber, "Visible number of lights", static_cast<double>(sceneStats.nlights));
|
stats->setAttribute(frameNumber, "Visible number of lights", static_cast<double>(sceneStats.nlights));
|
||||||
stats->setAttribute(frameNumber, "Visible number of render bins", static_cast<double>(sceneStats.nbins));
|
stats->setAttribute(frameNumber, "Visible number of render bins", static_cast<double>(sceneStats.nbins));
|
||||||
stats->setAttribute(frameNumber, "Visible depth", static_cast<double>(sceneStats.depth));
|
stats->setAttribute(frameNumber, "Visible depth", static_cast<double>(sceneStats.depth));
|
||||||
stats->setAttribute(frameNumber, "Visible number of materials", static_cast<double>(sceneStats.nummat));
|
stats->setAttribute(frameNumber, "Number of StateGraphs", static_cast<double>(sceneStats.numStateGraphs));
|
||||||
stats->setAttribute(frameNumber, "Visible number of impostors", static_cast<double>(sceneStats.nimpostor));
|
stats->setAttribute(frameNumber, "Visible number of impostors", static_cast<double>(sceneStats.nimpostor));
|
||||||
|
stats->setAttribute(frameNumber, "Number of ordered leaves", static_cast<double>(sceneStats.numOrderedLeaves));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -412,9 +412,10 @@ struct CameraSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCall
|
|||||||
STATS_ATTRIBUTE("Visible number of lights")
|
STATS_ATTRIBUTE("Visible number of lights")
|
||||||
STATS_ATTRIBUTE("Visible number of render bins")
|
STATS_ATTRIBUTE("Visible number of render bins")
|
||||||
STATS_ATTRIBUTE("Visible depth")
|
STATS_ATTRIBUTE("Visible depth")
|
||||||
STATS_ATTRIBUTE("Visible number of materials")
|
STATS_ATTRIBUTE("Number of StateGraphs")
|
||||||
STATS_ATTRIBUTE("Visible number of impostors")
|
STATS_ATTRIBUTE("Visible number of impostors")
|
||||||
STATS_ATTRIBUTE("Visible number of drawables")
|
STATS_ATTRIBUTE("Visible number of drawables")
|
||||||
|
STATS_ATTRIBUTE("Number of ordered leaves")
|
||||||
STATS_ATTRIBUTE("Visible vertex count")
|
STATS_ATTRIBUTE("Visible vertex count")
|
||||||
|
|
||||||
STATS_ATTRIBUTE("Visible number of GL_POINTS")
|
STATS_ATTRIBUTE("Visible number of GL_POINTS")
|
||||||
@ -1417,9 +1418,10 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
|
|||||||
viewStr << "Lights" << std::endl;
|
viewStr << "Lights" << std::endl;
|
||||||
viewStr << "Bins" << std::endl;
|
viewStr << "Bins" << std::endl;
|
||||||
viewStr << "Depth" << std::endl;
|
viewStr << "Depth" << std::endl;
|
||||||
viewStr << "Materials" << std::endl;
|
viewStr << "State graphs" << std::endl;
|
||||||
viewStr << "Imposters" << std::endl;
|
viewStr << "Imposters" << std::endl;
|
||||||
viewStr << "Drawables" << std::endl;
|
viewStr << "Drawables" << std::endl;
|
||||||
|
viewStr << "Sorted" << std::endl;
|
||||||
viewStr << "Vertices" << std::endl;
|
viewStr << "Vertices" << std::endl;
|
||||||
viewStr << "Points" << std::endl;
|
viewStr << "Points" << std::endl;
|
||||||
viewStr << "Lines" << std::endl;
|
viewStr << "Lines" << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user