Browse Source

try asserting that gsg::get_engine() is not null

David Rose 17 years ago
parent
commit
d7d7963337

+ 0 - 10
panda/src/display/graphicsStateGuardian.I

@@ -212,16 +212,6 @@ get_pipe() const {
   return _pipe;
   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
 //     Function: GraphicsStateGuardian::get_threading_model
 //       Access: Published
 //       Access: Published

+ 12 - 0
panda/src/display/graphicsStateGuardian.cxx

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
 #include "graphicsStateGuardian.h"
 #include "graphicsStateGuardian.h"
+#include "graphicsEngine.h"
 #include "config_display.h"
 #include "config_display.h"
 #include "textureContext.h"
 #include "textureContext.h"
 #include "vertexBufferContext.h"
 #include "vertexBufferContext.h"
@@ -248,6 +249,17 @@ GraphicsStateGuardian::
   GeomMunger::unregister_mungers_for_gsg(this);
   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
 //     Function: GraphicsStateGuardian::get_supports_multisample
 //       Access: Published, Virtual
 //       Access: Published, Virtual

+ 1 - 1
panda/src/display/graphicsStateGuardian.h

@@ -101,7 +101,7 @@ PUBLISHED:
   INLINE Loader *get_loader() const;
   INLINE Loader *get_loader() const;
 
 
   INLINE GraphicsPipe *get_pipe() const;
   INLINE GraphicsPipe *get_pipe() const;
-  INLINE GraphicsEngine *get_engine() const;
+  GraphicsEngine *get_engine() const;
   INLINE const GraphicsThreadingModel &get_threading_model() const;
   INLINE const GraphicsThreadingModel &get_threading_model() const;
 
 
   INLINE bool is_hardware() const;
   INLINE bool is_hardware() const;