]> git.tdb.fi Git - libs/gl.git/commitdiff
Check if any shader data has changed when applying Renderer state
authorMikko Rasa <tdb@tdb.fi>
Tue, 27 Apr 2021 10:28:04 +0000 (13:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 27 Apr 2021 10:28:04 +0000 (13:28 +0300)
source/render/renderer.cpp

index dc41eb11e746dc170b61d93897df58b98bd66c68..2485a9e26dedfb866c1ff22c513e8f8e9670cf7b 100644 (file)
@@ -391,9 +391,12 @@ void Renderer::apply_state()
                changed &= ~STANDARD_SHDATA;
        }
 
+       bool shdata_changed = changed&SHADER_DATA;
+       for(vector<BoundProgramData>::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());