mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
fix opt4 do-pstats handling
This commit is contained in:
parent
11816b3438
commit
02bffb403b
@ -27,7 +27,5 @@ GLGeomNodeContext(GeomNode *node) :
|
|||||||
GeomNodeContext(node)
|
GeomNodeContext(node)
|
||||||
{
|
{
|
||||||
_index = 0;
|
_index = 0;
|
||||||
#ifdef DO_PSTATS
|
DO_PSTATS_STUFF(_num_verts = 0;)
|
||||||
_num_verts = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,9 @@ public:
|
|||||||
typedef pvector<PT(dDrawable) > Geoms;
|
typedef pvector<PT(dDrawable) > Geoms;
|
||||||
Geoms _dynamic_geoms;
|
Geoms _dynamic_geoms;
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
|
||||||
// The number of vertices represented by the display list. This is
|
// The number of vertices represented by the display list. This is
|
||||||
// strictly for the benefit of PStats reporting.
|
// strictly for the benefit of PStats reporting.
|
||||||
int _num_verts;
|
DO_PSTATS_STUFF(int _num_verts;)
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
@ -66,11 +66,14 @@
|
|||||||
#include "pointShapeTransition.h"
|
#include "pointShapeTransition.h"
|
||||||
#include "polygonOffsetTransition.h"
|
#include "polygonOffsetTransition.h"
|
||||||
#include "clockObject.h"
|
#include "clockObject.h"
|
||||||
#include "pStatTimer.h"
|
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "dcast.h"
|
#include "dcast.h"
|
||||||
#include "pvector.h"
|
#include "pvector.h"
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
#include "pStatTimer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -83,7 +86,7 @@
|
|||||||
|
|
||||||
TypeHandle GLGraphicsStateGuardian::_type_handle;
|
TypeHandle GLGraphicsStateGuardian::_type_handle;
|
||||||
|
|
||||||
#ifndef CPPPARSER
|
#if !defined(CPPPARSER) && defined(DO_PSTATS)
|
||||||
PStatCollector GLGraphicsStateGuardian::_vertices_display_list_pcollector("Vertices:Display lists");
|
PStatCollector GLGraphicsStateGuardian::_vertices_display_list_pcollector("Vertices:Display lists");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -343,7 +346,7 @@ reset() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void GLGraphicsStateGuardian::
|
void GLGraphicsStateGuardian::
|
||||||
clear(const RenderBuffer &buffer) {
|
clear(const RenderBuffer &buffer) {
|
||||||
PStatTimer timer(_win->_clear_pcollector);
|
DO_PSTATS_STUFF(PStatTimer timer(_win->_clear_pcollector);)
|
||||||
// activate();
|
// activate();
|
||||||
|
|
||||||
nassertv(buffer._gsg == this);
|
nassertv(buffer._gsg == this);
|
||||||
@ -720,8 +723,10 @@ draw_point(GeomPoint *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_point()" << endl;
|
glgsg_cat.debug() << "draw_point()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DO_PSTATS
|
||||||
PStatTimer timer(_draw_primitive_pcollector);
|
PStatTimer timer(_draw_primitive_pcollector);
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
call_glPointSize(geom->get_size());
|
call_glPointSize(geom->get_size());
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
@ -781,8 +786,10 @@ draw_line(GeomLine *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_line()" << endl;
|
glgsg_cat.debug() << "draw_line()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DO_PSTATS
|
||||||
PStatTimer timer(_draw_primitive_pcollector);
|
PStatTimer timer(_draw_primitive_pcollector);
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
call_glLineWidth(geom->get_width());
|
call_glLineWidth(geom->get_width());
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
@ -844,11 +851,13 @@ draw_linestrip(GeomLinestrip *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_linestrip()" << endl;
|
glgsg_cat.debug() << "draw_linestrip()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
|
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
call_glLineWidth(geom->get_width());
|
call_glLineWidth(geom->get_width());
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
@ -914,7 +923,7 @@ draw_linestrip(GeomLinestrip *geom, GeomContext *) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -968,10 +977,12 @@ draw_sprite(GeomSprite *geom, GeomContext *) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
Geom::VertexIterator vi = geom->make_vertex_iterator();
|
Geom::VertexIterator vi = geom->make_vertex_iterator();
|
||||||
Geom::ColorIterator ci = geom->make_color_iterator();
|
Geom::ColorIterator ci = geom->make_color_iterator();
|
||||||
@ -1200,7 +1211,7 @@ draw_sprite(GeomSprite *geom, GeomContext *) {
|
|||||||
glEnable(GL_DITHER);
|
glEnable(GL_DITHER);
|
||||||
|
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1216,10 +1227,13 @@ draw_polygon(GeomPolygon *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_polygon()" << endl;
|
glgsg_cat.debug() << "draw_polygon()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1280,7 +1294,7 @@ draw_polygon(GeomPolygon *geom, GeomContext *) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1295,10 +1309,13 @@ draw_tri(GeomTri *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_tri()" << endl;
|
glgsg_cat.debug() << "draw_tri()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_tri_pcollector.add_level(geom->get_num_vertices());
|
_vertices_tri_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1354,7 +1371,9 @@ draw_tri(GeomTri *geom, GeomContext *) {
|
|||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
report_errors();
|
report_errors();
|
||||||
|
#ifdef DO_PSTATS
|
||||||
_draw_primitive_pcollector.stop();
|
_draw_primitive_pcollector.stop();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1369,10 +1388,13 @@ draw_quad(GeomQuad *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_quad()" << endl;
|
glgsg_cat.debug() << "draw_quad()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1428,7 +1450,7 @@ draw_quad(GeomQuad *geom, GeomContext *) {
|
|||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1443,10 +1465,13 @@ draw_tristrip(GeomTristrip *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_tristrip()" << endl;
|
glgsg_cat.debug() << "draw_tristrip()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_tristrip_pcollector.add_level(geom->get_num_vertices());
|
_vertices_tristrip_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1524,7 +1549,7 @@ draw_tristrip(GeomTristrip *geom, GeomContext *) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1539,10 +1564,13 @@ draw_trifan(GeomTrifan *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_trifan()" << endl;
|
glgsg_cat.debug() << "draw_trifan()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_trifan_pcollector.add_level(geom->get_num_vertices());
|
_vertices_trifan_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1620,7 +1648,7 @@ draw_trifan(GeomTrifan *geom, GeomContext *) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1636,10 +1664,13 @@ draw_sphere(GeomSphere *geom, GeomContext *) {
|
|||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
glgsg_cat.debug() << "draw_sphere()" << endl;
|
glgsg_cat.debug() << "draw_sphere()" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
// PStatTimer timer(_draw_primitive_pcollector);
|
// PStatTimer timer(_draw_primitive_pcollector);
|
||||||
// Using PStatTimer may cause a compiler crash.
|
// Using PStatTimer may cause a compiler crash.
|
||||||
_draw_primitive_pcollector.start();
|
_draw_primitive_pcollector.start();
|
||||||
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
_vertices_other_pcollector.add_level(geom->get_num_vertices());
|
||||||
|
#endif
|
||||||
|
|
||||||
issue_scene_graph_color();
|
issue_scene_graph_color();
|
||||||
|
|
||||||
@ -1707,7 +1738,7 @@ draw_sphere(GeomSphere *geom, GeomContext *) {
|
|||||||
|
|
||||||
gluDeleteQuadric(sph);
|
gluDeleteQuadric(sph);
|
||||||
report_errors();
|
report_errors();
|
||||||
_draw_primitive_pcollector.stop();
|
DO_PSTATS_STUFF(_draw_primitive_pcollector.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -379,6 +379,12 @@ private:
|
|||||||
static TypeHandle _type_handle;
|
static TypeHandle _type_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
#define DO_PSTATS_STUFF(XX) XX;
|
||||||
|
#else
|
||||||
|
#define DO_PSTATS_STUFF(XX)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "glGraphicsStateGuardian.I"
|
#include "glGraphicsStateGuardian.I"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <pStatTimer.h>
|
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -34,6 +33,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Win32Defs.h"
|
#include "Win32Defs.h"
|
||||||
|
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
#include <pStatTimer.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WGL_WGLEXT_PROTOTYPES
|
#define WGL_WGLEXT_PROTOTYPES
|
||||||
#include "wglext.h"
|
#include "wglext.h"
|
||||||
|
|
||||||
@ -981,7 +984,7 @@ void wglGraphicsWindow::setup_colormap(void) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void wglGraphicsWindow::end_frame(void) {
|
void wglGraphicsWindow::end_frame(void) {
|
||||||
if (gl_show_fps_meter) {
|
if (gl_show_fps_meter) {
|
||||||
PStatTimer timer(_show_fps_pcollector);
|
DO_PSTATS_STUFF(PStatTimer timer(_show_fps_pcollector);)
|
||||||
DWORD now = timeGetTime(); // this is win32 fn
|
DWORD now = timeGetTime(); // this is win32 fn
|
||||||
|
|
||||||
float time_delta = (now - _start_time) * 0.001f;
|
float time_delta = (now - _start_time) * 0.001f;
|
||||||
@ -1043,7 +1046,7 @@ void wglGraphicsWindow::end_frame(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
PStatTimer timer(_swap_pcollector);
|
DO_PSTATS_STUFF(PStatTimer timer(_swap_pcollector);)
|
||||||
if(_is_synced)
|
if(_is_synced)
|
||||||
glFinish();
|
glFinish();
|
||||||
else SwapBuffers(_hdc);
|
else SwapBuffers(_hdc);
|
||||||
@ -1347,7 +1350,7 @@ void wglGraphicsWindow::make_current(void) {
|
|||||||
return; // we're only allow unmake_current() to set this to NULL
|
return; // we're only allow unmake_current() to set this to NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatTimer timer(_make_current_pcollector);
|
DO_PSTATS_STUFF(PStatTimer timer(_make_current_pcollector);)
|
||||||
HGLRC current_context = wglGetCurrentContext();
|
HGLRC current_context = wglGetCurrentContext();
|
||||||
HDC current_dc = wglGetCurrentDC();
|
HDC current_dc = wglGetCurrentDC();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user