Sorry to sound so snippy.
What you call “moody” I call “conformant.”
// ( … , const in vec3 norm, … )
vec4 lightVec = normalize(light.position - pos);
float diffuseLight = max(dot(norm, lightVec), 0);
error on previous line
ERROR: 0:129: ‘dot’ : no matching overloaded function found
ERROR: 0:129: ‘max’ : no matching overloaded function found
One, overloaded built-in functions in GLSL are matched exactly. There is no:
float dot( const in vec3 a, const in vec4 b );
I have an idea what function NVIDIA’s implementation decided to match for you.
It probably matched:
float dot( const in vec3 a, const in vec3 b ); // valid implied cast of b exists
It also probably warned you on this.
You should double check their documentation.
(Cg appendix A may or may not help you here.)
Or you could look at their NV_fragment_programN
output from their compiler to find out for sure.
Two, there are no casts in GLSL.
In GLSL you should construct.
Three, there is no overloaded built-in function in GLSL for:
float max( const in float x, const in int y);
Recommend that you at least add GLSLvalidate
to your shader development tool chain.
This will give you a way to continue to develop on NVIDIA hardware,
but you’ll have a conformant front end to catch your errors.
Recommend that you continue your cross implementation development.
But understand that the “moody” ATI shader compiler is the more correct one.
Recommend the Orange Book.
On this specific problem, you probably want:
vec3 lightVec = normalize(light.position.xyz - pos.xyz); // normalize a vec3
float diffuseLight = max(dot(norm, lightVec), 0.0); // float literal const 0.0 insted of int literal const 0