Adding node counters to PStats
This commit is contained in:
parent
ab5db5fa68
commit
be159c08f0
|
|
@ -526,6 +526,11 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
|
|||
int arc_num_sub_render = arc->get_num_sub_render_trans();
|
||||
bool has_decal = arc->has_transition(DecalTransition::get_class_type());
|
||||
|
||||
_gsg->_nodes_pcollector.add_level(1);
|
||||
if (is_geom) {
|
||||
_gsg->_geom_nodes_pcollector.add_level(1);
|
||||
}
|
||||
|
||||
if (has_decal) {
|
||||
// For the purposes of cull, we don't consider a DecalTransition
|
||||
// to be a sub_render transition.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ PStatCollector GraphicsStateGuardian::_vertices_trifan_pcollector("Vertices:Tria
|
|||
PStatCollector GraphicsStateGuardian::_vertices_tri_pcollector("Vertices:Triangles");
|
||||
PStatCollector GraphicsStateGuardian::_vertices_other_pcollector("Vertices:Other");
|
||||
PStatCollector GraphicsStateGuardian::_state_changes_pcollector("State changes");
|
||||
PStatCollector GraphicsStateGuardian::_transform_state_pcollector("State changes:Transforms");
|
||||
PStatCollector GraphicsStateGuardian::_texture_state_pcollector("State changes:Textures");
|
||||
PStatCollector GraphicsStateGuardian::_nodes_pcollector("Nodes");
|
||||
PStatCollector GraphicsStateGuardian::_geom_nodes_pcollector("Nodes:GeomNodes");
|
||||
#endif
|
||||
|
||||
TypeHandle GraphicsStateGuardian::_type_handle;
|
||||
|
|
@ -156,7 +160,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
gsg_cat.debug()
|
||||
<< "Issuing new attrib " << *(*new_i).second << "\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*new_i).first);
|
||||
(*new_i).second->issue(this);
|
||||
|
||||
// And store the new value.
|
||||
|
|
@ -179,7 +183,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
<< "Unissuing attrib " << *(*current_i).second
|
||||
<< " (previously set, not now)\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*current_i).first);
|
||||
|
||||
PT(NodeAttribute) initial = (*current_i).second->make_initial();
|
||||
initial->issue(this);
|
||||
|
|
@ -208,7 +212,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
<< "Unissuing attrib " << *(*current_i).second
|
||||
<< " (previously set, now NULL)\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*current_i).first);
|
||||
|
||||
// Issue the initial attribute before clearing the state.
|
||||
PT(NodeAttribute) initial = (*current_i).second->make_initial();
|
||||
|
|
@ -233,7 +237,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
gsg_cat.debug()
|
||||
<< "Reissuing attrib " << *(*new_i).second << "\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*new_i).first);
|
||||
(*new_i).second->issue(this);
|
||||
|
||||
// And store the new value.
|
||||
|
|
@ -259,7 +263,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
gsg_cat.debug()
|
||||
<< "Issuing new attrib " << *(*new_i).second << "\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*new_i).first);
|
||||
|
||||
(*new_i).second->issue(this);
|
||||
|
||||
|
|
@ -279,7 +283,7 @@ set_state(const NodeAttributes &new_state, bool complete) {
|
|||
<< "Unissuing attrib " << *(*current_i).second
|
||||
<< " (previously set, end of list)\n";
|
||||
}
|
||||
_state_changes_pcollector.add_level(1);
|
||||
record_state_change((*current_i).first);
|
||||
|
||||
// If we're in the "complete state" model, that means this
|
||||
// attribute should now get the default initial value.
|
||||
|
|
@ -489,6 +493,11 @@ init_frame_pstats() {
|
|||
_vertices_other_pcollector.clear_level();
|
||||
|
||||
_state_changes_pcollector.clear_level();
|
||||
_transform_state_pcollector.clear_level();
|
||||
_texture_state_pcollector.clear_level();
|
||||
|
||||
_nodes_pcollector.clear_level();
|
||||
_geom_nodes_pcollector.clear_level();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -506,6 +515,25 @@ add_to_texture_record(TextureContext *tc) {
|
|||
_active_texusage_pcollector.add_level(tc->estimate_texture_memory());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsStateGuardian::record_state_change
|
||||
// Access: Protected
|
||||
// Description: Indicates a state change request for a property of
|
||||
// the given type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GraphicsStateGuardian::
|
||||
record_state_change(TypeHandle type) {
|
||||
_state_changes_pcollector.add_level(1);
|
||||
|
||||
// We can't use the get_class_type() methods since we don't have
|
||||
// those header files available yet.
|
||||
if (type.get_name() == "TransformTransition") {
|
||||
_transform_state_pcollector.add_level(1);
|
||||
} else if (type.get_name() == "TextureTransition") {
|
||||
_texture_state_pcollector.add_level(1);
|
||||
}
|
||||
}
|
||||
#endif // DO_PSTATS
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -139,10 +139,13 @@ protected:
|
|||
// usage record (and other frame-based measurements) in Pstats.
|
||||
void init_frame_pstats();
|
||||
void add_to_texture_record(TextureContext *tc);
|
||||
void record_state_change(TypeHandle type);
|
||||
set<TextureContext *> _current_textures;
|
||||
#else
|
||||
INLINE void init_frame_pstats() { }
|
||||
INLINE void add_to_texture_record(TextureContext *) { }
|
||||
INLINE void record_state_change(TypeHandle type) { }
|
||||
INLINE void count_node(Node *) { }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
@ -170,6 +173,7 @@ protected:
|
|||
|
||||
CoordinateSystem _coordinate_system;
|
||||
|
||||
public:
|
||||
// Statistics
|
||||
static PStatCollector _total_texusage_pcollector;
|
||||
static PStatCollector _active_texusage_pcollector;
|
||||
|
|
@ -181,13 +185,17 @@ protected:
|
|||
static PStatCollector _vertices_tri_pcollector;
|
||||
static PStatCollector _vertices_other_pcollector;
|
||||
static PStatCollector _state_changes_pcollector;
|
||||
static PStatCollector _transform_state_pcollector;
|
||||
static PStatCollector _texture_state_pcollector;
|
||||
static PStatCollector _nodes_pcollector;
|
||||
static PStatCollector _geom_nodes_pcollector;
|
||||
|
||||
private:
|
||||
typedef set<TextureContext *> Textures;
|
||||
Textures _prepared_textures; // NOTE: on win32 another DLL (e.g. libpandadx.dll) cannot access set directly due to exported template issue
|
||||
|
||||
public:
|
||||
void traverse_prepared_textures(bool (*pertex_callbackfn)(TextureContext *,void *),void *callback_arg);
|
||||
void traverse_prepared_textures(bool (*pertex_callbackfn)(TextureContext *,void *),void *callback_arg);
|
||||
|
||||
// factory stuff
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -74,8 +74,11 @@ static LevelCollectorProperties level_properties[] = {
|
|||
{ "Vertices:Triangles", { 0.8, 0.8, 0.8 } },
|
||||
{ "Vertices:Triangle fans", { 0.8, 0.5, 0.2 } },
|
||||
{ "Vertices:Triangle strips", { 0.2, 0.5, 0.8 } },
|
||||
{ "Nodes", { 0.4, 0.2, 0.5 }, "", 1000.0 },
|
||||
{ "Nodes", { 0.4, 0.2, 0.8 }, "", 500.0 },
|
||||
{ "Nodes:GeomNodes", { 0.8, 0.2, 0.0 } },
|
||||
{ "State changes", { 1.0, 0.5, 0.2 }, "", 500.0 },
|
||||
{ "State changes:Transforms", { 0.2, 0.2, 0.8 }, },
|
||||
{ "State changes:Textures", { 0.8, 0.2, 0.2 }, },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
|
|||
|
||||
AllTransitionsWrapper new_trans;
|
||||
|
||||
_gsg->_nodes_pcollector.add_level(1);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (support_subrender == SD_on)
|
||||
#endif
|
||||
|
|
@ -144,6 +146,7 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
|
|||
}
|
||||
|
||||
if (node->is_of_type(GeomNode::get_class_type())) {
|
||||
_gsg->_geom_nodes_pcollector.add_level(1);
|
||||
_gsg->set_state(render_state.get_attributes(), true);
|
||||
// Make sure the current display region is still in effect.
|
||||
_gsg->prepare_display_region();
|
||||
|
|
|
|||
Loading…
Reference in New Issue