Browse Source

pass GraphicsEngine through to constructors

David Rose 17 years ago
parent
commit
7af1350e4e
71 changed files with 163 additions and 121 deletions
  1. 2 2
      panda/src/display/graphicsBuffer.cxx
  2. 2 1
      panda/src/display/graphicsBuffer.h
  3. 3 3
      panda/src/display/graphicsEngine.cxx
  4. 13 0
      panda/src/display/graphicsOutput.I
  5. 2 1
      panda/src/display/graphicsOutput.cxx
  6. 5 1
      panda/src/display/graphicsOutput.h
  7. 1 0
      panda/src/display/graphicsPipe.cxx
  8. 2 0
      panda/src/display/graphicsPipe.h
  9. 6 4
      panda/src/display/graphicsStateGuardian.cxx
  10. 1 1
      panda/src/display/graphicsStateGuardian.h
  11. 2 2
      panda/src/display/graphicsWindow.cxx
  12. 2 1
      panda/src/display/graphicsWindow.h
  13. 2 1
      panda/src/display/parasiteBuffer.cxx
  14. 2 2
      panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx
  15. 1 1
      panda/src/dxgsg8/dxGraphicsStateGuardian8.h
  16. 3 3
      panda/src/dxgsg8/wdxGraphicsBuffer8.cxx
  17. 1 1
      panda/src/dxgsg8/wdxGraphicsBuffer8.h
  18. 3 2
      panda/src/dxgsg8/wdxGraphicsPipe8.cxx
  19. 1 0
      panda/src/dxgsg8/wdxGraphicsPipe8.h
  20. 3 3
      panda/src/dxgsg8/wdxGraphicsWindow8.cxx
  21. 1 1
      panda/src/dxgsg8/wdxGraphicsWindow8.h
  22. 2 2
      panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx
  23. 1 1
      panda/src/dxgsg9/dxGraphicsStateGuardian9.h
  24. 3 3
      panda/src/dxgsg9/wdxGraphicsBuffer9.cxx
  25. 1 1
      panda/src/dxgsg9/wdxGraphicsBuffer9.h
  26. 3 2
      panda/src/dxgsg9/wdxGraphicsPipe9.cxx
  27. 1 0
      panda/src/dxgsg9/wdxGraphicsPipe9.h
  28. 3 3
      panda/src/dxgsg9/wdxGraphicsWindow9.cxx
  29. 1 1
      panda/src/dxgsg9/wdxGraphicsWindow9.h
  30. 2 2
      panda/src/glstuff/glGraphicsBuffer_src.cxx
  31. 1 1
      panda/src/glstuff/glGraphicsBuffer_src.h
  32. 2 2
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx
  33. 1 1
      panda/src/glstuff/glGraphicsStateGuardian_src.h
  34. 4 4
      panda/src/glxdisplay/glxGraphicsBuffer.cxx
  35. 1 1
      panda/src/glxdisplay/glxGraphicsBuffer.h
  36. 4 3
      panda/src/glxdisplay/glxGraphicsPipe.cxx
  37. 1 0
      panda/src/glxdisplay/glxGraphicsPipe.h
  38. 2 2
      panda/src/glxdisplay/glxGraphicsStateGuardian.cxx
  39. 1 1
      panda/src/glxdisplay/glxGraphicsStateGuardian.h
  40. 4 4
      panda/src/glxdisplay/glxGraphicsWindow.cxx
  41. 1 1
      panda/src/glxdisplay/glxGraphicsWindow.h
  42. 3 3
      panda/src/mesadisplay/osMesaGraphicsBuffer.cxx
  43. 1 1
      panda/src/mesadisplay/osMesaGraphicsBuffer.h
  44. 2 1
      panda/src/mesadisplay/osMesaGraphicsPipe.cxx
  45. 1 0
      panda/src/mesadisplay/osMesaGraphicsPipe.h
  46. 2 3
      panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx
  47. 1 1
      panda/src/mesadisplay/osMesaGraphicsStateGuardian.h
  48. 3 3
      panda/src/tinydisplay/tinyGraphicsBuffer.cxx
  49. 1 1
      panda/src/tinydisplay/tinyGraphicsBuffer.h
  50. 3 3
      panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx
  51. 1 1
      panda/src/tinydisplay/tinyGraphicsStateGuardian.h
  52. 2 1
      panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx
  53. 1 0
      panda/src/tinydisplay/tinyOffscreenGraphicsPipe.h
  54. 4 2
      panda/src/tinydisplay/tinyWinGraphicsPipe.cxx
  55. 1 0
      panda/src/tinydisplay/tinyWinGraphicsPipe.h
  56. 3 3
      panda/src/tinydisplay/tinyWinGraphicsWindow.cxx
  57. 1 1
      panda/src/tinydisplay/tinyWinGraphicsWindow.h
  58. 4 3
      panda/src/tinydisplay/tinyXGraphicsPipe.cxx
  59. 1 0
      panda/src/tinydisplay/tinyXGraphicsPipe.h
  60. 9 9
      panda/src/tinydisplay/tinyXGraphicsWindow.cxx
  61. 1 1
      panda/src/tinydisplay/tinyXGraphicsWindow.h
  62. 4 4
      panda/src/wgldisplay/wglGraphicsBuffer.cxx
  63. 1 1
      panda/src/wgldisplay/wglGraphicsBuffer.h
  64. 4 3
      panda/src/wgldisplay/wglGraphicsPipe.cxx
  65. 1 0
      panda/src/wgldisplay/wglGraphicsPipe.h
  66. 2 2
      panda/src/wgldisplay/wglGraphicsStateGuardian.cxx
  67. 1 1
      panda/src/wgldisplay/wglGraphicsStateGuardian.h
  68. 4 4
      panda/src/wgldisplay/wglGraphicsWindow.cxx
  69. 1 1
      panda/src/wgldisplay/wglGraphicsWindow.h
  70. 2 2
      panda/src/windisplay/winGraphicsWindow.cxx
  71. 1 1
      panda/src/windisplay/winGraphicsWindow.h

+ 2 - 2
panda/src/display/graphicsBuffer.cxx

@@ -24,13 +24,13 @@ TypeHandle GraphicsBuffer::_type_handle;
 //               GraphicsEngine::make_buffer() function.
 ////////////////////////////////////////////////////////////////////
 GraphicsBuffer::
-GraphicsBuffer(GraphicsPipe *pipe,
+GraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
                const string &name,
                const FrameBufferProperties &fb_prop,
                const WindowProperties &win_prop, int flags,
                GraphicsStateGuardian *gsg,
                GraphicsOutput *host) :
-  GraphicsOutput(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsOutput(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
 #ifdef DO_MEMORY_USAGE
   MemoryUsage::update_type(this, this);

+ 2 - 1
panda/src/display/graphicsBuffer.h

@@ -29,7 +29,8 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA_DISPLAY GraphicsBuffer : public GraphicsOutput {
 protected:
-  GraphicsBuffer(GraphicsPipe *pipe, 
+  GraphicsBuffer(GraphicsEngine *engine,
+                 GraphicsPipe *pipe, 
                  const string &name,
                  const FrameBufferProperties &fb_prop,
                  const WindowProperties &win_prop,

+ 3 - 3
panda/src/display/graphicsEngine.cxx

@@ -368,7 +368,7 @@ make_output(GraphicsPipe *pipe,
   for (int retry=0; retry<10; retry++) {
     bool precertify = false;
     PT(GraphicsOutput) window = 
-      pipe->make_output(name, fb_prop, win_prop, flags, gsg, host, retry, precertify);
+      pipe->make_output(name, fb_prop, win_prop, flags, this, gsg, host, retry, precertify);
     if (window != (GraphicsOutput *)NULL) {
       window->_sort = sort;
       if ((precertify) && (gsg != 0) && (window->get_gsg()==gsg)) {
@@ -1820,6 +1820,7 @@ void GraphicsEngine::
 do_add_window(GraphicsOutput *window,
               const GraphicsThreadingModel &threading_model) {
   LightReMutexHolder holder(_lock);
+  nassertv(window->get_engine() == this);
 
   // We have a special counter that is unique per window that allows
   // us to assure that recently-added windows end up on the end of the
@@ -1886,9 +1887,8 @@ do_add_gsg(GraphicsStateGuardian *gsg, GraphicsPipe *pipe,
            const GraphicsThreadingModel &threading_model) {
   LightReMutexHolder holder(_lock);
 
+  nassertv(gsg->get_pipe() == pipe && gsg->get_engine() == this);
   gsg->_threading_model = threading_model;
-  gsg->_pipe = pipe;
-  gsg->_engine = this;
   if (!_default_loader.is_null()) {
     gsg->set_loader(_default_loader);
   }

+ 13 - 0
panda/src/display/graphicsOutput.I

@@ -45,6 +45,19 @@ get_pipe() const {
   return _pipe;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsOutput::get_engine
+//       Access: Published
+//  Description: Returns the graphics engine that created this output.
+//               Since there is normally only one GraphicsEngine
+//               object in an application, this is usually the same as
+//               the global GraphicsEngine.
+////////////////////////////////////////////////////////////////////
+INLINE GraphicsEngine *GraphicsOutput::
+get_engine() const {
+  return _engine;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsOutput::get_name
 //       Access: Published

+ 2 - 1
panda/src/display/graphicsOutput.cxx

@@ -68,7 +68,7 @@ static CubeFaceDef cube_faces[6] = {
 //               GraphicsEngine::make_window() function.
 ////////////////////////////////////////////////////////////////////
 GraphicsOutput::
-GraphicsOutput(GraphicsPipe *pipe,
+GraphicsOutput(GraphicsEngine *engine, GraphicsPipe *pipe,
                const string &name,
                const FrameBufferProperties &fb_prop,
                const WindowProperties &win_prop,
@@ -82,6 +82,7 @@ GraphicsOutput(GraphicsPipe *pipe,
 #ifdef DO_MEMORY_USAGE
   MemoryUsage::update_type(this, this);
 #endif
+  _engine = engine;
   _pipe = pipe;
   _gsg = gsg;
   _host = host;

+ 5 - 1
panda/src/display/graphicsOutput.h

@@ -36,6 +36,7 @@
 #include "nodePath.h"
 
 class PNMImage;
+class GraphicsEngine;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : GraphicsOutput
@@ -59,7 +60,8 @@ class PNMImage;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA_DISPLAY GraphicsOutput : public TypedWritableReferenceCount, public DrawableRegion {
 protected:
-  GraphicsOutput(GraphicsPipe *pipe, 
+  GraphicsOutput(GraphicsEngine *engine,
+                 GraphicsPipe *pipe, 
                  const string &name,
                  const FrameBufferProperties &fb_prop,
                  const WindowProperties &win_prop, int flags,
@@ -91,6 +93,7 @@ PUBLISHED:
 
   INLINE GraphicsStateGuardian *get_gsg() const;
   INLINE GraphicsPipe *get_pipe() const;
+  INLINE GraphicsEngine *get_engine() const;
   INLINE const string &get_name() const;
 
   INLINE int count_textures() const;
@@ -236,6 +239,7 @@ protected:
     RenderTextureMode _rtm_mode;
   };
   PT(GraphicsStateGuardian) _gsg;
+  GraphicsEngine *_engine;
   PT(GraphicsPipe) _pipe;
   PT(GraphicsOutput) _host;
   FrameBufferProperties _fb_properties;

+ 1 - 0
panda/src/display/graphicsPipe.cxx

@@ -128,6 +128,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,

+ 2 - 0
panda/src/display/graphicsPipe.h

@@ -23,6 +23,7 @@
 #include "lightMutex.h"
 #include "displayInformation.h"
 
+class GraphicsEngine;
 class GraphicsOutput;
 class GraphicsWindow;
 class GraphicsBuffer;
@@ -116,6 +117,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 6 - 4
panda/src/display/graphicsStateGuardian.cxx

@@ -123,9 +123,10 @@ TypeHandle GraphicsStateGuardian::_type_handle;
 ////////////////////////////////////////////////////////////////////
 GraphicsStateGuardian::
 GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
-                      GraphicsPipe *pipe) :
+                      GraphicsEngine *engine, GraphicsPipe *pipe) :
   _internal_coordinate_system(internal_coordinate_system),
-  _pipe(pipe)
+  _pipe(pipe),
+  _engine(engine)
 {
   _coordinate_system = CS_invalid;
   _internal_transform = TransformState::make_identity();
@@ -230,8 +231,6 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
   
   _gamma = 1.0f;
   _texture_quality_override = Texture::QL_default;
-
-  _engine = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -255,6 +254,9 @@ GraphicsStateGuardian::
 //     Function: GraphicsStateGuardian::get_engine
 //       Access: Published
 //  Description: Returns the graphics engine that created this GSG.
+//               Since there is normally only one GraphicsEngine
+//               object in an application, this is usually the same as
+//               the global GraphicsEngine.
 ////////////////////////////////////////////////////////////////////
 GraphicsEngine *GraphicsStateGuardian::
 get_engine() const {

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

@@ -67,7 +67,7 @@ class EXPCL_PANDA_DISPLAY GraphicsStateGuardian : public GraphicsStateGuardianBa
   //
 public:
   GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
-                        GraphicsPipe *pipe);
+                        GraphicsEngine *engine, GraphicsPipe *pipe);
   virtual ~GraphicsStateGuardian();
 
 PUBLISHED:

+ 2 - 2
panda/src/display/graphicsWindow.cxx

@@ -32,14 +32,14 @@ TypeHandle GraphicsWindow::_type_handle;
 //               GraphicsEngine::make_window() function.
 ////////////////////////////////////////////////////////////////////
 GraphicsWindow::
-GraphicsWindow(GraphicsPipe *pipe,
+GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
                const string &name,
                const FrameBufferProperties &fb_prop,
                const WindowProperties &win_prop,
                int flags,
                GraphicsStateGuardian *gsg,
                GraphicsOutput *host) :
-  GraphicsOutput(pipe, name, fb_prop, win_prop, flags, gsg, host),
+  GraphicsOutput(engine, pipe, name, fb_prop, win_prop, flags, gsg, host),
   _input_lock("GraphicsWindow::_input_lock"),
   _properties_lock("GraphicsWindow::_properties_lock")
 {

+ 2 - 1
panda/src/display/graphicsWindow.h

@@ -36,7 +36,8 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA_DISPLAY GraphicsWindow : public GraphicsOutput {
 protected:
-  GraphicsWindow(GraphicsPipe *pipe, 
+  GraphicsWindow(GraphicsEngine *engine,
+                 GraphicsPipe *pipe, 
                  const string &name,
                  const FrameBufferProperties &fb_prop,
                  const WindowProperties &win_prop,

+ 2 - 1
panda/src/display/parasiteBuffer.cxx

@@ -27,7 +27,8 @@ TypeHandle ParasiteBuffer::_type_handle;
 ParasiteBuffer::
 ParasiteBuffer(GraphicsOutput *host, const string &name,
                int x_size, int y_size, int flags) :
-  GraphicsOutput(host->get_pipe(), name, host->get_fb_properties(),
+  GraphicsOutput(host->get_engine(), host->get_pipe(), 
+                 name, host->get_fb_properties(),
                  WindowProperties::size(x_size, y_size), flags, 
                  host->get_gsg(), host)
 {

+ 2 - 2
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -81,8 +81,8 @@ unsigned char *DXGraphicsStateGuardian8::_safe_buffer_start = NULL;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 DXGraphicsStateGuardian8::
-DXGraphicsStateGuardian8(GraphicsPipe *pipe) :
-  GraphicsStateGuardian(CS_yup_left, pipe)
+DXGraphicsStateGuardian8(GraphicsEngine *engine, GraphicsPipe *pipe) :
+  GraphicsStateGuardian(CS_yup_left, engine, pipe)
 {
   // Assume that we will get a hardware-accelerated context, unless
   // the window tells us otherwise.

+ 1 - 1
panda/src/dxgsg8/dxGraphicsStateGuardian8.h

@@ -43,7 +43,7 @@ class DXIndexBufferContext8;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX DXGraphicsStateGuardian8 : public GraphicsStateGuardian {
 public:
-  DXGraphicsStateGuardian8(GraphicsPipe *pipe);
+  DXGraphicsStateGuardian8(GraphicsEngine *engine, GraphicsPipe *pipe);
   ~DXGraphicsStateGuardian8();
 
   FrameBufferProperties

+ 3 - 3
panda/src/dxgsg8/wdxGraphicsBuffer8.cxx

@@ -37,14 +37,14 @@ TypeHandle wdxGraphicsBuffer8::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wdxGraphicsBuffer8::
-wdxGraphicsBuffer8(GraphicsPipe *pipe,
+wdxGraphicsBuffer8(GraphicsEngine *engine, GraphicsPipe *pipe,
                    const string &name,
                    const FrameBufferProperties &fb_prop,
                    const WindowProperties &win_prop,
                    int flags,
                    GraphicsStateGuardian *gsg,
                    GraphicsOutput *host):
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   // initialize all class members
   _cube_map_index = -1;
@@ -523,7 +523,7 @@ open_buffer() {
 
   // GSG creation/initialization.
   if (_gsg == 0) {
-    _dxgsg = new DXGraphicsStateGuardian8(_pipe);
+    _dxgsg = new DXGraphicsStateGuardian8(_engine, _pipe);
     _gsg = _dxgsg;
   } else {
     DCAST_INTO_R(_dxgsg, _gsg, false);

+ 1 - 1
panda/src/dxgsg8/wdxGraphicsBuffer8.h

@@ -32,7 +32,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX wdxGraphicsBuffer8 : public GraphicsBuffer {
 public:
-  wdxGraphicsBuffer8(GraphicsPipe *pipe,
+  wdxGraphicsBuffer8(GraphicsEngine *engine, GraphicsPipe *pipe,
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,

+ 3 - 2
panda/src/dxgsg8/wdxGraphicsPipe8.cxx

@@ -86,6 +86,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -121,7 +122,7 @@ make_output(const string &name,
         return NULL;
       }
     }
-    return new wdxGraphicsWindow8(this, name, fb_prop, win_prop,
+    return new wdxGraphicsWindow8(engine, this, name, fb_prop, win_prop,
                                   flags, gsg, host);
   }
 
@@ -159,7 +160,7 @@ make_output(const string &name,
         (gsg->get_supports_render_texture())) {
       precertify = true;
     }
-    return new wdxGraphicsBuffer8(this, name, fb_prop, win_prop,
+    return new wdxGraphicsBuffer8(engine, this, name, fb_prop, win_prop,
                                   flags, gsg, host);
   }
 

+ 1 - 0
panda/src/dxgsg8/wdxGraphicsPipe8.h

@@ -56,6 +56,7 @@ protected:
                                           const FrameBufferProperties &fb_prop,
                                           const WindowProperties &win_prop,
                                           int flags,
+                                          GraphicsEngine *engine,
                                           GraphicsStateGuardian *gsg,
                                           GraphicsOutput *host,
                                           int retry,

+ 3 - 3
panda/src/dxgsg8/wdxGraphicsWindow8.cxx

@@ -35,14 +35,14 @@ TypeHandle wdxGraphicsWindow8::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wdxGraphicsWindow8::
-wdxGraphicsWindow8(GraphicsPipe *pipe,
+wdxGraphicsWindow8(GraphicsEngine *engine, GraphicsPipe *pipe,
                    const string &name,
                    const FrameBufferProperties &fb_prop,
                    const WindowProperties &win_prop,
                    int flags,
                    GraphicsStateGuardian *gsg,
                    GraphicsOutput *host):
-  WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  WinGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   // dont actually create the window in the constructor.  reason:
   // multi-threading requires panda C++ window object to exist in
@@ -281,7 +281,7 @@ open_window() {
 
   // GSG creation/initialization.
   if (_gsg == 0) {
-    _dxgsg = new DXGraphicsStateGuardian8(_pipe);
+    _dxgsg = new DXGraphicsStateGuardian8(_engine, _pipe);
     _gsg = _dxgsg;
   } else {
     DCAST_INTO_R(_dxgsg, _gsg, false);

+ 1 - 1
panda/src/dxgsg8/wdxGraphicsWindow8.h

@@ -30,7 +30,7 @@ class wdxGraphicsPipe8;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX wdxGraphicsWindow8 : public WinGraphicsWindow {
 public:
-  wdxGraphicsWindow8(GraphicsPipe *pipe,
+  wdxGraphicsWindow8(GraphicsEngine *engine, GraphicsPipe *pipe,
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,

+ 2 - 2
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -93,8 +93,8 @@ LPDIRECT3DDEVICE9 DXGraphicsStateGuardian9::_cg_device = NULL;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 DXGraphicsStateGuardian9::
-DXGraphicsStateGuardian9(GraphicsPipe *pipe) :
-  GraphicsStateGuardian(CS_yup_left, pipe)
+DXGraphicsStateGuardian9(GraphicsEngine *engine, GraphicsPipe *pipe) :
+  GraphicsStateGuardian(CS_yup_left, engine, pipe)
 {
   if (dxgsg9_cat.is_debug()) {
     dxgsg9_cat.debug()

+ 1 - 1
panda/src/dxgsg9/dxGraphicsStateGuardian9.h

@@ -64,7 +64,7 @@ class DXIndexBufferContext9;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX DXGraphicsStateGuardian9 : public GraphicsStateGuardian {
 public:
-  DXGraphicsStateGuardian9(GraphicsPipe *pipe);
+  DXGraphicsStateGuardian9(GraphicsEngine *engine, GraphicsPipe *pipe);
   ~DXGraphicsStateGuardian9();
 
   FrameBufferProperties

+ 3 - 3
panda/src/dxgsg9/wdxGraphicsBuffer9.cxx

@@ -29,14 +29,14 @@ TypeHandle wdxGraphicsBuffer9::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wdxGraphicsBuffer9::
-wdxGraphicsBuffer9(GraphicsPipe *pipe,
+wdxGraphicsBuffer9(GraphicsEngine *engine, GraphicsPipe *pipe,
                    const string &name,
                    const FrameBufferProperties &fb_prop,
                    const WindowProperties &win_prop,
                    int flags,
                    GraphicsStateGuardian *gsg,
                    GraphicsOutput *host):
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   // initialize all class members
   _cube_map_index = -1;
@@ -745,7 +745,7 @@ open_buffer() {
 
   // GSG creation/initialization.
   if (_gsg == 0) {
-    _dxgsg = new DXGraphicsStateGuardian9(_pipe);
+    _dxgsg = new DXGraphicsStateGuardian9(_engine, _pipe);
     _gsg = _dxgsg;
   } else {
     DCAST_INTO_R(_dxgsg, _gsg, false);

+ 1 - 1
panda/src/dxgsg9/wdxGraphicsBuffer9.h

@@ -32,7 +32,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX wdxGraphicsBuffer9 : public GraphicsBuffer {
 public:
-  wdxGraphicsBuffer9(GraphicsPipe *pipe,
+  wdxGraphicsBuffer9(GraphicsEngine *engine, GraphicsPipe *pipe,
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,

+ 3 - 2
panda/src/dxgsg9/wdxGraphicsPipe9.cxx

@@ -86,6 +86,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -121,7 +122,7 @@ make_output(const string &name,
         return NULL;
       }
     }
-    return new wdxGraphicsWindow9(this, name, fb_prop, win_prop,
+    return new wdxGraphicsWindow9(engine, this, name, fb_prop, win_prop,
                                   flags, gsg, host);
   }
 
@@ -155,7 +156,7 @@ make_output(const string &name,
         (gsg->get_supports_render_texture())) {
       precertify = true;
     }
-    return new wdxGraphicsBuffer9(this, name, fb_prop, win_prop,
+    return new wdxGraphicsBuffer9(engine, this, name, fb_prop, win_prop,
                                   flags, gsg, host);
   }
 

+ 1 - 0
panda/src/dxgsg9/wdxGraphicsPipe9.h

@@ -56,6 +56,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 3 - 3
panda/src/dxgsg9/wdxGraphicsWindow9.cxx

@@ -35,14 +35,14 @@ TypeHandle wdxGraphicsWindow9::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wdxGraphicsWindow9::
-wdxGraphicsWindow9(GraphicsPipe *pipe,
+wdxGraphicsWindow9(GraphicsEngine *engine, GraphicsPipe *pipe,
                    const string &name,
                    const FrameBufferProperties &fb_prop,
                    const WindowProperties &win_prop,
                    int flags,
                    GraphicsStateGuardian *gsg,
                    GraphicsOutput *host):
-  WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  WinGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   // dont actually create the window in the constructor.  reason:
   // multi-threading requires panda C++ window object to exist in
@@ -283,7 +283,7 @@ open_window() {
   bool discard_device = always_discard_device;
 
   if (_gsg == 0) {
-    _dxgsg = new DXGraphicsStateGuardian9(_pipe);
+    _dxgsg = new DXGraphicsStateGuardian9(_engine, _pipe);
     _gsg = _dxgsg;
   } else {
     DCAST_INTO_R(_dxgsg, _gsg, false);

+ 1 - 1
panda/src/dxgsg9/wdxGraphicsWindow9.h

@@ -30,7 +30,7 @@ class wdxGraphicsPipe9;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDADX wdxGraphicsWindow9 : public WinGraphicsWindow {
 public:
-  wdxGraphicsWindow9(GraphicsPipe *pipe,
+  wdxGraphicsWindow9(GraphicsEngine *engine, GraphicsPipe *pipe,
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,

+ 2 - 2
panda/src/glstuff/glGraphicsBuffer_src.cxx

@@ -20,14 +20,14 @@ TypeHandle CLP(GraphicsBuffer)::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 CLP(GraphicsBuffer)::
-CLP(GraphicsBuffer)(GraphicsPipe *pipe,
+CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe,
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,
                     int flags,
                     GraphicsStateGuardian *gsg,
                     GraphicsOutput *host) :
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   // An FBO doesn't have a back buffer.
   _draw_buffer_type       = RenderBuffer::T_front;

+ 1 - 1
panda/src/glstuff/glGraphicsBuffer_src.h

@@ -52,7 +52,7 @@
 
 class EXPCL_GL CLP(GraphicsBuffer) : public GraphicsBuffer {
 public:
-  CLP(GraphicsBuffer)(GraphicsPipe *pipe,
+  CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe,
                       const string &name,
                       const FrameBufferProperties &fb_prop,
                       const WindowProperties &win_prop,

+ 2 - 2
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -254,8 +254,8 @@ fix_component_ordering(PTA_uchar &new_image,
 //  Description:
 ////////////////////////////////////////////////////////////////////
 CLP(GraphicsStateGuardian)::
-CLP(GraphicsStateGuardian)(GraphicsPipe *pipe) :
-  GraphicsStateGuardian(CS_yup_right, pipe)
+CLP(GraphicsStateGuardian)(GraphicsEngine *engine, GraphicsPipe *pipe) :
+  GraphicsStateGuardian(CS_yup_right, engine, pipe)
 {
   _error_count = 0;
 

+ 1 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.h

@@ -108,7 +108,7 @@ typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
 ////////////////////////////////////////////////////////////////////
 class EXPCL_GL CLP(GraphicsStateGuardian) : public GraphicsStateGuardian {
 public:
-  CLP(GraphicsStateGuardian)(GraphicsPipe *pipe);
+  CLP(GraphicsStateGuardian)(GraphicsEngine *engine, GraphicsPipe *pipe);
   virtual ~CLP(GraphicsStateGuardian)();
 
   virtual void reset();

+ 4 - 4
panda/src/glxdisplay/glxGraphicsBuffer.cxx

@@ -33,14 +33,14 @@ TypeHandle glxGraphicsBuffer::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 glxGraphicsBuffer::
-glxGraphicsBuffer(GraphicsPipe *pipe, 
+glxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                   const string &name,
                   const FrameBufferProperties &fb_prop,
                   const WindowProperties &win_prop,
                   int flags,
                   GraphicsStateGuardian *gsg,
                   GraphicsOutput *host) :
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   glxGraphicsPipe *glx_pipe;
   DCAST_INTO_V(glx_pipe, _pipe);
@@ -169,7 +169,7 @@ open_buffer() {
   glxGraphicsStateGuardian *glxgsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    glxgsg = new glxGraphicsStateGuardian(_pipe, NULL);
+    glxgsg = new glxGraphicsStateGuardian(_engine, _pipe, NULL);
     glxgsg->choose_pixel_format(_fb_properties, glx_pipe->get_display(), glx_pipe->get_screen(), true);
     _gsg = glxgsg;
   } else {
@@ -177,7 +177,7 @@ open_buffer() {
     // new one that shares with the old gsg.
     DCAST_INTO_R(glxgsg, _gsg, false);
     if (!glxgsg->get_fb_properties().subsumes(_fb_properties)) {
-      glxgsg = new glxGraphicsStateGuardian(_pipe, glxgsg);
+      glxgsg = new glxGraphicsStateGuardian(_engine, _pipe, glxgsg);
       glxgsg->choose_pixel_format(_fb_properties, glx_pipe->get_display(), glx_pipe->get_screen(), true);
       _gsg = glxgsg;
     }

+ 1 - 1
panda/src/glxdisplay/glxGraphicsBuffer.h

@@ -31,7 +31,7 @@
 ////////////////////////////////////////////////////////////////////
 class glxGraphicsBuffer : public GraphicsBuffer {
 public:
-  glxGraphicsBuffer(GraphicsPipe *pipe, 
+  glxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,

+ 4 - 3
panda/src/glxdisplay/glxGraphicsPipe.cxx

@@ -202,6 +202,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -235,7 +236,7 @@ make_output(const string &name,
         ((flags&BF_can_bind_every)!=0)) {
       return NULL;
     }
-    return new glxGraphicsWindow(this, name, fb_prop, win_prop,
+    return new glxGraphicsWindow(engine, this, name, fb_prop, win_prop,
                                  flags, gsg, host);
   }
   
@@ -268,7 +269,7 @@ make_output(const string &name,
         (fb_prop.is_basic())) {
       precertify = true;
     }
-    return new GLGraphicsBuffer(this, name, fb_prop, win_prop,
+    return new GLGraphicsBuffer(engine, this, name, fb_prop, win_prop,
                                 flags, gsg, host);
   }
   
@@ -285,7 +286,7 @@ make_output(const string &name,
         ((flags&BF_can_bind_every)!=0)) {
       return NULL;
     }
-    return new glxGraphicsBuffer(this, name, fb_prop, win_prop,
+    return new glxGraphicsBuffer(engine, this, name, fb_prop, win_prop,
                                  flags, gsg, host);
   }
 #endif  // HAVE_GLXFBCONFIG

+ 1 - 0
panda/src/glxdisplay/glxGraphicsPipe.h

@@ -122,6 +122,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 2 - 2
panda/src/glxdisplay/glxGraphicsStateGuardian.cxx

@@ -28,9 +28,9 @@ TypeHandle glxGraphicsStateGuardian::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 glxGraphicsStateGuardian::
-glxGraphicsStateGuardian(GraphicsPipe *pipe,
+glxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
 			 glxGraphicsStateGuardian *share_with) :
-  GLGraphicsStateGuardian(pipe)
+  GLGraphicsStateGuardian(engine, pipe)
 {
   _share_context=0;
   _context=0;

+ 1 - 1
panda/src/glxdisplay/glxGraphicsStateGuardian.h

@@ -85,7 +85,7 @@ public:
 			   int _screen,
 			   bool need_pbuffer);
   
-  glxGraphicsStateGuardian(GraphicsPipe *pipe,
+  glxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
 			   glxGraphicsStateGuardian *share_with);
 
   virtual ~glxGraphicsStateGuardian();

+ 4 - 4
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -47,14 +47,14 @@ TypeHandle glxGraphicsWindow::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 glxGraphicsWindow::
-glxGraphicsWindow(GraphicsPipe *pipe, 
+glxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                   const string &name,
                   const FrameBufferProperties &fb_prop,
                   const WindowProperties &win_prop,
                   int flags,
                   GraphicsStateGuardian *gsg,
                   GraphicsOutput *host) :
-  GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   glxGraphicsPipe *glx_pipe;
   DCAST_INTO_V(glx_pipe, _pipe);
@@ -616,7 +616,7 @@ open_window() {
   glxGraphicsStateGuardian *glxgsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    glxgsg = new glxGraphicsStateGuardian(_pipe, NULL);
+    glxgsg = new glxGraphicsStateGuardian(_engine, _pipe, NULL);
     glxgsg->choose_pixel_format(_fb_properties, glx_pipe->get_display(), glx_pipe->get_screen(), false);
     _gsg = glxgsg;
   } else {
@@ -624,7 +624,7 @@ open_window() {
     // new one that shares with the old gsg.
     DCAST_INTO_R(glxgsg, _gsg, false);
     if (!glxgsg->get_fb_properties().subsumes(_fb_properties)) {
-      glxgsg = new glxGraphicsStateGuardian(_pipe, glxgsg);
+      glxgsg = new glxGraphicsStateGuardian(_engine, _pipe, glxgsg);
       glxgsg->choose_pixel_format(_fb_properties, glx_pipe->get_display(), glx_pipe->get_screen(), false);
       _gsg = glxgsg;
     }

+ 1 - 1
panda/src/glxdisplay/glxGraphicsWindow.h

@@ -28,7 +28,7 @@
 ////////////////////////////////////////////////////////////////////
 class glxGraphicsWindow : public GraphicsWindow {
 public:
-  glxGraphicsWindow(GraphicsPipe *pipe, 
+  glxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,

+ 3 - 3
panda/src/mesadisplay/osMesaGraphicsBuffer.cxx

@@ -25,14 +25,14 @@ TypeHandle OsMesaGraphicsBuffer::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 OsMesaGraphicsBuffer::
-OsMesaGraphicsBuffer(GraphicsPipe *pipe,
+OsMesaGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,
                      int flags,
                      GraphicsStateGuardian *gsg,
                      GraphicsOutput *host) :
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   _type = GL_UNSIGNED_BYTE;
   _screenshot_buffer_type = _draw_buffer_type;
@@ -131,7 +131,7 @@ close_buffer() {
 bool OsMesaGraphicsBuffer::
 open_buffer() {
   if (_gsg == 0) {
-    _gsg = new OSMesaGraphicsStateGuardian(_pipe, NULL);
+    _gsg = new OSMesaGraphicsStateGuardian(_engine, _pipe, NULL);
   }
   
   _image = PTA_uchar::empty_array(_x_size * _y_size * 4);

+ 1 - 1
panda/src/mesadisplay/osMesaGraphicsBuffer.h

@@ -28,7 +28,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAMESA OsMesaGraphicsBuffer : public GraphicsBuffer {
 public:
-  OsMesaGraphicsBuffer(GraphicsPipe *pipe, 
+  OsMesaGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                        const string &name,
                        const FrameBufferProperties &fb_prop,
                        const WindowProperties &win_prop,

+ 2 - 1
panda/src/mesadisplay/osMesaGraphicsPipe.cxx

@@ -78,6 +78,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -103,7 +104,7 @@ make_output(const string &name,
     FrameBufferProperties fb_prop2 = fb_prop;
     fb_prop2.set_back_buffers(0);
 
-    return new OsMesaGraphicsBuffer(this, name, fb_prop2, win_prop,
+    return new OsMesaGraphicsBuffer(engine, this, name, fb_prop2, win_prop,
                                     flags, gsg, host);
   }
   

+ 1 - 0
panda/src/mesadisplay/osMesaGraphicsPipe.h

@@ -46,6 +46,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 2 - 3
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx

@@ -22,9 +22,9 @@ TypeHandle OSMesaGraphicsStateGuardian::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 OSMesaGraphicsStateGuardian::
-OSMesaGraphicsStateGuardian(GraphicsPipe *pipe,
+OSMesaGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
 			    OSMesaGraphicsStateGuardian *share_with) : 
-  MesaGraphicsStateGuardian(pipe)
+  MesaGraphicsStateGuardian(engine, pipe)
 {
   OSMesaContext share_context = NULL;
   if (share_with != (OSMesaGraphicsStateGuardian *)NULL) {
@@ -36,7 +36,6 @@ OSMesaGraphicsStateGuardian(GraphicsPipe *pipe,
 
   // OSMesa is never hardware-accelerated.
   _is_hardware = false;
-  cerr << "constructed " << this << "\n";
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
panda/src/mesadisplay/osMesaGraphicsStateGuardian.h

@@ -25,7 +25,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAMESA OSMesaGraphicsStateGuardian : public MesaGraphicsStateGuardian {
 public:
-  OSMesaGraphicsStateGuardian(GraphicsPipe *pipe,
+  OSMesaGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
 			      OSMesaGraphicsStateGuardian *share_with);
   virtual ~OSMesaGraphicsStateGuardian();
 

+ 3 - 3
panda/src/tinydisplay/tinyGraphicsBuffer.cxx

@@ -27,14 +27,14 @@ TypeHandle TinyGraphicsBuffer::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 TinyGraphicsBuffer::
-TinyGraphicsBuffer(GraphicsPipe *pipe, 
+TinyGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                    const string &name,
                    const FrameBufferProperties &fb_prop,
                    const WindowProperties &win_prop,
                    int flags,
                    GraphicsStateGuardian *gsg,
                    GraphicsOutput *host) :
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   _frame_buffer = NULL;
 }
@@ -134,7 +134,7 @@ open_buffer() {
   TinyGraphicsStateGuardian *tinygsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    tinygsg = new TinyGraphicsStateGuardian(_pipe, NULL);
+    tinygsg = new TinyGraphicsStateGuardian(_engine, _pipe, NULL);
     _gsg = tinygsg;
   } else {
     DCAST_INTO_R(tinygsg, _gsg, false);

+ 1 - 1
panda/src/tinydisplay/tinyGraphicsBuffer.h

@@ -25,7 +25,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_TINYDISPLAY TinyGraphicsBuffer : public GraphicsBuffer {
 public:
-  TinyGraphicsBuffer(GraphicsPipe *pipe, 
+  TinyGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                      const string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,

+ 3 - 3
panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx

@@ -62,9 +62,9 @@ PStatCollector TinyGraphicsStateGuardian::_pixel_count_smooth_multitex3_pcollect
 //  Description:
 ////////////////////////////////////////////////////////////////////
 TinyGraphicsStateGuardian::
-TinyGraphicsStateGuardian(GraphicsPipe *pipe,
-			 TinyGraphicsStateGuardian *share_with) :
-  GraphicsStateGuardian(CS_yup_right, pipe)
+TinyGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
+                          TinyGraphicsStateGuardian *share_with) :
+  GraphicsStateGuardian(CS_yup_right, engine, pipe)
 {
   _current_frame_buffer = NULL;
   _aux_frame_buffer = NULL;

+ 1 - 1
panda/src/tinydisplay/tinyGraphicsStateGuardian.h

@@ -42,7 +42,7 @@ class TinyTextureContext;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_TINYDISPLAY TinyGraphicsStateGuardian : public GraphicsStateGuardian {
 public:
-  TinyGraphicsStateGuardian(GraphicsPipe *pipe,
+  TinyGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
                             TinyGraphicsStateGuardian *share_with);
 
   virtual ~TinyGraphicsStateGuardian();

+ 2 - 1
panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx

@@ -79,6 +79,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -90,7 +91,7 @@ make_output(const string &name,
         ((flags&BF_require_window)!=0)) {
       return NULL;
     }
-    return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
+    return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
   }
   
   // Nothing else left to try.

+ 1 - 0
panda/src/tinydisplay/tinyOffscreenGraphicsPipe.h

@@ -41,6 +41,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 4 - 2
panda/src/tinydisplay/tinyWinGraphicsPipe.cxx

@@ -80,6 +80,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -113,7 +114,7 @@ make_output(const string &name,
         return NULL;
       }
     }
-    return new TinyWinGraphicsWindow(this, name, fb_prop, win_prop,
+    return new TinyWinGraphicsWindow(engine, this, name, fb_prop, win_prop,
                                      flags, gsg, host);
   }
   
@@ -123,7 +124,8 @@ make_output(const string &name,
         ((flags&BF_require_window)!=0)) {
       return NULL;
     }
-    return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
+    return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, 
+                                  flags, gsg, host);
   }
   
   // Nothing else left to try.

+ 1 - 0
panda/src/tinydisplay/tinyWinGraphicsPipe.h

@@ -41,6 +41,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 3 - 3
panda/src/tinydisplay/tinyWinGraphicsWindow.cxx

@@ -33,14 +33,14 @@ TypeHandle TinyWinGraphicsWindow::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 TinyWinGraphicsWindow::
-TinyWinGraphicsWindow(GraphicsPipe *pipe, 
+TinyWinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                       const string &name,
                       const FrameBufferProperties &fb_prop,
                       const WindowProperties &win_prop,
                       int flags,
                       GraphicsStateGuardian *gsg,
                       GraphicsOutput *host) :
-  WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  WinGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   _frame_buffer = NULL;
   _hdc = (HDC)0;
@@ -209,7 +209,7 @@ open_window() {
   TinyGraphicsStateGuardian *tinygsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    tinygsg = new TinyGraphicsStateGuardian(_pipe, NULL);
+    tinygsg = new TinyGraphicsStateGuardian(_engine, _pipe, NULL);
     _gsg = tinygsg;
   } else {
     DCAST_INTO_R(tinygsg, _gsg, false);

+ 1 - 1
panda/src/tinydisplay/tinyWinGraphicsWindow.h

@@ -29,7 +29,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_TINYDISPLAY TinyWinGraphicsWindow : public WinGraphicsWindow {
 public:
-  TinyWinGraphicsWindow(GraphicsPipe *pipe, 
+  TinyWinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                         const string &name,
                         const FrameBufferProperties &fb_prop,
                         const WindowProperties &win_prop,

+ 4 - 3
panda/src/tinydisplay/tinyXGraphicsPipe.cxx

@@ -197,6 +197,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -221,8 +222,8 @@ make_output(const string &name,
         ((flags&BF_can_bind_every)!=0)) {
       return NULL;
     }
-    return new TinyXGraphicsWindow(this, name, fb_prop, win_prop,
-                                 flags, gsg, host);
+    return new TinyXGraphicsWindow(engine, this, name, fb_prop, win_prop,
+                                   flags, gsg, host);
   }
   
   // Second thing to try: a TinyGraphicsBuffer
@@ -234,7 +235,7 @@ make_output(const string &name,
         ((flags&BF_require_window)!=0)) {
       return NULL;
     }
-    return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
+    return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
   }
   
   // Nothing else left to try.

+ 1 - 0
panda/src/tinydisplay/tinyXGraphicsPipe.h

@@ -85,6 +85,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 9 - 9
panda/src/tinydisplay/tinyXGraphicsWindow.cxx

@@ -50,14 +50,14 @@ TypeHandle TinyXGraphicsWindow::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 TinyXGraphicsWindow::
-TinyXGraphicsWindow(GraphicsPipe *pipe, 
-                  const string &name,
-                  const FrameBufferProperties &fb_prop,
-                  const WindowProperties &win_prop,
-                  int flags,
-                  GraphicsStateGuardian *gsg,
-                  GraphicsOutput *host) :
-  GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
+                    const string &name,
+                    const FrameBufferProperties &fb_prop,
+                    const WindowProperties &win_prop,
+                    int flags,
+                    GraphicsStateGuardian *gsg,
+                    GraphicsOutput *host) :
+  GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   TinyXGraphicsPipe *tinyx_pipe;
   DCAST_INTO_V(tinyx_pipe, _pipe);
@@ -647,7 +647,7 @@ open_window() {
   TinyGraphicsStateGuardian *tinygsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    tinygsg = new TinyGraphicsStateGuardian(_pipe, NULL);
+    tinygsg = new TinyGraphicsStateGuardian(_engine, _pipe, NULL);
     _gsg = tinygsg;
   } else {
     DCAST_INTO_R(tinygsg, _gsg, false);

+ 1 - 1
panda/src/tinydisplay/tinyXGraphicsWindow.h

@@ -30,7 +30,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_TINYDISPLAY TinyXGraphicsWindow : public GraphicsWindow {
 public:
-  TinyXGraphicsWindow(GraphicsPipe *pipe, 
+  TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                       const string &name,
                       const FrameBufferProperties &fb_prop,
                       const WindowProperties &win_prop,

+ 4 - 4
panda/src/wgldisplay/wglGraphicsBuffer.cxx

@@ -29,14 +29,14 @@ TypeHandle wglGraphicsBuffer::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wglGraphicsBuffer::
-wglGraphicsBuffer(GraphicsPipe *pipe,
+wglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
                   const string &name,
                   const FrameBufferProperties &fb_prop,
                   const WindowProperties &win_prop,
                   int flags,
                   GraphicsStateGuardian *gsg,
                   GraphicsOutput *host) :
-  GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   _pbuffer = (HPBUFFERARB)0;
   _pbuffer_dc = (HDC)0;
@@ -288,7 +288,7 @@ open_buffer() {
   wglGraphicsStateGuardian *wglgsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    wglgsg = new wglGraphicsStateGuardian(_pipe, NULL);
+    wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, NULL);
     wglgsg->choose_pixel_format(_fb_properties, true);
     _gsg = wglgsg;
   } else {
@@ -298,7 +298,7 @@ open_buffer() {
     if ((!wglgsg->get_fb_properties().subsumes(_fb_properties))||
         (!wglgsg->get_fb_properties().is_single_buffered())||
         (!wglgsg->pfnum_supports_pbuffer())) {
-      wglgsg = new wglGraphicsStateGuardian(_pipe, wglgsg);
+      wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, wglgsg);
       wglgsg->choose_pixel_format(_fb_properties, true);
       _gsg = wglgsg;
     }

+ 1 - 1
panda/src/wgldisplay/wglGraphicsBuffer.h

@@ -37,7 +37,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAGL wglGraphicsBuffer : public GraphicsBuffer {
 public:
-  wglGraphicsBuffer(GraphicsPipe *pipe, 
+  wglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,

+ 4 - 3
panda/src/wgldisplay/wglGraphicsPipe.cxx

@@ -107,6 +107,7 @@ make_output(const string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,
+            GraphicsEngine *engine,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host,
             int retry,
@@ -148,7 +149,7 @@ make_output(const string &name,
         return NULL;
       }
     }
-    return new wglGraphicsWindow(this, name, fb_prop, win_prop,
+    return new wglGraphicsWindow(engine, this, name, fb_prop, win_prop,
                                  flags, gsg, host);
   }
   
@@ -182,7 +183,7 @@ make_output(const string &name,
         (fb_prop.is_basic())) {
       precertify = true;
     }
-    return new GLGraphicsBuffer(this, name, fb_prop, win_prop,
+    return new GLGraphicsBuffer(engine, this, name, fb_prop, win_prop,
                                 flags, gsg, host);
   }
   
@@ -215,7 +216,7 @@ make_output(const string &name,
         (wglgsg->get_fb_properties().is_single_buffered())) {
       precertify = true;
     }
-    return new wglGraphicsBuffer(this, name, fb_prop, win_prop,
+    return new wglGraphicsBuffer(engine, this, name, fb_prop, win_prop,
                                  flags, gsg, host);
   }
   

+ 1 - 0
panda/src/wgldisplay/wglGraphicsPipe.h

@@ -39,6 +39,7 @@ protected:
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,
+                                         GraphicsEngine *engine,
                                          GraphicsStateGuardian *gsg,
                                          GraphicsOutput *host,
                                          int retry,

+ 2 - 2
panda/src/wgldisplay/wglGraphicsStateGuardian.cxx

@@ -27,9 +27,9 @@ bool wglGraphicsStateGuardian::_twindow_class_registered = false;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wglGraphicsStateGuardian::
-wglGraphicsStateGuardian(GraphicsPipe *pipe,
+wglGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
                          wglGraphicsStateGuardian *share_with) : 
-  GLGraphicsStateGuardian(pipe),
+  GLGraphicsStateGuardian(engine, pipe),
   _share_with(share_with)
 {
   _made_context = false;

+ 1 - 1
panda/src/wgldisplay/wglGraphicsStateGuardian.h

@@ -30,7 +30,7 @@
 ////////////////////////////////////////////////////////////////////
 class wglGraphicsStateGuardian : public GLGraphicsStateGuardian {
 public:
-  wglGraphicsStateGuardian(GraphicsPipe *pipe,
+  wglGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
                            wglGraphicsStateGuardian *share_with);
   virtual ~wglGraphicsStateGuardian();
 

+ 4 - 4
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -29,14 +29,14 @@ TypeHandle wglGraphicsWindow::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 wglGraphicsWindow::
-wglGraphicsWindow(GraphicsPipe *pipe, 
+wglGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                   const string &name,
                   const FrameBufferProperties &fb_prop,
                   const WindowProperties &win_prop,
                   int flags,
                   GraphicsStateGuardian *gsg,
                   GraphicsOutput *host) :
-  WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  WinGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   _hdc = (HDC)0;
 }
@@ -180,7 +180,7 @@ open_window() {
   wglGraphicsStateGuardian *wglgsg;
   if (_gsg == 0) {
     // There is no old gsg.  Create a new one.
-    wglgsg = new wglGraphicsStateGuardian(_pipe, NULL);
+    wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, NULL);
     wglgsg->choose_pixel_format(_fb_properties, false);
     _gsg = wglgsg;
   } else {
@@ -188,7 +188,7 @@ open_window() {
     // new one that shares with the old gsg.
     DCAST_INTO_R(wglgsg, _gsg, false);
     if (!wglgsg->get_fb_properties().subsumes(_fb_properties)) {
-      wglgsg = new wglGraphicsStateGuardian(_pipe, wglgsg);
+      wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, wglgsg);
       wglgsg->choose_pixel_format(_fb_properties, false);
       _gsg = wglgsg;
     }

+ 1 - 1
panda/src/wgldisplay/wglGraphicsWindow.h

@@ -25,7 +25,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAGL wglGraphicsWindow : public WinGraphicsWindow {
 public:
-  wglGraphicsWindow(GraphicsPipe *pipe, 
+  wglGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,

+ 2 - 2
panda/src/windisplay/winGraphicsWindow.cxx

@@ -82,14 +82,14 @@ static tRegisterRawInputDevices  pRegisterRawInputDevices;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 WinGraphicsWindow::
-WinGraphicsWindow(GraphicsPipe *pipe,
+WinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
                   const string &name,
                   const FrameBufferProperties &fb_prop,
                   const WindowProperties &win_prop,
                   int flags,
                   GraphicsStateGuardian *gsg,
                   GraphicsOutput *host) : 
-  GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
+  GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
   initialize_input_devices();
   _hWnd = (HWND)0;

+ 1 - 1
panda/src/windisplay/winGraphicsWindow.h

@@ -41,7 +41,7 @@ class WinGraphicsPipe;
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAWIN WinGraphicsWindow : public GraphicsWindow {
 public:
-  WinGraphicsWindow(GraphicsPipe *pipe,
+  WinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
                     const string &name,
                     const FrameBufferProperties &fb_prop,
                     const WindowProperties &win_prop,