I have this fragment shader. On some "sprites" i want a different "saturation" of the texture. At the moment i only set it once but later i would set it each draw depending on the sprite beeing drawn. As noted in the code if i just write * 0.5 i don`t see a performance decrease but if i use * u_test the speed decreases about 5-7ms. Could that be possible? Could you think of a other solution? Am i totally in the wrong track?
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec4 v_secondFragmentColor;
uniform sampler2D CC_Texture0;
uniform vec3 u_topColor;
uniform vec3 u_centerColor;
uniform vec3 u_bottomColor;
uniform float u_intensity;
uniform lowp float u_test;
void main()
{
//vec4 base = texture2D(CC_Texture0, v_texCoord) * v_fragmentColor * u_test; // 1. 5-7 ms slower that 2.
vec4 base = texture2D(CC_Texture0, v_texCoord) * v_fragmentColor * 0.5; // 2. fast
vec3 blend = v_secondFragmentColor.rgb;
vec3 overlay = vec3( 2.0 * base.rgb * blend + base.rgb * base.rgb - 2.0 * base.rgb * base.rgb * blend);
gl_FragColor = vec4(overlay, base.a);
}