Hi !
If I understood well, binding textures is a pretty heavy operation. That's why SFML try not to unbind them if we do several draw calls in a row, using the same texture.
I wonder if it would be possible, or even worth it, to try to do something similar with shaders ?
The idea would be to try to not bind/unbind shader if we continue to use the same, except maybe if a uniform sampler has changed (and in this case, only rebind the corresponding texture). I guess the difficulty would be to track down in which context the samplers have been updated yet... Maybe this can be done by keeping the linked textureId of the context in memory in a std::map (like TextureTable in the shader class). Then we only need to compare them to the one linked in the shader, if it has not been changed ? This could be good if comparing two small std::maps is really faster than binding textures.
For example, maybe all sprites we want to draw using a shader needs to read in the same texture. I'll try to do something like this and see if it has any significant impact on performances.