diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 42a9241b67..3a0e3d90ad 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -59,6 +59,8 @@ PStatCollector GraphicsEngine::_transform_states_pcollector("TransformStates"); PStatCollector GraphicsEngine::_transform_states_unused_pcollector("TransformStates:Unused"); PStatCollector GraphicsEngine::_render_states_pcollector("RenderStates"); PStatCollector GraphicsEngine::_render_states_unused_pcollector("RenderStates:Unused"); +PStatCollector GraphicsEngine::_cyclers_pcollector("PipelineCyclers"); +PStatCollector GraphicsEngine::_dirty_cyclers_pcollector("PipelineCyclers:Dirty"); //////////////////////////////////////////////////////////////////// // Function: GraphicsEngine::Constructor @@ -537,6 +539,11 @@ render_frame() { } } +#if defined(DO_PIPELINING) && defined(HAVE_THREADS) + _cyclers_pcollector.set_level(_pipeline->get_num_cyclers()); + _dirty_cyclers_pcollector.set_level(_pipeline->get_num_dirty_cyclers()); +#endif // DO_PIPELINING && HAVE_THREADS + // Now cycle the pipeline and officially begin the next frame. { PStatTimer timer(_cycle_pcollector); diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index a499821ff4..225fcf2a71 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -259,6 +259,8 @@ private: static PStatCollector _transform_states_unused_pcollector; static PStatCollector _render_states_pcollector; static PStatCollector _render_states_unused_pcollector; + static PStatCollector _cyclers_pcollector; + static PStatCollector _dirty_cyclers_pcollector; friend class WindowRenderer; friend class GraphicsOutput; diff --git a/panda/src/pstatclient/pStatProperties.cxx b/panda/src/pstatclient/pStatProperties.cxx index 873b7a472d..40b613509b 100644 --- a/panda/src/pstatclient/pStatProperties.cxx +++ b/panda/src/pstatclient/pStatProperties.cxx @@ -211,6 +211,8 @@ static LevelCollectorProperties level_properties[] = { { 1, "RenderStates:On nodes", { 0.2, 0.8, 1.0 } }, { 1, "RenderStates:Cached", { 1.0, 0.0, 0.2 } }, { 1, "RenderStates:Unused", { 0.2, 0.2, 0.2 } }, + { 1, "PipelineCyclers", { 0.5, 0.5, 1.0 }, "", 5000 }, + { 1, "PipelineCyclers:Dirty", { 0.2, 0.2, 0.2 } }, { 0, NULL } }; diff --git a/panda/src/putil/pipeline.I b/panda/src/putil/pipeline.I index 9af6575747..c400fbcea7 100644 --- a/panda/src/putil/pipeline.I +++ b/panda/src/putil/pipeline.I @@ -51,3 +51,34 @@ INLINE int Pipeline:: get_num_stages() const { return _num_stages; } + +#if defined(DO_PIPELINING) && defined(HAVE_THREADS) +//////////////////////////////////////////////////////////////////// +// Function: Pipeline::get_num_cyclers +// Access: Public +// Description: Returns the number of PipelineCyclers in the universe +// that reference this Pipeline object. +//////////////////////////////////////////////////////////////////// +INLINE int Pipeline:: +get_num_cyclers() const { + ReMutexHolder holder(_lock); + return _cyclers.size(); +} +#endif // DO_PIPELINING && HAVE_THREADS + +#if defined(DO_PIPELINING) && defined(HAVE_THREADS) +//////////////////////////////////////////////////////////////////// +// Function: Pipeline::get_num_dirty_cyclers +// Access: Public +// Description: Returns the number of PipelineCyclers in the universe +// that reference this Pipeline object and are currently +// marked "dirty"; that is, there is a difference in +// pointer value between some of their stages. +//////////////////////////////////////////////////////////////////// +INLINE int Pipeline:: +get_num_dirty_cyclers() const { + ReMutexHolder holder(_lock); + return _dirty_cyclers.size(); +} +#endif // DO_PIPELINING && HAVE_THREADS + diff --git a/panda/src/putil/pipeline.h b/panda/src/putil/pipeline.h index a9dd3b2d6d..f51234bb67 100644 --- a/panda/src/putil/pipeline.h +++ b/panda/src/putil/pipeline.h @@ -56,6 +56,9 @@ public: void add_cycler(PipelineCyclerTrueImpl *cycler); void add_dirty_cycler(PipelineCyclerTrueImpl *cycler); void remove_cycler(PipelineCyclerTrueImpl *cycler); + + INLINE int get_num_cyclers() const; + INLINE int get_num_dirty_cyclers() const; #endif // DO_PIPELINING && HAVE_THREADS private: