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.
This commit is contained in:
rdb 2019-08-13 18:08:48 +02:00
parent 262f8b7643
commit 8f9d0ab6f6
2 changed files with 3 additions and 16 deletions

View File

@ -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())
{
}

View File

@ -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);