From edebdbae9d9ebfe647b6a9df4a9affe29148efed Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 27 Apr 2007 17:05:10 +0000 Subject: [PATCH] more debugging --- panda/src/display/graphicsStateGuardian.cxx | 4 ++++ panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 17 +++++++++++++++-- .../src/glstuff/glGraphicsStateGuardian_src.cxx | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index aa16e2209c..f705c17c89 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -1992,6 +1992,10 @@ free_pointers() { //////////////////////////////////////////////////////////////////// void GraphicsStateGuardian:: close_gsg() { + if (display_cat.is_debug()) { + display_cat.debug() + << this << " close_gsg " << get_type() << "\n"; + } _closing_gsg = true; free_pointers(); diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index e0c39b1c80..60be82297e 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -96,6 +96,11 @@ DXGraphicsStateGuardian9:: DXGraphicsStateGuardian9(GraphicsPipe *pipe) : GraphicsStateGuardian(CS_yup_left, pipe) { + if (dxgsg9_cat.is_debug()) { + dxgsg9_cat.debug() + << "DXGraphicsStateGuardian9 " << this << " constructing\n"; + } + _screen = NULL; _d3d_device = NULL; @@ -159,8 +164,10 @@ DXGraphicsStateGuardian9(GraphicsPipe *pipe) : //////////////////////////////////////////////////////////////////// DXGraphicsStateGuardian9:: ~DXGraphicsStateGuardian9() { - dxgsg9_cat.debug() - << "DXGraphicsStateGuardian9 " << this << " destructing\n"; + if (dxgsg9_cat.is_debug()) { + dxgsg9_cat.debug() + << "DXGraphicsStateGuardian9 " << this << " destructing\n"; + } if (IS_VALID_PTR(_d3d_device)) { _d3d_device->SetTexture(0, NULL); // this frees reference to the old texture @@ -4057,6 +4064,12 @@ void DXGraphicsStateGuardian9:: close_gsg() { GraphicsStateGuardian::close_gsg(); + if (dxgsg9_cat.is_debug()) { + dxgsg9_cat.debug() + << "Closing GSG, prepared_objects count = " + << _prepared_objects->get_ref_count() << "\n"; + } + // Unlike in OpenGL, in DX9 it is safe to try to explicitly release // any textures here. And it may even be a good idea. if (_prepared_objects->get_ref_count() == 1) { diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 2aa4289525..9fbe9b8d9c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -258,6 +258,11 @@ CLP(GraphicsStateGuardian)(GraphicsPipe *pipe) : //////////////////////////////////////////////////////////////////// CLP(GraphicsStateGuardian):: ~CLP(GraphicsStateGuardian)() { + if (GLCAT.is_debug()) { + GLCAT.debug() + << "GLGraphicsStateGuardian " << this << " destructing\n"; + } + close_gsg(); if (_stencil_render_states) {