Browse Source

cull: remove GeomMunger stored on CullableObject

rdb 8 years ago
parent
commit
48c811e112

+ 1 - 1
panda/src/cull/cullBinBackToFront.cxx

@@ -99,7 +99,7 @@ draw(bool force, Thread *current_thread) {
       data_reader.set_object(object->_munged_data);
       data_reader.check_array_readers();
       geom_reader.set_object(object->_geom);
-      geom_reader.draw(_gsg, object->_munger, &data_reader, force);
+      geom_reader.draw(_gsg, &data_reader, force);
     } else {
       // It has a callback associated.
       object->draw_callback(_gsg, force, current_thread);

+ 1 - 1
panda/src/cull/cullBinFixed.cxx

@@ -85,7 +85,7 @@ draw(bool force, Thread *current_thread) {
       data_reader.set_object(object->_munged_data);
       data_reader.check_array_readers();
       geom_reader.set_object(object->_geom);
-      geom_reader.draw(_gsg, object->_munger, &data_reader, force);
+      geom_reader.draw(_gsg, &data_reader, force);
     } else {
       // It has a callback associated.
       object->draw_callback(_gsg, force, current_thread);

+ 1 - 1
panda/src/cull/cullBinFrontToBack.cxx

@@ -99,7 +99,7 @@ draw(bool force, Thread *current_thread) {
       data_reader.set_object(object->_munged_data);
       data_reader.check_array_readers();
       geom_reader.set_object(object->_geom);
-      geom_reader.draw(_gsg, object->_munger, &data_reader, force);
+      geom_reader.draw(_gsg, &data_reader, force);
     } else {
       // It has a callback associated.
       object->draw_callback(_gsg, force, current_thread);

+ 1 - 1
panda/src/cull/cullBinStateSorted.cxx

@@ -84,7 +84,7 @@ draw(bool force, Thread *current_thread) {
       data_reader.set_object(object->_munged_data);
       data_reader.check_array_readers();
       geom_reader.set_object(object->_geom);
-      geom_reader.draw(_gsg, object->_munger, &data_reader, force);
+      geom_reader.draw(_gsg, &data_reader, force);
     } else {
       // It has a callback associated.
       object->draw_callback(_gsg, force, current_thread);

+ 1 - 1
panda/src/cull/cullBinUnsorted.cxx

@@ -69,7 +69,7 @@ draw(bool force, Thread *current_thread) {
       data_reader.set_object(object->_munged_data);
       data_reader.check_array_readers();
       geom_reader.set_object(object->_geom);
-      geom_reader.draw(_gsg, object->_munger, &data_reader, force);
+      geom_reader.draw(_gsg, &data_reader, force);
     } else {
       // It has a callback associated.
       object->draw_callback(_gsg, force, current_thread);

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

@@ -2263,10 +2263,8 @@ finish_decal() {
  */
 bool GraphicsStateGuardian::
 begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                      const GeomMunger *munger,
                       const GeomVertexDataPipelineReader *data_reader,
                       bool force) {
-  _munger = munger;
   _data_reader = data_reader;
 
   // Always draw if we have a shader, since the shader might use a different
@@ -2337,7 +2335,6 @@ draw_points(const GeomPrimitivePipelineReader *, bool) {
  */
 void GraphicsStateGuardian::
 end_draw_primitives() {
-  _munger = NULL;
   _data_reader = NULL;
 }
 

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

@@ -367,7 +367,6 @@ public:
   virtual void finish_decal();
 
   virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                                     const GeomMunger *munger,
                                      const GeomVertexDataPipelineReader *data_reader,
                                      bool force);
   virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,
@@ -496,9 +495,8 @@ protected:
   CPT(ShaderAttrib) _state_shader;
   CPT(ShaderAttrib) _target_shader;
 
-  // These are set by begin_draw_primitives(), and are only valid between
+  // This is set by begin_draw_primitives(), and are only valid between
   // begin_draw_primitives() and end_draw_primitives().
-  CPT(GeomMunger) _munger;
   const GeomVertexDataPipelineReader *_data_reader;
 
   unsigned int _color_write_mask;

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

@@ -1141,11 +1141,9 @@ end_frame(Thread *current_thread) {
  */
 bool DXGraphicsStateGuardian9::
 begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                      const GeomMunger *munger,
                       const GeomVertexDataPipelineReader *data_reader,
                       bool force) {
-  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, munger,
-                                                    data_reader, force)) {
+  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, data_reader, force)) {
     return false;
   }
   nassertr(_data_reader != (GeomVertexDataPipelineReader *)NULL, false);

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

@@ -106,7 +106,6 @@ public:
   virtual void end_frame(Thread *current_thread);
 
   virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                                     const GeomMunger *munger,
                                      const GeomVertexDataPipelineReader *data_reader,
                                      bool force);
   virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,

+ 3 - 4
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -3934,7 +3934,6 @@ end_frame(Thread *current_thread) {
  */
 bool CLP(GraphicsStateGuardian)::
 begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                      const GeomMunger *munger,
                       const GeomVertexDataPipelineReader *data_reader,
                       bool force) {
 #ifndef NDEBUG
@@ -3953,7 +3952,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
   }
 #endif
 
-  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, munger, data_reader, force)) {
+  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, data_reader, force)) {
     return false;
   }
   nassertr(_data_reader != (GeomVertexDataPipelineReader *)NULL, false);
@@ -4018,10 +4017,10 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
     GeomContext *gc = geom_reader->prepare_now(get_prepared_objects(), this);
     nassertr(gc != (GeomContext *)NULL, false);
     CLP(GeomContext) *ggc = DCAST(CLP(GeomContext), gc);
-    const CLP(GeomMunger) *gmunger = DCAST(CLP(GeomMunger), _munger);
+    //const CLP(GeomMunger) *gmunger = DCAST(CLP(GeomMunger), _munger);
 
     UpdateSeq modified = max(geom_reader->get_modified(), _data_reader->get_modified());
-    if (ggc->get_display_list(_geom_display_list, gmunger, modified)) {
+    if (ggc->get_display_list(_geom_display_list, nullptr, modified)) {
       // If it hasn't been modified, just play the display list again.
       if (GLCAT.is_spam()) {
         GLCAT.spam()

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

@@ -284,7 +284,6 @@ public:
   virtual void end_frame(Thread *current_thread);
 
   virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                                     const GeomMunger *munger,
                                      const GeomVertexDataPipelineReader *data_reader,
                                      bool force);
   virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,

+ 5 - 6
panda/src/gobj/geom.cxx

@@ -1211,14 +1211,13 @@ prepare_now(PreparedGraphicsObjects *prepared_objects,
  * is passed true, it will wait for the data to become resident if necessary.
  */
 bool Geom::
-draw(GraphicsStateGuardianBase *gsg, const GeomMunger *munger,
-     const GeomVertexData *vertex_data, bool force,
-     Thread *current_thread) const {
+draw(GraphicsStateGuardianBase *gsg, const GeomVertexData *vertex_data,
+     bool force, Thread *current_thread) const {
   GeomPipelineReader geom_reader(this, current_thread);
   GeomVertexDataPipelineReader data_reader(vertex_data, current_thread);
   data_reader.check_array_readers();
 
-  return geom_reader.draw(gsg, munger, &data_reader, force);
+  return geom_reader.draw(gsg, &data_reader, force);
 }
 
 /**
@@ -1749,10 +1748,10 @@ check_valid(const GeomVertexDataPipelineReader *data_reader) const {
  * The implementation of Geom::draw().
  */
 bool GeomPipelineReader::
-draw(GraphicsStateGuardianBase *gsg, const GeomMunger *munger,
+draw(GraphicsStateGuardianBase *gsg,
      const GeomVertexDataPipelineReader *data_reader, bool force) const {
   PStatTimer timer(Geom::_draw_primitive_setup_pcollector);
-  bool all_ok = gsg->begin_draw_primitives(this, munger, data_reader, force);
+  bool all_ok = gsg->begin_draw_primitives(this, data_reader, force);
   if (all_ok) {
     Geom::Primitives::const_iterator pi;
     for (pi = _cdata->_primitives.begin();

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

@@ -153,7 +153,6 @@ PUBLISHED:
 
 public:
   bool draw(GraphicsStateGuardianBase *gsg,
-            const GeomMunger *munger,
             const GeomVertexData *vertex_data,
             bool force, Thread *current_thread) const;
 
@@ -429,7 +428,7 @@ public:
   INLINE GeomContext *prepare_now(PreparedGraphicsObjects *prepared_objects,
                                   GraphicsStateGuardianBase *gsg) const;
 
-  bool draw(GraphicsStateGuardianBase *gsg, const GeomMunger *munger,
+  bool draw(GraphicsStateGuardianBase *gsg,
             const GeomVertexDataPipelineReader *data_reader,
             bool force) const;
 

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

@@ -198,7 +198,6 @@ public:
   // friends of this class.
 
   virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                                     const GeomMunger *munger,
                                      const GeomVertexDataPipelineReader *data_reader,
                                      bool force)=0;
   virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader, bool force)=0;

+ 1 - 3
panda/src/pgraph/cullableObject.I

@@ -43,7 +43,6 @@ CullableObject(CPT(Geom) geom, CPT(RenderState) state,
 INLINE CullableObject::
 CullableObject(const CullableObject &copy) :
   _geom(copy._geom),
-  _munger(copy._munger),
   _munged_data(copy._munged_data),
   _state(copy._state),
   _internal_transform(copy._internal_transform)
@@ -59,7 +58,6 @@ CullableObject(const CullableObject &copy) :
 INLINE void CullableObject::
 operator = (const CullableObject &copy) {
   _geom = copy._geom;
-  _munger = copy._munger;
   _munged_data = copy._munged_data;
   _state = copy._state;
   _internal_transform = copy._internal_transform;
@@ -132,7 +130,7 @@ flush_level() {
  */
 INLINE void CullableObject::
 draw_inline(GraphicsStateGuardianBase *gsg, bool force, Thread *current_thread) {
-  _geom->draw(gsg, _munger, _munged_data, force, current_thread);
+  _geom->draw(gsg, _munged_data, force, current_thread);
 }
 
 /**

+ 5 - 7
panda/src/pgraph/cullableObject.cxx

@@ -50,15 +50,13 @@ TypeHandle CullableObject::_type_handle;
  * have to block while the vertex data is paged in.
  */
 bool CullableObject::
-munge_geom(GraphicsStateGuardianBase *gsg,
-           GeomMunger *munger, const CullTraverser *traverser,
-           bool force) {
-  nassertr(munger != (GeomMunger *)NULL, false);
+munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger,
+           const CullTraverser *traverser, bool force) {
+  nassertr(munger != nullptr, false);
+
   Thread *current_thread = traverser->get_current_thread();
   PStatTimer timer(_munge_geom_pcollector, current_thread);
-  if (_geom != (Geom *)NULL) {
-    _munger = munger;
-
+  if (_geom != nullptr) {
     GraphicsStateGuardianBase *gsg = traverser->get_gsg();
     int gsg_bits = gsg->get_supported_geom_rendering();
     if (!hardware_point_sprites) {

+ 3 - 5
panda/src/pgraph/cullableObject.h

@@ -18,7 +18,6 @@
 
 #include "geom.h"
 #include "geomVertexData.h"
-#include "geomMunger.h"
 #include "renderState.h"
 #include "transformState.h"
 #include "pointerTo.h"
@@ -34,6 +33,7 @@
 #include "geomDrawCallbackData.h"
 
 class CullTraverser;
+class GeomMunger;
 
 /**
  * The smallest atom of cull.  This is normally just a Geom and its associated
@@ -52,9 +52,8 @@ public:
   INLINE CullableObject(const CullableObject &copy);
   INLINE void operator = (const CullableObject &copy);
 
-  bool munge_geom(GraphicsStateGuardianBase *gsg,
-                  GeomMunger *munger, const CullTraverser *traverser,
-                  bool force);
+  bool munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger,
+                  const CullTraverser *traverser, bool force);
   INLINE void draw(GraphicsStateGuardianBase *gsg,
                    bool force, Thread *current_thread);
 
@@ -75,7 +74,6 @@ public:
 
 public:
   CPT(Geom) _geom;
-  PT(GeomMunger) _munger;
   CPT(GeomVertexData) _munged_data;
   CPT(RenderState) _state;
   CPT(TransformState) _internal_transform;

+ 2 - 2
panda/src/pgraph/geomDrawCallbackData.cxx

@@ -39,13 +39,13 @@ output(ostream &out) const {
 void GeomDrawCallbackData::
 upcall() {
   // Go ahead and draw the object, if we have one.
-  if (_obj->_geom != (Geom *)NULL) {
+  if (_obj->_geom != nullptr) {
     if (_lost_state) {
       // Tell the GSG to forget its state.
       _gsg->clear_state_and_transform();
     }
 
-    _obj->_geom->draw(_gsg, _obj->_munger, _obj->_munged_data, _force,
+    _obj->_geom->draw(_gsg, _obj->_munged_data, _force,
                       Thread::get_current_thread());
   }
 }

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

@@ -470,7 +470,6 @@ end_frame(Thread *current_thread) {
  */
 bool TinyGraphicsStateGuardian::
 begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                      const GeomMunger *munger,
                       const GeomVertexDataPipelineReader *data_reader,
                       bool force) {
 #ifndef NDEBUG
@@ -479,7 +478,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
   }
 #endif  // NDEBUG
 
-  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, munger, data_reader, force)) {
+  if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, data_reader, force)) {
     return false;
   }
   nassertr(_data_reader != (GeomVertexDataPipelineReader *)NULL, false);

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

@@ -63,7 +63,6 @@ public:
   virtual void end_frame(Thread *current_thread);
 
   virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
-                                     const GeomMunger *munger,
                                      const GeomVertexDataPipelineReader *data_reader,
                                      bool force);
   virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,