I have a vertex shader that computes some lighting effects. When I try to call the following function:
void DirectionalLight(in int i,in vec3 normal, inout vec4 diffuse)
{
float nDotVP;
float nDotHV;
nDotVP = max(0.0, dot(normal, vec3(gl_LightSource[i].position)));
nDotHV = max(0.0, dot(normal, vec3(gl_LightSource[i].halfVector)));
diffuse += gl_LightSource[i].diffuse * nDotVP;
}
I get this error:
“The glsl vertex shader will run in software - availble number of temporary registers exceeded…”
If I comment out the line:
nDotHV = max(0.0, dot(normal, vec3(gl_LightSource[i].halfVector)));
Then the shader runs in hardware.
Also, if I “manually inline” the function in main(), then the shader also runs in hardware.
What exactly does the error “availble number of temporary registers exceeded” mean?
Thanks for any insight