I have a shader with 41 varying float. When I queried the MAX_VARYING_FLOATS from my driver with glGet it returned a 44.

However when the program goes to link it says that I have too many varying floats. Obviously, there’s too many, but is there an accurate way to gauge what the real maximum is.

I dropped the number of elements in in LightDir down to 2, for a grand total of 13 varying variables. And I’m starting to wonder if, since the minimum number of allowed varying floats in 32, there isn’t something wrong with my shader program or something else.

The number of varying floats is a querryable limitation, as you know. This means the number of total floats that you ask for in all your varying variables, not the number of varying variables you delcare. A “varying vec4” takes 4 floats.

Add to this that, for the sake of easy compilation, plenty of glslang compilers restrict you to a specific number of varying variables as well. This is typically 8, though I think NV40’s give you 10.

So, a “varying vec4 Foo[8]” takes 8 variables worth of floats, as well as 32 total varying floats.

keep in mind varying is practically everything that u pass from vertex shader->fragment not just the varying … stuff
thus texture coord etc are counted
eg (quasi syntax)
vs
gl_TexCoord = texcoord0; // bang thats 4 varying floats used

you must be using built in varyings as well. On The 9x00, the usable varying amount seems to be 32.

So, a “varying vec4 Foo[8]” takes 8 variables worth of floats, as well as 32 total varying floats.
I think the hw (9x00) support 8 vec4 interpolators and the NV40, 10.
glGet(GL_MAX_TEXTURE_COORDS) will probably tell you that.