Browse Source

correctly release gsg on window close

David Rose 18 years ago
parent
commit
d1a06d8f02

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

@@ -370,6 +370,18 @@ get_render_buffer(int buffer_type, const FrameBufferProperties &prop) {
   return RenderBuffer(this, buffer_type & prop.get_buffer_mask() & _stereo_buffer_mask);
   return RenderBuffer(this, buffer_type & prop.get_buffer_mask() & _stereo_buffer_mask);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsStateGuardian::get_prepared_objects
+//       Access: Public, Virtual
+//  Description: Returns the set of texture and geom objects that have
+//               been prepared with this GSG (and possibly other GSG's
+//               that share objects).
+////////////////////////////////////////////////////////////////////
+PreparedGraphicsObjects *GraphicsStateGuardian::
+get_prepared_objects() {
+  return _prepared_objects;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsStateGuardian::set_scene
 //     Function: GraphicsStateGuardian::set_scene
 //       Access: Public
 //       Access: Public
@@ -404,18 +416,6 @@ get_scene() const {
   return _scene_setup;
   return _scene_setup;
 }
 }
 
 
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsStateGuardian::get_prepared_objects
-//       Access: Public, Virtual
-//  Description: Returns the set of texture and geom objects that have
-//               been prepared with this GSG (and possibly other GSG's
-//               that share objects).
-////////////////////////////////////////////////////////////////////
-PreparedGraphicsObjects *GraphicsStateGuardian::
-get_prepared_objects() {
-  return _prepared_objects;
-}
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsStateGuardian::prepare_texture
 //     Function: GraphicsStateGuardian::prepare_texture
 //       Access: Public, Virtual
 //       Access: Public, Virtual

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

@@ -152,12 +152,12 @@ PUBLISHED:
   INLINE void make_global_gsg();
   INLINE void make_global_gsg();
   INLINE static GraphicsStateGuardian *get_global_gsg();
   INLINE static GraphicsStateGuardian *get_global_gsg();
 
 
+  virtual PreparedGraphicsObjects *get_prepared_objects();
+
 public:
 public:
   bool set_scene(SceneSetup *scene_setup);
   bool set_scene(SceneSetup *scene_setup);
   virtual SceneSetup *get_scene() const;
   virtual SceneSetup *get_scene() const;
 
 
-  virtual PreparedGraphicsObjects *get_prepared_objects();
-
   virtual TextureContext *prepare_texture(Texture *tex);
   virtual TextureContext *prepare_texture(Texture *tex);
   virtual void release_texture(TextureContext *tc);
   virtual void release_texture(TextureContext *tc);
   virtual bool extract_texture_data(Texture *tex);
   virtual bool extract_texture_data(Texture *tex);

+ 5 - 0
panda/src/display/standardMunger.cxx

@@ -224,6 +224,11 @@ munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data,
 int StandardMunger::
 int StandardMunger::
 compare_to_impl(const GeomMunger *other) const {
 compare_to_impl(const GeomMunger *other) const {
   const StandardMunger *om = DCAST(StandardMunger, other);
   const StandardMunger *om = DCAST(StandardMunger, other);
+
+  if (_gsg != om->_gsg) {
+    return _gsg < om->_gsg ? -1 : 1;
+  }
+
   if (_render_mode != om->_render_mode) {
   if (_render_mode != om->_render_mode) {
     return _render_mode < om->_render_mode ? -1 : 1;
     return _render_mode < om->_render_mode ? -1 : 1;
   }
   }

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

@@ -26,6 +26,7 @@
 #include "colorScaleAttrib.h"
 #include "colorScaleAttrib.h"
 #include "renderModeAttrib.h"
 #include "renderModeAttrib.h"
 #include "pointerTo.h"
 #include "pointerTo.h"
+#include "weakPointerTo.h"
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : StandardMunger
 //       Class : StandardMunger
@@ -55,7 +56,7 @@ private:
   int _num_components;
   int _num_components;
   NumericType _numeric_type;
   NumericType _numeric_type;
   Contents _contents;
   Contents _contents;
-  PT(GraphicsStateGuardian) _gsg;
+  WPT(GraphicsStateGuardian) _gsg;
   CPT(RenderModeAttrib) _render_mode;
   CPT(RenderModeAttrib) _render_mode;
 
 
   bool _munge_color;
   bool _munge_color;

+ 1 - 4
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -2938,10 +2938,7 @@ close_gsg() {
   // Unlike in OpenGL, in DX8 it is safe to try to explicitly release
   // Unlike in OpenGL, in DX8 it is safe to try to explicitly release
   // any textures here.  And it may even be a good idea.
   // any textures here.  And it may even be a good idea.
   if (_prepared_objects->get_ref_count() == 1) {
   if (_prepared_objects->get_ref_count() == 1) {
-    release_all_textures();
-    release_all_geoms();
-    release_all_vertex_buffers();
-    release_all_index_buffers();
+    release_all();
 
 
     // Now we need to actually delete all of the objects we just
     // Now we need to actually delete all of the objects we just
     // released.
     // released.

+ 1 - 4
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -4048,10 +4048,7 @@ close_gsg() {
   // Unlike in OpenGL, in DX9 it is safe to try to explicitly release
   // Unlike in OpenGL, in DX9 it is safe to try to explicitly release
   // any textures here.  And it may even be a good idea.
   // any textures here.  And it may even be a good idea.
   if (_prepared_objects->get_ref_count() == 1) {
   if (_prepared_objects->get_ref_count() == 1) {
-    release_all_textures();
-    release_all_geoms();
-    release_all_vertex_buffers();
-    release_all_index_buffers();
+    release_all();
 
 
     // Now we need to actually delete all of the objects we just
     // Now we need to actually delete all of the objects we just
     // released.
     // released.

+ 2 - 0
panda/src/gobj/bufferContext.h

@@ -47,9 +47,11 @@ public:
   BufferContext(BufferResidencyTracker *residency);
   BufferContext(BufferResidencyTracker *residency);
   virtual ~BufferContext();
   virtual ~BufferContext();
 
 
+PUBLISHED:
   INLINE size_t get_data_size_bytes() const;
   INLINE size_t get_data_size_bytes() const;
   INLINE UpdateSeq get_modified() const;
   INLINE UpdateSeq get_modified() const;
 
 
+public:
   INLINE void set_active(bool flag);
   INLINE void set_active(bool flag);
   INLINE void set_resident(bool flag);
   INLINE void set_resident(bool flag);
 
 

+ 17 - 0
panda/src/gobj/geom.cxx

@@ -896,6 +896,23 @@ prepare(PreparedGraphicsObjects *prepared_objects) {
   prepared_objects->enqueue_geom(this);
   prepared_objects->enqueue_geom(this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: Geom::is_prepared
+//       Access: Published
+//  Description: Returns true if the geom has already been prepared
+//               or enqueued for preparation on the indicated GSG,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool Geom::
+is_prepared(PreparedGraphicsObjects *prepared_objects) const {
+  Contexts::const_iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    return true;
+  }
+  return prepared_objects->is_geom_queued(this);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Geom::release
 //     Function: Geom::release
 //       Access: Published
 //       Access: Published

+ 2 - 1
panda/src/gobj/geom.h

@@ -126,13 +126,14 @@ PUBLISHED:
   void clear_cache_stage(Thread *current_thread);
   void clear_cache_stage(Thread *current_thread);
 
 
   void prepare(PreparedGraphicsObjects *prepared_objects);
   void prepare(PreparedGraphicsObjects *prepared_objects);
+  bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
   bool release(PreparedGraphicsObjects *prepared_objects);
   bool release(PreparedGraphicsObjects *prepared_objects);
   int release_all();
   int release_all();
 
 
-public:
   GeomContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
   GeomContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
                            GraphicsStateGuardianBase *gsg);
                            GraphicsStateGuardianBase *gsg);
 
 
+public:
   void draw(GraphicsStateGuardianBase *gsg, 
   void draw(GraphicsStateGuardianBase *gsg, 
             const GeomMunger *munger,
             const GeomMunger *munger,
             const GeomVertexData *vertex_data,
             const GeomVertexData *vertex_data,

+ 10 - 0
panda/src/gobj/geomContext.I

@@ -27,3 +27,13 @@ GeomContext(Geom *geom) :
   _geom(geom)
   _geom(geom)
 {
 {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: GeomContext::get_geom
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE Geom *GeomContext::
+get_geom() const {
+  return _geom;
+}

+ 4 - 0
panda/src/gobj/geomContext.h

@@ -44,6 +44,10 @@ class EXPCL_PANDA GeomContext : public SavedContext {
 public:
 public:
   INLINE GeomContext(Geom *geom);
   INLINE GeomContext(Geom *geom);
 
 
+PUBLISHED:
+  INLINE Geom *get_geom() const;
+
+public:
   // This cannot be a PT(Geom), because the geom and the GSG
   // This cannot be a PT(Geom), because the geom and the GSG
   // both own their GeomContexts!  That would create a circular
   // both own their GeomContexts!  That would create a circular
   // reference count.
   // reference count.

+ 17 - 0
panda/src/gobj/geomPrimitive.cxx

@@ -1076,6 +1076,23 @@ prepare(PreparedGraphicsObjects *prepared_objects) {
   prepared_objects->enqueue_index_buffer(this);
   prepared_objects->enqueue_index_buffer(this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GeomPrimitive::is_prepared
+//       Access: Published
+//  Description: Returns true if the data has already been prepared
+//               or enqueued for preparation on the indicated GSG,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool GeomPrimitive::
+is_prepared(PreparedGraphicsObjects *prepared_objects) const {
+  Contexts::const_iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    return true;
+  }
+  return prepared_objects->is_index_buffer_queued(this);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomPrimitive::prepare_now
 //     Function: GeomPrimitive::prepare_now
 //       Access: Public
 //       Access: Public

+ 1 - 1
panda/src/gobj/geomPrimitive.h

@@ -176,8 +176,8 @@ public:
   virtual int get_num_unused_vertices_per_primitive() const;
   virtual int get_num_unused_vertices_per_primitive() const;
 
 
   void prepare(PreparedGraphicsObjects *prepared_objects);
   void prepare(PreparedGraphicsObjects *prepared_objects);
+  bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
 
 
-public:
   IndexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
   IndexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
                                   GraphicsStateGuardianBase *gsg);
                                   GraphicsStateGuardianBase *gsg);
   bool release(PreparedGraphicsObjects *prepared_objects);
   bool release(PreparedGraphicsObjects *prepared_objects);

+ 17 - 0
panda/src/gobj/geomVertexArrayData.cxx

@@ -174,6 +174,23 @@ prepare(PreparedGraphicsObjects *prepared_objects) {
   prepared_objects->enqueue_vertex_buffer(this);
   prepared_objects->enqueue_vertex_buffer(this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GeomVertexArrayData::is_prepared
+//       Access: Published
+//  Description: Returns true if the data has already been prepared
+//               or enqueued for preparation on the indicated GSG,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool GeomVertexArrayData::
+is_prepared(PreparedGraphicsObjects *prepared_objects) const {
+  Contexts::const_iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    return true;
+  }
+  return prepared_objects->is_vertex_buffer_queued(this);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomVertexArrayData::prepare_now
 //     Function: GeomVertexArrayData::prepare_now
 //       Access: Public
 //       Access: Public

+ 1 - 1
panda/src/gobj/geomVertexArrayData.h

@@ -95,8 +95,8 @@ PUBLISHED:
   INLINE PTA_uchar modify_data();
   INLINE PTA_uchar modify_data();
   INLINE void set_data(CPTA_uchar data);
   INLINE void set_data(CPTA_uchar data);
 
 
-public:
   void prepare(PreparedGraphicsObjects *prepared_objects);
   void prepare(PreparedGraphicsObjects *prepared_objects);
+  bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
 
 
   VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
   VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
                                    GraphicsStateGuardianBase *gsg);
                                    GraphicsStateGuardianBase *gsg);

+ 2 - 0
panda/src/gobj/indexBufferContext.h

@@ -40,12 +40,14 @@ class EXPCL_PANDA IndexBufferContext : public BufferContext {
 public:
 public:
   INLINE IndexBufferContext(PreparedGraphicsObjects *pgo, GeomPrimitive *data);
   INLINE IndexBufferContext(PreparedGraphicsObjects *pgo, GeomPrimitive *data);
 
 
+PUBLISHED:
   INLINE GeomPrimitive *get_data() const;
   INLINE GeomPrimitive *get_data() const;
 
 
   INLINE bool changed_size(const GeomPrimitivePipelineReader *reader) const;
   INLINE bool changed_size(const GeomPrimitivePipelineReader *reader) const;
   INLINE bool changed_usage_hint(const GeomPrimitivePipelineReader *reader) const;
   INLINE bool changed_usage_hint(const GeomPrimitivePipelineReader *reader) const;
   INLINE bool was_modified(const GeomPrimitivePipelineReader *reader) const;
   INLINE bool was_modified(const GeomPrimitivePipelineReader *reader) const;
 
 
+public:
   INLINE void mark_loaded(const GeomPrimitivePipelineReader *reader);
   INLINE void mark_loaded(const GeomPrimitivePipelineReader *reader);
 
 
 private:
 private:

+ 30 - 0
panda/src/gobj/preparedGraphicsObjects.I

@@ -42,3 +42,33 @@ release_all() {
   release_all_vertex_buffers();
   release_all_vertex_buffers();
   release_all_index_buffers();
   release_all_index_buffers();
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued
+//       Access: Public
+//  Description: Returns the number of objects of any kind that have
+//               been enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+INLINE int PreparedGraphicsObjects::
+get_num_queued() const {
+  return (get_num_queued_textures() + 
+          get_num_queued_geoms() +
+          get_num_queued_shaders() +
+          get_num_queued_vertex_buffers() +
+          get_num_queued_index_buffers());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared
+//       Access: Public
+//  Description: Returns the number of objects of any kind that have
+//               already been prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+INLINE int PreparedGraphicsObjects::
+get_num_prepared() const {
+  return (get_num_prepared_textures() + 
+          get_num_prepared_geoms() +
+          get_num_prepared_shaders() +
+          get_num_prepared_vertex_buffers() +
+          get_num_prepared_index_buffers());
+}

+ 190 - 5
panda/src/gobj/preparedGraphicsObjects.cxx

@@ -137,6 +137,20 @@ enqueue_texture(Texture *tex) {
   _enqueued_textures.insert(tex);
   _enqueued_textures.insert(tex);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::is_texture_queued
+//       Access: Public
+//  Description: Returns true if the texture has been queued on this
+//               GSG, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PreparedGraphicsObjects::
+is_texture_queued(const Texture *tex) const {
+  ReMutexHolder holder(_lock);
+
+  EnqueuedTextures::const_iterator qi = _enqueued_textures.find((Texture *)tex);
+  return (qi != _enqueued_textures.end());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::dequeue_texture
 //     Function: PreparedGraphicsObjects::dequeue_texture
 //       Access: Public
 //       Access: Public
@@ -205,7 +219,7 @@ int PreparedGraphicsObjects::
 release_all_textures() {
 release_all_textures() {
   ReMutexHolder holder(_lock);
   ReMutexHolder holder(_lock);
 
 
-  int num_textures = (int)_prepared_textures.size();
+  int num_textures = (int)_prepared_textures.size() + (int)_enqueued_textures.size();
 
 
   Textures::iterator tci;
   Textures::iterator tci;
   for (tci = _prepared_textures.begin();
   for (tci = _prepared_textures.begin();
@@ -219,10 +233,33 @@ release_all_textures() {
   }
   }
 
 
   _prepared_textures.clear();
   _prepared_textures.clear();
+  _enqueued_textures.clear();
 
 
   return num_textures;
   return num_textures;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued_textures
+//       Access: Public
+//  Description: Returns the number of textures that have been
+//               enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_queued_textures() const {
+  return _enqueued_textures.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared_textures
+//       Access: Public
+//  Description: Returns the number of textures that have already been
+//               prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_prepared_textures() const {
+  return _prepared_textures.size();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::prepare_texture_now
 //     Function: PreparedGraphicsObjects::prepare_texture_now
 //       Access: Public
 //       Access: Public
@@ -277,6 +314,20 @@ enqueue_geom(Geom *geom) {
   _enqueued_geoms.insert(geom);
   _enqueued_geoms.insert(geom);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::is_geom_queued
+//       Access: Public
+//  Description: Returns true if the geom has been queued on this
+//               GSG, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PreparedGraphicsObjects::
+is_geom_queued(const Geom *geom) const {
+  ReMutexHolder holder(_lock);
+
+  EnqueuedGeoms::const_iterator qi = _enqueued_geoms.find((Geom *)geom);
+  return (qi != _enqueued_geoms.end());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::dequeue_geom
 //     Function: PreparedGraphicsObjects::dequeue_geom
 //       Access: Public
 //       Access: Public
@@ -345,7 +396,7 @@ int PreparedGraphicsObjects::
 release_all_geoms() {
 release_all_geoms() {
   ReMutexHolder holder(_lock);
   ReMutexHolder holder(_lock);
 
 
-  int num_geoms = (int)_prepared_geoms.size();
+  int num_geoms = (int)_prepared_geoms.size() + (int)_enqueued_geoms.size();
 
 
   Geoms::iterator gci;
   Geoms::iterator gci;
   for (gci = _prepared_geoms.begin();
   for (gci = _prepared_geoms.begin();
@@ -359,10 +410,33 @@ release_all_geoms() {
   }
   }
 
 
   _prepared_geoms.clear();
   _prepared_geoms.clear();
+  _enqueued_geoms.clear();
 
 
   return num_geoms;
   return num_geoms;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued_geoms
+//       Access: Public
+//  Description: Returns the number of geoms that have been
+//               enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_queued_geoms() const {
+  return _enqueued_geoms.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared_geoms
+//       Access: Public
+//  Description: Returns the number of geoms that have already been
+//               prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_prepared_geoms() const {
+  return _prepared_geoms.size();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::prepare_geom_now
 //     Function: PreparedGraphicsObjects::prepare_geom_now
 //       Access: Public
 //       Access: Public
@@ -417,6 +491,20 @@ enqueue_shader(ShaderExpansion *se) {
   _enqueued_shaders.insert(se);
   _enqueued_shaders.insert(se);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::is_shader_queued
+//       Access: Public
+//  Description: Returns true if the shader has been queued on this
+//               GSG, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PreparedGraphicsObjects::
+is_shader_queued(const ShaderExpansion *shader) const {
+  ReMutexHolder holder(_lock);
+
+  EnqueuedShaders::const_iterator qi = _enqueued_shaders.find((ShaderExpansion *)shader);
+  return (qi != _enqueued_shaders.end());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::dequeue_shader
 //     Function: PreparedGraphicsObjects::dequeue_shader
 //       Access: Public
 //       Access: Public
@@ -485,7 +573,7 @@ int PreparedGraphicsObjects::
 release_all_shaders() {
 release_all_shaders() {
   ReMutexHolder holder(_lock);
   ReMutexHolder holder(_lock);
 
 
-  int num_shaders = (int)_prepared_shaders.size();
+  int num_shaders = (int)_prepared_shaders.size() + (int)_enqueued_shaders.size();
 
 
   Shaders::iterator sci;
   Shaders::iterator sci;
   for (sci = _prepared_shaders.begin();
   for (sci = _prepared_shaders.begin();
@@ -499,10 +587,33 @@ release_all_shaders() {
   }
   }
 
 
   _prepared_shaders.clear();
   _prepared_shaders.clear();
+  _enqueued_shaders.clear();
 
 
   return num_shaders;
   return num_shaders;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued_shaders
+//       Access: Public
+//  Description: Returns the number of shaders that have been
+//               enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_queued_shaders() const {
+  return _enqueued_shaders.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared_shaders
+//       Access: Public
+//  Description: Returns the number of shaders that have already been
+//               prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_prepared_shaders() const {
+  return _prepared_shaders.size();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::prepare_shader_now
 //     Function: PreparedGraphicsObjects::prepare_shader_now
 //       Access: Public
 //       Access: Public
@@ -557,6 +668,20 @@ enqueue_vertex_buffer(GeomVertexArrayData *data) {
   _enqueued_vertex_buffers.insert(data);
   _enqueued_vertex_buffers.insert(data);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::is_vertex_buffer_queued
+//       Access: Public
+//  Description: Returns true if the vertex buffer has been queued on
+//               this GSG, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PreparedGraphicsObjects::
+is_vertex_buffer_queued(const GeomVertexArrayData *data) const {
+  ReMutexHolder holder(_lock);
+
+  EnqueuedVertexBuffers::const_iterator qi = _enqueued_vertex_buffers.find((GeomVertexArrayData *)data);
+  return (qi != _enqueued_vertex_buffers.end());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::dequeue_vertex_buffer
 //     Function: PreparedGraphicsObjects::dequeue_vertex_buffer
 //       Access: Public
 //       Access: Public
@@ -625,7 +750,7 @@ int PreparedGraphicsObjects::
 release_all_vertex_buffers() {
 release_all_vertex_buffers() {
   ReMutexHolder holder(_lock);
   ReMutexHolder holder(_lock);
 
 
-  int num_vertex_buffers = (int)_prepared_vertex_buffers.size();
+  int num_vertex_buffers = (int)_prepared_vertex_buffers.size() + (int)_enqueued_vertex_buffers.size();
 
 
   VertexBuffers::iterator vbci;
   VertexBuffers::iterator vbci;
   for (vbci = _prepared_vertex_buffers.begin();
   for (vbci = _prepared_vertex_buffers.begin();
@@ -639,10 +764,33 @@ release_all_vertex_buffers() {
   }
   }
 
 
   _prepared_vertex_buffers.clear();
   _prepared_vertex_buffers.clear();
+  _enqueued_vertex_buffers.clear();
 
 
   return num_vertex_buffers;
   return num_vertex_buffers;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued_vertex_buffers
+//       Access: Public
+//  Description: Returns the number of vertex buffers that have been
+//               enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_queued_vertex_buffers() const {
+  return _enqueued_vertex_buffers.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared_vertex_buffers
+//       Access: Public
+//  Description: Returns the number of vertex buffers that have
+//               already been prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_prepared_vertex_buffers() const {
+  return _prepared_vertex_buffers.size();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::prepare_vertex_buffer_now
 //     Function: PreparedGraphicsObjects::prepare_vertex_buffer_now
 //       Access: Public
 //       Access: Public
@@ -697,6 +845,20 @@ enqueue_index_buffer(GeomPrimitive *data) {
   _enqueued_index_buffers.insert(data);
   _enqueued_index_buffers.insert(data);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::is_index_buffer_queued
+//       Access: Public
+//  Description: Returns true if the index buffer has been queued on
+//               this GSG, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PreparedGraphicsObjects::
+is_index_buffer_queued(const GeomPrimitive *data) const {
+  ReMutexHolder holder(_lock);
+
+  EnqueuedIndexBuffers::const_iterator qi = _enqueued_index_buffers.find((GeomPrimitive *)data);
+  return (qi != _enqueued_index_buffers.end());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::dequeue_index_buffer
 //     Function: PreparedGraphicsObjects::dequeue_index_buffer
 //       Access: Public
 //       Access: Public
@@ -765,7 +927,7 @@ int PreparedGraphicsObjects::
 release_all_index_buffers() {
 release_all_index_buffers() {
   ReMutexHolder holder(_lock);
   ReMutexHolder holder(_lock);
 
 
-  int num_index_buffers = (int)_prepared_index_buffers.size();
+  int num_index_buffers = (int)_prepared_index_buffers.size() + (int)_enqueued_index_buffers.size();
 
 
   IndexBuffers::iterator ibci;
   IndexBuffers::iterator ibci;
   for (ibci = _prepared_index_buffers.begin();
   for (ibci = _prepared_index_buffers.begin();
@@ -779,10 +941,33 @@ release_all_index_buffers() {
   }
   }
 
 
   _prepared_index_buffers.clear();
   _prepared_index_buffers.clear();
+  _enqueued_index_buffers.clear();
 
 
   return num_index_buffers;
   return num_index_buffers;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_queued_index_buffers
+//       Access: Public
+//  Description: Returns the number of index buffers that have been
+//               enqueued to be prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_queued_index_buffers() const {
+  return _enqueued_index_buffers.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PreparedGraphicsObjects::get_num_prepared_index_buffers
+//       Access: Public
+//  Description: Returns the number of index buffers that have
+//               already been prepared on this GSG.
+////////////////////////////////////////////////////////////////////
+int PreparedGraphicsObjects::
+get_num_prepared_index_buffers() const {
+  return _prepared_index_buffers.size();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PreparedGraphicsObjects::prepare_index_buffer_now
 //     Function: PreparedGraphicsObjects::prepare_index_buffer_now
 //       Access: Public
 //       Access: Public

+ 19 - 0
panda/src/gobj/preparedGraphicsObjects.h

@@ -63,49 +63,68 @@ public:
   PreparedGraphicsObjects();
   PreparedGraphicsObjects();
   ~PreparedGraphicsObjects();
   ~PreparedGraphicsObjects();
 
 
+PUBLISHED:
   INLINE const string &get_name() const;
   INLINE const string &get_name() const;
 
 
   INLINE void release_all();
   INLINE void release_all();
+  INLINE int get_num_queued() const;
+  INLINE int get_num_prepared() const;
 
 
   void enqueue_texture(Texture *tex);
   void enqueue_texture(Texture *tex);
+  bool is_texture_queued(const Texture *tex) const;
   bool dequeue_texture(Texture *tex);
   bool dequeue_texture(Texture *tex);
   void release_texture(TextureContext *tc);
   void release_texture(TextureContext *tc);
   int release_all_textures();
   int release_all_textures();
+  int get_num_queued_textures() const;
+  int get_num_prepared_textures() const;
 
 
   TextureContext *prepare_texture_now(Texture *tex, GraphicsStateGuardianBase *gsg);
   TextureContext *prepare_texture_now(Texture *tex, GraphicsStateGuardianBase *gsg);
 
 
   void enqueue_geom(Geom *geom);
   void enqueue_geom(Geom *geom);
+  bool is_geom_queued(const Geom *geom) const;
   bool dequeue_geom(Geom *geom);
   bool dequeue_geom(Geom *geom);
   void release_geom(GeomContext *gc);
   void release_geom(GeomContext *gc);
   int release_all_geoms();
   int release_all_geoms();
+  int get_num_queued_geoms() const;
+  int get_num_prepared_geoms() const;
 
 
   GeomContext *prepare_geom_now(Geom *geom, GraphicsStateGuardianBase *gsg);
   GeomContext *prepare_geom_now(Geom *geom, GraphicsStateGuardianBase *gsg);
 
 
   void enqueue_shader(ShaderExpansion *shader);
   void enqueue_shader(ShaderExpansion *shader);
+  bool is_shader_queued(const ShaderExpansion *shader) const;
   bool dequeue_shader(ShaderExpansion *shader);
   bool dequeue_shader(ShaderExpansion *shader);
   void release_shader(ShaderContext *sc);
   void release_shader(ShaderContext *sc);
   int release_all_shaders();
   int release_all_shaders();
+  int get_num_queued_shaders() const;
+  int get_num_prepared_shaders() const;
 
 
   ShaderContext *prepare_shader_now(ShaderExpansion *shader, GraphicsStateGuardianBase *gsg);
   ShaderContext *prepare_shader_now(ShaderExpansion *shader, GraphicsStateGuardianBase *gsg);
 
 
   void enqueue_vertex_buffer(GeomVertexArrayData *data);
   void enqueue_vertex_buffer(GeomVertexArrayData *data);
+  bool is_vertex_buffer_queued(const GeomVertexArrayData *data) const;
   bool dequeue_vertex_buffer(GeomVertexArrayData *data);
   bool dequeue_vertex_buffer(GeomVertexArrayData *data);
   void release_vertex_buffer(VertexBufferContext *vbc);
   void release_vertex_buffer(VertexBufferContext *vbc);
   int release_all_vertex_buffers();
   int release_all_vertex_buffers();
+  int get_num_queued_vertex_buffers() const;
+  int get_num_prepared_vertex_buffers() const;
 
 
   VertexBufferContext *
   VertexBufferContext *
   prepare_vertex_buffer_now(GeomVertexArrayData *data,
   prepare_vertex_buffer_now(GeomVertexArrayData *data,
                             GraphicsStateGuardianBase *gsg);
                             GraphicsStateGuardianBase *gsg);
 
 
   void enqueue_index_buffer(GeomPrimitive *data);
   void enqueue_index_buffer(GeomPrimitive *data);
+  bool is_index_buffer_queued(const GeomPrimitive *data) const;
   bool dequeue_index_buffer(GeomPrimitive *data);
   bool dequeue_index_buffer(GeomPrimitive *data);
   void release_index_buffer(IndexBufferContext *ibc);
   void release_index_buffer(IndexBufferContext *ibc);
   int release_all_index_buffers();
   int release_all_index_buffers();
+  int get_num_queued_index_buffers() const;
+  int get_num_prepared_index_buffers() const;
 
 
   IndexBufferContext *
   IndexBufferContext *
   prepare_index_buffer_now(GeomPrimitive *data,
   prepare_index_buffer_now(GeomPrimitive *data,
                            GraphicsStateGuardianBase *gsg);
                            GraphicsStateGuardianBase *gsg);
 
 
+public:
   void begin_frame(GraphicsStateGuardianBase *gsg,
   void begin_frame(GraphicsStateGuardianBase *gsg,
                    Thread *current_thread);
                    Thread *current_thread);
   void end_frame(Thread *current_thread);
   void end_frame(Thread *current_thread);

+ 2 - 1
panda/src/gobj/savedContext.h

@@ -36,10 +36,11 @@ class EXPCL_PANDA SavedContext : public TypedObject {
 public:
 public:
   INLINE SavedContext();
   INLINE SavedContext();
 
 
-public:
+PUBLISHED:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {
     return _type_handle;
     return _type_handle;
   }
   }
+public:
   static void init_type() {
   static void init_type() {
     TypedObject::init_type();
     TypedObject::init_type();
     register_type(_type_handle, "SavedContext",
     register_type(_type_handle, "SavedContext",

+ 9 - 1
panda/src/gobj/shaderContext.I

@@ -27,4 +27,12 @@ ShaderContext(ShaderExpansion *se) :
 {
 {
 }
 }
 
 
-
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderContext::get_expansion
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE ShaderExpansion *ShaderContext::
+get_expansion() const {
+  return _expansion;
+}

+ 5 - 1
panda/src/gobj/shaderContext.h

@@ -39,7 +39,11 @@
 class EXPCL_PANDA ShaderContext: public SavedContext {
 class EXPCL_PANDA ShaderContext: public SavedContext {
 public:
 public:
   INLINE ShaderContext(ShaderExpansion *se);
   INLINE ShaderContext(ShaderExpansion *se);
-  
+
+PUBLISHED:
+  INLINE ShaderExpansion *get_expansion() const;
+
+public:  
   ShaderExpansion *_expansion;
   ShaderExpansion *_expansion;
 
 
 public:
 public:

+ 18 - 1
panda/src/gobj/shaderExpansion.cxx

@@ -1308,6 +1308,23 @@ prepare(PreparedGraphicsObjects *prepared_objects) {
   prepared_objects->enqueue_shader(this);
   prepared_objects->enqueue_shader(this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderExpansion::is_prepared
+//       Access: Published
+//  Description: Returns true if the shader has already been prepared
+//               or enqueued for preparation on the indicated GSG,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool ShaderExpansion::
+is_prepared(PreparedGraphicsObjects *prepared_objects) const {
+  Contexts::const_iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    return true;
+  }
+  return prepared_objects->is_shader_queued(this);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: ShaderExpansion::release
 //     Function: ShaderExpansion::release
 //       Access: Published
 //       Access: Published
@@ -1335,7 +1352,7 @@ release(PreparedGraphicsObjects *prepared_objects) {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: ShaderExpansion::prepare_now
 //     Function: ShaderExpansion::prepare_now
-//       Access: Public
+//       Access: Published
 //  Description: Creates a context for the texture on the particular
 //  Description: Creates a context for the texture on the particular
 //               GSG, if it does not already exist.  Returns the new
 //               GSG, if it does not already exist.  Returns the new
 //               (or old) ShaderContext.  This assumes that the
 //               (or old) ShaderContext.  This assumes that the

+ 4 - 3
panda/src/gobj/shaderExpansion.h

@@ -54,8 +54,12 @@ PUBLISHED:
   INLINE bool get_error_flag() const;
   INLINE bool get_error_flag() const;
 
 
   void prepare(PreparedGraphicsObjects *prepared_objects);
   void prepare(PreparedGraphicsObjects *prepared_objects);
+  bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
   bool release(PreparedGraphicsObjects *prepared_objects);
   bool release(PreparedGraphicsObjects *prepared_objects);
   int release_all();
   int release_all();
+
+  ShaderContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
+                             GraphicsStateGuardianBase *gsg);
   
   
 public:
 public:
 
 
@@ -268,9 +272,6 @@ public:
   typedef pmap <PreparedGraphicsObjects *, ShaderContext *> Contexts;
   typedef pmap <PreparedGraphicsObjects *, ShaderContext *> Contexts;
   Contexts _contexts;
   Contexts _contexts;
 
 
- public:  
-  ShaderContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
-                             GraphicsStateGuardianBase *gsg);
   
   
  private:  
  private:  
   ShaderExpansion(const string &name, const string &text,
   ShaderExpansion(const string &name, const string &text,

+ 18 - 1
panda/src/gobj/texture.cxx

@@ -1244,6 +1244,23 @@ prepare(PreparedGraphicsObjects *prepared_objects) {
   prepared_objects->enqueue_texture(this);
   prepared_objects->enqueue_texture(this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::is_prepared
+//       Access: Published
+//  Description: Returns true if the texture has already been prepared
+//               or enqueued for preparation on the indicated GSG,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool Texture::
+is_prepared(PreparedGraphicsObjects *prepared_objects) const {
+  Contexts::const_iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    return true;
+  }
+  return prepared_objects->is_texture_queued(this);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::release
 //     Function: Texture::release
 //       Access: Published
 //       Access: Published
@@ -1581,7 +1598,7 @@ is_mipmap(FilterType filter_type) {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::prepare_now
 //     Function: Texture::prepare_now
-//       Access: Public
+//       Access: Published
 //  Description: Creates a context for the texture on the particular
 //  Description: Creates a context for the texture on the particular
 //               GSG, if it does not already exist.  Returns the new
 //               GSG, if it does not already exist.  Returns the new
 //               (or old) TextureContext.  This assumes that the
 //               (or old) TextureContext.  This assumes that the

+ 3 - 2
panda/src/gobj/texture.h

@@ -311,6 +311,7 @@ PUBLISHED:
   INLINE UpdateSeq get_image_modified() const;
   INLINE UpdateSeq get_image_modified() const;
 
 
   void prepare(PreparedGraphicsObjects *prepared_objects);
   void prepare(PreparedGraphicsObjects *prepared_objects);
+  bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
   bool release(PreparedGraphicsObjects *prepared_objects);
   bool release(PreparedGraphicsObjects *prepared_objects);
   int release_all();
   int release_all();
 
 
@@ -352,10 +353,10 @@ PUBLISHED:
   INLINE bool get_match_framebuffer_format() const;
   INLINE bool get_match_framebuffer_format() const;
   INLINE void set_match_framebuffer_format(bool flag);
   INLINE void set_match_framebuffer_format(bool flag);
 
 
-public:
-
   TextureContext *prepare_now(PreparedGraphicsObjects *prepared_objects,
   TextureContext *prepare_now(PreparedGraphicsObjects *prepared_objects,
                               GraphicsStateGuardianBase *gsg);
                               GraphicsStateGuardianBase *gsg);
+
+public:
   void texture_uploaded();
   void texture_uploaded();
   
   
   virtual bool has_cull_callback() const;
   virtual bool has_cull_callback() const;

+ 3 - 0
panda/src/gobj/textureContext.h

@@ -42,11 +42,14 @@ class EXPCL_PANDA TextureContext : public BufferContext {
 public:
 public:
   INLINE TextureContext(PreparedGraphicsObjects *pgo, Texture *tex);
   INLINE TextureContext(PreparedGraphicsObjects *pgo, Texture *tex);
 
 
+PUBLISHED:
   INLINE Texture *get_texture() const;
   INLINE Texture *get_texture() const;
 
 
   INLINE bool was_modified() const;
   INLINE bool was_modified() const;
   INLINE bool was_properties_modified() const;
   INLINE bool was_properties_modified() const;
   INLINE bool was_image_modified() const;
   INLINE bool was_image_modified() const;
+
+public:
   INLINE void mark_loaded();
   INLINE void mark_loaded();
 
 
 private:
 private:

+ 2 - 0
panda/src/gobj/vertexBufferContext.h

@@ -41,12 +41,14 @@ public:
   INLINE VertexBufferContext(PreparedGraphicsObjects *pgo,
   INLINE VertexBufferContext(PreparedGraphicsObjects *pgo,
                              GeomVertexArrayData *data);
                              GeomVertexArrayData *data);
 
 
+PUBLISHED:
   INLINE GeomVertexArrayData *get_data() const;
   INLINE GeomVertexArrayData *get_data() const;
 
 
   INLINE bool changed_size(const GeomVertexArrayDataPipelineReader *reader) const;
   INLINE bool changed_size(const GeomVertexArrayDataPipelineReader *reader) const;
   INLINE bool changed_usage_hint(const GeomVertexArrayDataPipelineReader *reader) const;
   INLINE bool changed_usage_hint(const GeomVertexArrayDataPipelineReader *reader) const;
   INLINE bool was_modified(const GeomVertexArrayDataPipelineReader *reader) const;
   INLINE bool was_modified(const GeomVertexArrayDataPipelineReader *reader) const;
 
 
+public:
   INLINE void mark_loaded(const GeomVertexArrayDataPipelineReader *reader);
   INLINE void mark_loaded(const GeomVertexArrayDataPipelineReader *reader);
 
 
 private:
 private:

+ 5 - 0
panda/src/gsgbase/graphicsStateGuardianBase.h

@@ -120,7 +120,12 @@ public:
   // mainly to make it easy to call these from code in some directory
   // mainly to make it easy to call these from code in some directory
   // that display depends on.
   // that display depends on.
   virtual SceneSetup *get_scene() const=0;
   virtual SceneSetup *get_scene() const=0;
+
+#ifndef CPPPARSER
+  // We hide this from interrogate, so that it will be properly
+  // exported from the GraphicsStateGuardian class, later.
   virtual PreparedGraphicsObjects *get_prepared_objects()=0;
   virtual PreparedGraphicsObjects *get_prepared_objects()=0;
+#endif
 
 
   virtual TextureContext *prepare_texture(Texture *tex)=0;
   virtual TextureContext *prepare_texture(Texture *tex)=0;
   virtual void release_texture(TextureContext *tc)=0;
   virtual void release_texture(TextureContext *tc)=0;

+ 1 - 1
panda/src/pgraph/camera.cxx

@@ -39,7 +39,7 @@ Camera(const string &name) :
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Camera::Copy Constructor
 //     Function: Camera::Copy Constructor
-//       Access: Protected
+//       Access: Published
 //  Description:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 Camera::
 Camera::

+ 1 - 2
panda/src/pgraph/camera.h

@@ -41,9 +41,8 @@ class DisplayRegion;
 class EXPCL_PANDA Camera : public LensNode {
 class EXPCL_PANDA Camera : public LensNode {
 PUBLISHED:
 PUBLISHED:
   Camera(const string &name);
   Camera(const string &name);
-
-protected:
   Camera(const Camera &copy);
   Camera(const Camera &copy);
+
 public:
 public:
   virtual ~Camera();
   virtual ~Camera();
 
 

+ 1 - 1
panda/src/testbed/pview.cxx

@@ -77,7 +77,7 @@ event_W(CPT_Event, void *) {
     WindowFramework *old_window = framework.get_window(0);
     WindowFramework *old_window = framework.get_window(0);
     GraphicsWindow *win = old_window->get_graphics_window();
     GraphicsWindow *win = old_window->get_graphics_window();
     pipe = win->get_pipe();
     pipe = win->get_pipe();
-    gsg = win->get_gsg();
+    //    gsg = win->get_gsg();
   }
   }
 
 
   WindowFramework *window = framework.open_window(pipe, gsg);
   WindowFramework *window = framework.open_window(pipe, gsg);