glsl shaders failed to link

It seems that sometimes the glsl shader fails to link. whether or not that’s because of an error in the code, the problem is that I have a hard time getting it to link again.

for example,

I had this shader:
void main()
{
vec4 col1 = texture2D(sInput1, gl_TexCoord[0].st);
vec4 col2 = texture2D(sInput2, gl_TexCoord[0].st);

// Do your expression here. Right now it's simply input1 * input2.
vec4 outcol = col1;
if ( ( outcol.r > outcol.b ) || ( outcol.b < .2 ) ) {
	outcol.a = 1;
} else {
	outcol.a = 0;
}




// write out the result.
gl_FragColor = outcol;

}

I then added, right before the //write out the result:

outcol.b = outcol.r;

which, for some unknown reason, failed to link (it would be nice if some error was printed, I see type casting warnings but no errors on more serious stuff).

I then deleted the offending line, and wrote out the shader again, but it failed to link again, even though it was working fine a few seconds prior.

Any clues?
thanks,
dani

Hmm, i think it’s a false positive actually. I think I’m accidentally thinking those warnings are fatal errors and outputting that "FAILED TO LINK ERROR’. I’ll have to check when I get into work tomorrow.

In the meantime, it’s a good idea to fix all warnings you see in GLSL as a warning in one nvidia driver version can turn into an error in a different one (the GLSL compiler is 100% inside the graphics driver, nothing to do with Touch, upgrading the driver changes the compiler).
GLSL is very sensitive to types, 1.0 is a float, 1 is an int, you can’t assign a float to an int without a cast (like float(1) for example).

I think if you just change your 1 to a 1.0 and your 0 to a 0.0 you wont get any errors and you won’t see that FAILED TO LINK error. Sorry for the confusion.