From: Mikko Rasa Date: Tue, 27 Apr 2021 10:28:04 +0000 (+0300) Subject: Check if any shader data has changed when applying Renderer state X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=32fe9849a37a1917ca5b450ea9dd192b268bc16f;p=libs%2Fgl.git Check if any shader data has changed when applying Renderer state --- diff --git a/source/render/renderer.cpp b/source/render/renderer.cpp index dc41eb11..2485a9e2 100644 --- a/source/render/renderer.cpp +++ b/source/render/renderer.cpp @@ -391,9 +391,12 @@ void Renderer::apply_state() changed &= ~STANDARD_SHDATA; } + bool shdata_changed = changed&SHADER_DATA; + for(vector::const_iterator i=shdata_stack.begin(); (!shdata_changed && i!=shdata_stack.end()); ++i) + shdata_changed = (i->shdata->get_generation()!=i->generation); bool extra_shdata = (shdata_stack.size()>state->shdata_count); - if((changed&SHADER_DATA) || shprog_changed || extra_shdata) + if(shdata_changed || shprog_changed || extra_shdata) { if(extra_shdata) shdata_stack.erase(shdata_stack.begin()+state->shdata_count, shdata_stack.end());