clean up state pstatting

This commit is contained in:
David Rose 2004-09-24 17:56:14 +00:00
parent e1c45b5cdb
commit fa5f9a7e15
3 changed files with 22 additions and 16 deletions

View File

@ -241,14 +241,17 @@ reset_if_new() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE void GraphicsStateGuardian:: INLINE void GraphicsStateGuardian::
modify_state(const RenderState *state) { modify_state(const RenderState *state) {
if (!state->is_empty()) {
#ifndef NDEBUG #ifndef NDEBUG
if (gsg_cat.is_spam()) { if (gsg_cat.is_spam()) {
gsg_cat.spam() << "Modifying GSG state with:\n"; gsg_cat.spam() << "Modifying GSG state with:\n";
state->write(gsg_cat.spam(false), 2); state->write(gsg_cat.spam(false), 2);
} }
#endif #endif
_state = _state->issue_delta_modify(state, this); _state_pcollector.add_level(1);
finish_modify_state(); _state = _state->issue_delta_modify(state, this);
finish_modify_state();
}
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -265,14 +268,17 @@ modify_state(const RenderState *state) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE void GraphicsStateGuardian:: INLINE void GraphicsStateGuardian::
set_state(const RenderState *state) { set_state(const RenderState *state) {
if (state != _state) {
#ifndef NDEBUG #ifndef NDEBUG
if (gsg_cat.is_spam()) { if (gsg_cat.is_spam()) {
gsg_cat.spam() << "Setting GSG state to:\n"; gsg_cat.spam() << "Setting GSG state to:\n";
state->write(gsg_cat.spam(false), 2); state->write(gsg_cat.spam(false), 2);
} }
#endif #endif
_state = _state->issue_delta_set(state, this); _state_pcollector.add_level(1);
finish_modify_state(); _state = _state->issue_delta_set(state, this);
finish_modify_state();
}
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -286,6 +292,7 @@ set_state(const RenderState *state) {
INLINE void GraphicsStateGuardian:: INLINE void GraphicsStateGuardian::
set_transform(const TransformState *transform) { set_transform(const TransformState *transform) {
if (transform != _transform) { if (transform != _transform) {
_state_pcollector.add_level(1);
_transform = transform; _transform = transform;
issue_transform(transform); issue_transform(transform);
} }

View File

@ -55,9 +55,9 @@ PStatCollector GraphicsStateGuardian::_vertices_tristrip_pcollector("Vertices:Tr
PStatCollector GraphicsStateGuardian::_vertices_trifan_pcollector("Vertices:Triangle fans"); PStatCollector GraphicsStateGuardian::_vertices_trifan_pcollector("Vertices:Triangle fans");
PStatCollector GraphicsStateGuardian::_vertices_tri_pcollector("Vertices:Triangles"); PStatCollector GraphicsStateGuardian::_vertices_tri_pcollector("Vertices:Triangles");
PStatCollector GraphicsStateGuardian::_vertices_other_pcollector("Vertices:Other"); PStatCollector GraphicsStateGuardian::_vertices_other_pcollector("Vertices:Other");
PStatCollector GraphicsStateGuardian::_state_pcollector("State changes");
PStatCollector GraphicsStateGuardian::_transform_state_pcollector("State changes:Transforms"); PStatCollector GraphicsStateGuardian::_transform_state_pcollector("State changes:Transforms");
PStatCollector GraphicsStateGuardian::_texture_state_pcollector("State changes:Textures"); PStatCollector GraphicsStateGuardian::_texture_state_pcollector("State changes:Textures");
PStatCollector GraphicsStateGuardian::_other_state_pcollector("State changes:Other");
PStatCollector GraphicsStateGuardian::_draw_primitive_pcollector("Draw:Primitive"); PStatCollector GraphicsStateGuardian::_draw_primitive_pcollector("Draw:Primitive");
PStatCollector GraphicsStateGuardian::_clear_pcollector("Draw:Clear"); PStatCollector GraphicsStateGuardian::_clear_pcollector("Draw:Clear");
PStatCollector GraphicsStateGuardian::_flush_pcollector("Draw:Flush"); PStatCollector GraphicsStateGuardian::_flush_pcollector("Draw:Flush");
@ -233,7 +233,6 @@ release_geom(GeomContext *) {
void GraphicsStateGuardian:: void GraphicsStateGuardian::
set_state_and_transform(const RenderState *state, set_state_and_transform(const RenderState *state,
const TransformState *transform) { const TransformState *transform) {
set_transform(transform); set_transform(transform);
set_state(state); set_state(state);
} }
@ -1246,9 +1245,9 @@ init_frame_pstats() {
_vertices_tri_pcollector.clear_level(); _vertices_tri_pcollector.clear_level();
_vertices_other_pcollector.clear_level(); _vertices_other_pcollector.clear_level();
_state_pcollector.clear_level();
_transform_state_pcollector.clear_level(); _transform_state_pcollector.clear_level();
_texture_state_pcollector.clear_level(); _texture_state_pcollector.clear_level();
_other_state_pcollector.clear_level();
} }
} }

View File

@ -293,9 +293,9 @@ public:
static PStatCollector _vertices_trifan_pcollector; static PStatCollector _vertices_trifan_pcollector;
static PStatCollector _vertices_tri_pcollector; static PStatCollector _vertices_tri_pcollector;
static PStatCollector _vertices_other_pcollector; static PStatCollector _vertices_other_pcollector;
static PStatCollector _state_pcollector;
static PStatCollector _transform_state_pcollector; static PStatCollector _transform_state_pcollector;
static PStatCollector _texture_state_pcollector; static PStatCollector _texture_state_pcollector;
static PStatCollector _other_state_pcollector;
static PStatCollector _draw_primitive_pcollector; static PStatCollector _draw_primitive_pcollector;
static PStatCollector _clear_pcollector; static PStatCollector _clear_pcollector;
static PStatCollector _flush_pcollector; static PStatCollector _flush_pcollector;