Add Animation:charname:Calc blends pstats collector

This commit is contained in:
David Rose 2011-12-13 19:24:35 +00:00
parent 26fa40190a
commit c6cc36e604
2 changed files with 32 additions and 20 deletions

View File

@ -45,7 +45,8 @@ GeomVertexData::
GeomVertexData() : GeomVertexData() :
_char_pcollector(_animation_pcollector, "unnamed"), _char_pcollector(_animation_pcollector, "unnamed"),
_skinning_pcollector(_char_pcollector, "Skinning"), _skinning_pcollector(_char_pcollector, "Skinning"),
_morphs_pcollector(_char_pcollector, "Morphs") _morphs_pcollector(_char_pcollector, "Morphs"),
_blends_pcollector(_char_pcollector, "Calc blends")
{ {
} }
@ -71,7 +72,8 @@ GeomVertexData(const string &name,
_name(name), _name(name),
_char_pcollector(PStatCollector(_animation_pcollector, name)), _char_pcollector(PStatCollector(_animation_pcollector, name)),
_skinning_pcollector(_char_pcollector, "Skinning"), _skinning_pcollector(_char_pcollector, "Skinning"),
_morphs_pcollector(_char_pcollector, "Morphs") _morphs_pcollector(_char_pcollector, "Morphs"),
_blends_pcollector(_char_pcollector, "Calc blends")
{ {
nassertv(format->is_registered()); nassertv(format->is_registered());
@ -103,7 +105,8 @@ GeomVertexData(const GeomVertexData &copy) :
_cycler(copy._cycler), _cycler(copy._cycler),
_char_pcollector(copy._char_pcollector), _char_pcollector(copy._char_pcollector),
_skinning_pcollector(copy._skinning_pcollector), _skinning_pcollector(copy._skinning_pcollector),
_morphs_pcollector(copy._morphs_pcollector) _morphs_pcollector(copy._morphs_pcollector),
_blends_pcollector(copy._blends_pcollector)
{ {
OPEN_ITERATE_ALL_STAGES(_cycler) { OPEN_ITERATE_ALL_STAGES(_cycler) {
CDStageWriter cdata(_cycler, pipeline_stage); CDStageWriter cdata(_cycler, pipeline_stage);
@ -130,7 +133,8 @@ GeomVertexData(const GeomVertexData &copy,
_cycler(copy._cycler), _cycler(copy._cycler),
_char_pcollector(copy._char_pcollector), _char_pcollector(copy._char_pcollector),
_skinning_pcollector(copy._skinning_pcollector), _skinning_pcollector(copy._skinning_pcollector),
_morphs_pcollector(copy._morphs_pcollector) _morphs_pcollector(copy._morphs_pcollector),
_blends_pcollector(copy._blends_pcollector)
{ {
nassertv(format->is_registered()); nassertv(format->is_registered());
@ -174,6 +178,7 @@ operator = (const GeomVertexData &copy) {
_char_pcollector = copy._char_pcollector; _char_pcollector = copy._char_pcollector;
_skinning_pcollector = copy._skinning_pcollector; _skinning_pcollector = copy._skinning_pcollector;
_morphs_pcollector = copy._morphs_pcollector; _morphs_pcollector = copy._morphs_pcollector;
_blends_pcollector = copy._blends_pcollector;
OPEN_ITERATE_ALL_STAGES(_cycler) { OPEN_ITERATE_ALL_STAGES(_cycler) {
CDStageWriter cdata(_cycler, pipeline_stage); CDStageWriter cdata(_cycler, pipeline_stage);
@ -244,6 +249,7 @@ set_name(const string &name) {
_char_pcollector = PStatCollector(_animation_pcollector, name); _char_pcollector = PStatCollector(_animation_pcollector, name);
_skinning_pcollector = PStatCollector(_char_pcollector, "Skinning"); _skinning_pcollector = PStatCollector(_char_pcollector, "Skinning");
_morphs_pcollector = PStatCollector(_char_pcollector, "Morphs"); _morphs_pcollector = PStatCollector(_char_pcollector, "Morphs");
_blends_pcollector = PStatCollector(_char_pcollector, "Calc blends");
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -1024,6 +1030,8 @@ animate_vertices(bool force, Thread *current_thread) const {
} }
#endif // DO_PIPELINING #endif // DO_PIPELINING
PStatTimer timer(((GeomVertexData *)this)->_char_pcollector, current_thread);
// Now that we've short-circuited the short route, we reasonably // Now that we've short-circuited the short route, we reasonably
// believe the vdata is animated. Grab the mutex and make sure it's // believe the vdata is animated. Grab the mutex and make sure it's
// still animated after we've acquired it. // still animated after we've acquired it.
@ -1033,22 +1041,25 @@ animate_vertices(bool force, Thread *current_thread) const {
} }
UpdateSeq modified; UpdateSeq modified;
if (!cdata->_transform_blend_table.is_null()) { {
if (cdata->_slider_table != (SliderTable *)NULL) { PStatTimer timer2(((GeomVertexData *)this)->_blends_pcollector, current_thread);
modified = if (!cdata->_transform_blend_table.is_null()) {
max(cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread), if (cdata->_slider_table != (SliderTable *)NULL) {
cdata->_slider_table->get_modified(current_thread)); modified =
max(cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread),
cdata->_slider_table->get_modified(current_thread));
} else {
modified = cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread);
}
} else if (cdata->_slider_table != (SliderTable *)NULL) {
modified = cdata->_slider_table->get_modified(current_thread);
} else { } else {
modified = cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread); // No transform blend table or slider table--ergo, no vertex
// animation.
return this;
} }
} else if (cdata->_slider_table != (SliderTable *)NULL) {
modified = cdata->_slider_table->get_modified(current_thread);
} else {
// No transform blend table or slider table--ergo, no vertex
// animation.
return this;
} }
if (cdata->_animated_vertices_modified == modified && if (cdata->_animated_vertices_modified == modified &&
@ -1427,6 +1438,8 @@ uint8_rgba_to_packed_argb(unsigned char *to, int to_stride,
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void GeomVertexData:: void GeomVertexData::
update_animated_vertices(GeomVertexData::CData *cdata, Thread *current_thread) { update_animated_vertices(GeomVertexData::CData *cdata, Thread *current_thread) {
PStatTimer timer(_char_pcollector, current_thread);
int num_rows = get_num_rows(); int num_rows = get_num_rows();
if (gobj_cat.is_debug()) { if (gobj_cat.is_debug()) {
@ -1435,8 +1448,6 @@ update_animated_vertices(GeomVertexData::CData *cdata, Thread *current_thread) {
<< "\n"; << "\n";
} }
PStatTimer timer(_char_pcollector, current_thread);
const GeomVertexFormat *orig_format = cdata->_format; const GeomVertexFormat *orig_format = cdata->_format;
CPT(GeomVertexFormat) new_format = orig_format; CPT(GeomVertexFormat) new_format = orig_format;

View File

@ -324,6 +324,7 @@ private:
PStatCollector _char_pcollector; PStatCollector _char_pcollector;
PStatCollector _skinning_pcollector; PStatCollector _skinning_pcollector;
PStatCollector _morphs_pcollector; PStatCollector _morphs_pcollector;
PStatCollector _blends_pcollector;
public: public:
static void register_with_read_factory(); static void register_with_read_factory();