flush_textures();
for(const BoundTexture &t: texture_stack)
- {
- int unit = (t.tag.id ? state->shprog->get_uniform_binding(t.tag) : t.unit);
- if(unit>=0)
- pipeline_state.set_texture(unit, t.texture, t.sampler);
- }
+ if(t.texture && t.replaced<0)
+ {
+ if(t.binding<0 || shprog_changed)
+ t.binding = state->shprog->get_uniform_binding(t.tag);
+ if(t.binding>=0)
+ pipeline_state.set_texture(t.binding, t.texture, t.sampler);
+ }
bool shdata_changed = changed&SHADER_DATA;
for(auto i=shdata_stack.begin(); (!shdata_changed && i!=shdata_stack.end()); ++i)