From d7d79633378814b0bbca53e7a3e06c5552852964 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Feb 2009 22:28:04 +0000 Subject: [PATCH] try asserting that gsg::get_engine() is not null --- panda/src/display/graphicsStateGuardian.I | 10 ---------- panda/src/display/graphicsStateGuardian.cxx | 12 ++++++++++++ panda/src/display/graphicsStateGuardian.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index a62ec436a5..efcf119262 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -212,16 +212,6 @@ get_pipe() const { return _pipe; } -//////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_engine -// Access: Published -// Description: Returns the graphics engine that created this GSG. -//////////////////////////////////////////////////////////////////// -INLINE GraphicsEngine *GraphicsStateGuardian:: -get_engine() const { - return _engine; -} - //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::get_threading_model // Access: Published diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index fd6f3dd546..4eb627e87a 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "graphicsStateGuardian.h" +#include "graphicsEngine.h" #include "config_display.h" #include "textureContext.h" #include "vertexBufferContext.h" @@ -248,6 +249,17 @@ GraphicsStateGuardian:: GeomMunger::unregister_mungers_for_gsg(this); } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_engine +// Access: Published +// Description: Returns the graphics engine that created this GSG. +//////////////////////////////////////////////////////////////////// +GraphicsEngine *GraphicsStateGuardian:: +get_engine() const { + nassertr(_engine != (GraphicsEngine *)NULL, GraphicsEngine::get_global_ptr()); + return _engine; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::get_supports_multisample // Access: Published, Virtual diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 9117817126..70c03c296b 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -101,7 +101,7 @@ PUBLISHED: INLINE Loader *get_loader() const; INLINE GraphicsPipe *get_pipe() const; - INLINE GraphicsEngine *get_engine() const; + GraphicsEngine *get_engine() const; INLINE const GraphicsThreadingModel &get_threading_model() const; INLINE bool is_hardware() const;