Limited number of varying?

Is there a restriction regarding the number of varying variables? I currently use 4 x vec3, 2 x vec2 and 2 x vec4. That works fine, but when I use another I get this error:

(28) : error C5041: cannot locate suitable resource to bind parameter "diffuseProduct"
63 lines, 1 errors.

(23) : error C5041: cannot locate suitable resource to bind parameter "diffuseProduct"
44 lines, 1 errors.

Failed to compile shader.
Error loading shaders.

That is even if its a single float. The target hardware is FX5950. I’ve tested with drivers 61.06 (Linux), 61.71 (win), 61.76 (win) and 62.20 (win). I can post the code if it helps.

In general, (for non-GeForce 6xxx hardware) 8 vector varyings is all you get. Smarter compilers will eventually be able to concatonate smaller varyings into larger ones. For example, the compiler has the ability to take your 2 vec2’s and use a single vec4 varying on it. However, glslang compilers are just trying to be compliant these days; eventually they’ll get around to more aggressive optimizations.

In the meantime, you can always do it yourself. Just use a vec4 instead of 2 vec2’s.

Thank you!

One more note. NV4x hardware supports 10 varying vectors, as I recall.

you can get the number of varying floats avalaible with the right glGet* (GL_MAX_VARYING_FLOATS_ARB, and GL_MAX_TEXTURE_COORDS_ARB) (you can have more varyings than texture interpolators, for example, you can have 8 texture interpolators, but 64 varying floats)

If you need more than 8, you can pass some data in color and secondary color too.

Great! Thanks alot!

It seems like we can never get away from hw specs entirely and have to rely on nv/ati set limits instead. Sucks imo.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.