From 9c4151cb0f167feea43e74ed003a8c1f98e09f5b Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Jun 2017 13:36:23 +0200 Subject: [PATCH] ShaderGenerator: fix TextureAttrib assertion This was caused by af57c829d2c15530f72395895353c004a7440a35 and was triggered by a change in TextureStage sort. --- panda/src/pgraph/textureAttrib.I | 2 +- panda/src/pgraph/textureAttrib.cxx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/textureAttrib.I b/panda/src/pgraph/textureAttrib.I index 2b008b2f51..6649c8d87a 100644 --- a/panda/src/pgraph/textureAttrib.I +++ b/panda/src/pgraph/textureAttrib.I @@ -263,7 +263,7 @@ on_stage_affects_alpha(size_t n) const { */ INLINE void TextureAttrib:: check_sorted() const { - if (_sort_seq != TextureStage::get_sort_seq()) { + if (_sort_seq != TextureStage::get_sort_seq() && !_sort_seq.is_fresh()) { ((TextureAttrib *)this)->sort_on_stages(); } } diff --git a/panda/src/pgraph/textureAttrib.cxx b/panda/src/pgraph/textureAttrib.cxx index 09e9f7ce7e..8c1b4833ff 100644 --- a/panda/src/pgraph/textureAttrib.cxx +++ b/panda/src/pgraph/textureAttrib.cxx @@ -807,6 +807,9 @@ get_auto_shader_attrib_impl(const RenderState *state) const { } } + // Prevent check_sorted() from being called on this state. + attrib->_sort_seq = UpdateSeq::fresh(); + return return_new(attrib); }