I have a vertex shader, shared between several pixel shaders - GLSL ES 2.0 on iOS. The VS outputs transformed position, normal and one set of 2D uv coords. Here is the bare-bones of it:
void main() {
vec4 xlt_outPos;
vec3 xlt_outNormal;
vec2 xlt_uv0;
xray_bone_vp( vec4(vertex), vec3(normal), vec2(uv), xlt_outPos, xlt_outNormal, xlt_uv0);
gl_Position = vec4( xlt_outPos);
xlv_TEXCOORD6 = vec3( xlt_outNormal);
xlv_TEXCOORD0 = vec2( xlt_uv0);
}
This is based on a Cg shader which outputs uv to TEXCOORD0 and uses TEXCOORD6 for the normal.
My problem is that PS which take uv coords and normal as inputs are working fine, but those which take the normal only are not. If I change a PS method signature to be passed uv but don't use this, it works!
Is this expected, well-defined behaviour? If so, is there a way to avoid passing un-wanted parameters to shaders or having to create several versions of the VS?