Przeglądaj źródła

pgraph: fix some TextureAttrib state cache issues

The _render_stages and _render_ff_stages cannot simply be copied, because they contain pointer references to the previous TextureAttrib.  Never copy them, and always mark _sort_seq as stale.

This fixes a test failure in replace_texture.
rdb 6 lat temu
rodzic
commit
8f9d0ab6f6

+ 3 - 3
panda/src/pgraph/textureAttrib.I

@@ -29,12 +29,12 @@ TextureAttrib() {
 INLINE TextureAttrib::
 TextureAttrib(const TextureAttrib &copy) :
   _on_stages(copy._on_stages),
-  _render_stages(copy._render_stages),
-  _render_ff_stages(copy._render_ff_stages),
+  _render_stages(),
+  _render_ff_stages(),
   _next_implicit_sort(copy._next_implicit_sort),
   _off_stages(copy._off_stages),
   _off_all_stages(copy._off_all_stages),
-  _sort_seq(copy._sort_seq),
+  _sort_seq(UpdateSeq::old()),
   _filtered_seq(UpdateSeq::old())
 {
 }

+ 0 - 13
panda/src/pgraph/textureAttrib.cxx

@@ -116,10 +116,6 @@ add_on_stage(TextureStage *stage, Texture *tex, int override) const {
   (*si)._has_sampler = false;
   ++(attrib->_next_implicit_sort);
 
-  // We now need to re-sort the attrib list.
-  attrib->_sort_seq = UpdateSeq::old();
-  attrib->_filtered_seq = UpdateSeq::old();
-
   return return_new(attrib);
 }
 
@@ -140,10 +136,6 @@ add_on_stage(TextureStage *stage, Texture *tex, const SamplerState &sampler, int
   (*si)._has_sampler = true;
   ++(attrib->_next_implicit_sort);
 
-  // We now need to re-sort the attrib list.
-  attrib->_sort_seq = UpdateSeq::old();
-  attrib->_filtered_seq = UpdateSeq::old();
-
   return return_new(attrib);
 }
 
@@ -158,9 +150,6 @@ remove_on_stage(TextureStage *stage) const {
   Stages::iterator si = attrib->_on_stages.find(StageNode(stage));
   if (si != attrib->_on_stages.end()) {
     attrib->_on_stages.erase(si);
-
-    attrib->_sort_seq = UpdateSeq::old();
-    attrib->_filtered_seq = UpdateSeq::old();
   }
 
   return return_new(attrib);
@@ -182,8 +171,6 @@ add_off_stage(TextureStage *stage, int override) const {
     Stages::iterator si = attrib->_on_stages.find(sn);
     if (si != attrib->_on_stages.end()) {
       attrib->_on_stages.erase(si);
-      attrib->_sort_seq = UpdateSeq::old();
-      attrib->_filtered_seq = UpdateSeq::old();
     }
   }
   return return_new(attrib);