diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index af62a7e40e..bd5850f89a 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -52,7 +52,8 @@ PStatCollector GraphicsStateGuardian::_geom_nodes_pcollector("Nodes:GeomNodes"); PStatCollector GraphicsStateGuardian::_frustum_cull_volumes_pcollector("Cull volumes"); PStatCollector GraphicsStateGuardian::_frustum_cull_transforms_pcollector("Cull volumes:Transforms"); -static PStatCollector _set_state_pcollector("Draw:Set state"); +PStatCollector GraphicsStateGuardian::_set_state_pcollector("Draw:Set state"); +PStatCollector GraphicsStateGuardian::_draw_primitive_pcollector("Draw:Primitive"); #endif diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 278092b760..40925d4c31 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -238,6 +238,8 @@ public: static PStatCollector _geom_nodes_pcollector; static PStatCollector _frustum_cull_volumes_pcollector; static PStatCollector _frustum_cull_transforms_pcollector; + static PStatCollector _set_state_pcollector; + static PStatCollector _draw_primitive_pcollector; private: // NOTE: on win32 another DLL (e.g. libpandadx.dll) cannot access diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 2367aca6e5..a469643219 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -567,7 +567,7 @@ init_dx( LPDIRECTDRAW7 context, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: clear(const RenderBuffer &buffer) { - // PStatTimer timer(_win->_clear_pcollector); + PStatTimer timer(_win->_clear_pcollector); nassertv(buffer._gsg == this); int buffer_type = buffer._buffer_type; @@ -1396,6 +1396,7 @@ draw_point(GeomPoint *geom, GeomContext *gc) { dxgsg_cat.debug() << "draw_point()" << endl; #endif + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); // The DX Way @@ -1539,7 +1540,8 @@ draw_line(GeomLine* geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_line()" << endl; #endif - DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); + DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); #ifdef _DEBUG static BOOL bPrintedMsg=FALSE; @@ -1644,7 +1646,8 @@ draw_linestrip_base(Geom* geom, GeomContext *gc, bool bConnectEnds) { dxgsg_cat.debug() << "draw_linestrip()" << endl; #endif - DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); + DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); int nPrims = geom->get_num_prims(); const int *plen = geom->get_lengths(); @@ -1771,7 +1774,8 @@ draw_sprite(GeomSprite *geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_sprite()" << endl; #endif - DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); + DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); Texture *tex = geom->get_texture(); nassertv(tex != (Texture *) NULL); @@ -2104,8 +2108,9 @@ void DXGraphicsStateGuardian:: draw_polygon(GeomPolygon *geom, GeomContext *gc) { #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_polygon()" << endl; + dxgsg_cat.debug() << "draw_polygon()" << endl; #endif + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); // wireframe polygon will be drawn as linestrip, otherwise draw as multi-tri trifan @@ -2129,6 +2134,7 @@ draw_quad(GeomQuad *geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_quad()" << endl; #endif + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); // wireframe quad will be drawn as linestrip, otherwise draw as multi-tri trifan @@ -2152,7 +2158,8 @@ draw_tri(GeomTri *geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_tri()" << endl; #endif - DO_PSTATS_STUFF(_vertices_tri_pcollector.add_level(geom->get_num_vertices())); + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); + DO_PSTATS_STUFF(_vertices_tri_pcollector.add_level(geom->get_num_vertices())); #ifdef _DEBUG if (_pCurTexContext!=NULL) { @@ -2453,8 +2460,9 @@ void DXGraphicsStateGuardian:: draw_tristrip(GeomTristrip *geom, GeomContext *gc) { #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_tristrip()" << endl; + dxgsg_cat.debug() << "draw_tristrip()" << endl; #endif + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); DO_PSTATS_STUFF(_vertices_tristrip_pcollector.add_level(geom->get_num_vertices())); draw_multitri(geom, D3DPT_TRIANGLESTRIP); @@ -2471,6 +2479,7 @@ draw_trifan(GeomTrifan *geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_trifan()" << endl; #endif + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); DO_PSTATS_STUFF(_vertices_trifan_pcollector.add_level(geom->get_num_vertices())); draw_multitri(geom, D3DPT_TRIANGLEFAN); @@ -3129,7 +3138,8 @@ draw_sphere(GeomSphere *geom, GeomContext *gc) { #ifdef GSG_VERBOSE dxgsg_cat.debug() << "draw_sphere()" << endl; #endif - DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); + DO_PSTATS_STUFF(_vertices_other_pcollector.add_level(geom->get_num_vertices())); int nprims = geom->get_num_prims(); @@ -6106,6 +6116,7 @@ draw_geom_node(GeomNode *node, GeomNodeContext *gnc) { DXCallList(ggnc->_index); #ifdef DO_PSTATS + DO_PSTATS_STUFF(PStatTimer timer(_draw_primitive_pcollector)); _vertices_display_list_pcollector.add_level(ggnc->_num_verts); #endif diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index c188f9e93b..7b6b35a490 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -348,7 +348,7 @@ reset() { //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: clear(const RenderBuffer &buffer) { - // PStatTimer timer(_win->_clear_pcollector); + PStatTimer timer(_win->_clear_pcollector); activate(); nassertv(buffer._gsg == this); @@ -720,6 +720,7 @@ draw_point(GeomPoint *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_point()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); call_glPointSize(geom->get_size()); @@ -780,6 +781,7 @@ draw_line(GeomLine *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_line()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); call_glLineWidth(geom->get_width()); @@ -842,6 +844,7 @@ draw_linestrip(GeomLinestrip *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_linestrip()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); call_glLineWidth(geom->get_width()); @@ -954,6 +957,7 @@ draw_sprite(GeomSprite *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_sprite()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); Texture *tex = geom->get_texture(); @@ -1233,6 +1237,7 @@ draw_polygon(GeomPolygon *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_polygon()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1308,6 +1313,7 @@ draw_tri(GeomTri *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_tri()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_tri_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1378,6 +1384,7 @@ draw_quad(GeomQuad *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_quad()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1448,6 +1455,7 @@ draw_tristrip(GeomTristrip *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_tristrip()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_tristrip_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1540,6 +1548,7 @@ draw_trifan(GeomTrifan *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_trifan()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_trifan_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1633,6 +1642,7 @@ draw_sphere(GeomSphere *geom, GeomContext *) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "draw_sphere()" << endl; #endif + PStatTimer timer(_draw_primitive_pcollector); _vertices_other_pcollector.add_level(geom->get_num_vertices()); issue_scene_graph_color(); @@ -1903,7 +1913,8 @@ draw_geom_node(GeomNode *node, GeomNodeContext *gnc) { GLGeomNodeContext *ggnc = DCAST(GLGeomNodeContext, gnc); glCallList(ggnc->_index); -#ifdef DO_PSTATS +#ifdef DO_PSTATS + PStatTimer timer(_draw_primitive_pcollector); _vertices_display_list_pcollector.add_level(ggnc->_num_verts); #endif diff --git a/panda/src/pstatclient/pStatProperties.cxx b/panda/src/pstatclient/pStatProperties.cxx index f2b999d1c0..b8e3cc947d 100644 --- a/panda/src/pstatclient/pStatProperties.cxx +++ b/panda/src/pstatclient/pStatProperties.cxx @@ -128,7 +128,8 @@ static TimeCollectorProperties time_properties[] = { { 0, "Cull:Bins:Unsorted", { 0.5, 0.5, 1.0 } }, { 0, "Cull:Bins:Fixed", { 0.5, 1.0, 0.5 } }, { 1, "Draw", { 1.0, 0.0, 0.0 }, 1.0 / 30.0 }, - { 0, "Draw:Set state", { 0.0, 0.0, 0.5 } }, + { 0, "Draw:Primitive", { 0.0, 0.0, 0.5 } }, + { 0, "Draw:Set state", { 0.5, 0.0, 0.0 } }, { 1, "Draw:Quick", { 1.0, 0.0, 0.8 } }, { 1, "Draw:Direct", { 0.0, 0.4, 1.0 } }, { 1, "Draw:Cull", { 0.4, 1.0, 0.0 } },