Varying Resources

So I know I can query the maximum number of varying floats using GL_MAX_VARYING_FLOATS but I am wondering what exactly this number represents.

The min value is 32 so lets assume we made the call on a given machine and it did return 32… does that mean our program can use 32 floats or 32 vec4s?

Also, does gl_TexCoord[i] therefore count as 1 of these 32 floats, as 4 of these floats, or neither?

Finally, are the other built-in varyings (gl_FrontColor, gl_FrontSecodaryColor, etc) counted in this total or are they separate?

p.s. Is there a tool available that you can test your program inside that will tell you how many resources you are attempting to use at any given time?

min value is 32 : does that mean our program can use 32 floats or 32 vec4s?
According to the vertex shader spec (search for MAX_VARYING_FLOATS, no GL_ prefix … :rolleyes: ), it is 32 floats (ie. 8 vec4s).
I heard that it might not be the case in practice, but I don’t remember if it was in NV or ATI camp…

Finally, are the other built-in varyings (gl_FrontColor, gl_FrontSecodaryColor, etc) counted in this total or are they separate?

There are counted in : when using custom varying, you override these.

Not sure about the TexCoord case, as they have their own limit, but it seems logical to me that they are included too.

search for MAX_VARYING_FLOATS, no GL_ prefix …
The OpenGL specs don’t use “gl” or “GL_” prefixes because that would render glossaries useless. :wink:

There are counted in : when using custom varying, you override these.

Not sure about the TexCoord case, as they have their own limit, but it seems logical to me that they are included too.

Look at the assembly output in NVIDIA’s implementation ( http://developer.nvidia.com/object/nvemulate.html ), there varyings are sharing slots with gl_TexCoord, means if you use eight vec4 varyings you cannot use gl_TexCoord at the same time.
That also means other slots are not counted in the varyings.

Originally posted by Relic:
.
That also means other slots are not counted in the varyings.

This is specific to Nvidia implementation.

The specification only states that the gl_Position is not varying. Any varying writen from the vertex shader is counted aginst the limit regardless of if it is the user defined varying or built-in one however the driver is free to compile program that exceeds the MAX_VARYING_FLOATS limit, if it can use device-dependent optimalization to fit it within hw limits.

The color interpolators on the Nvidia hw have limitations that prevent them from being used as generic varyings so the driver does not count them aginst that limit when they are used trough the gl_*Color built-in varyings. On hw without such limitation they might be counted aginst that limit.

Originally posted by Relic:
The OpenGL specs don’t use “gl” or “GL_” prefixes because that would render glossaries useless. :wink:
So what, glossaries ? In this case ok, strip then, but only on the glossary !
Ie, OpenCV : they have cv* prefixes everywhere, but not in their index, and that works. You can easily end up on the reference page.
http://opencvlibrary.sourceforge.net/CxCore#head-3772a3a918c17cd808c90b67a954caeb3dcb4247

What is see is that for a new OpenGL programmer it makes it impossible to find an official OpenGL document/spec, when searching the web for a method or constant. All you get when searching for full names are obsolete tutorials !

I do not say that for me, I am accustomed to this : but OpenGL is the only library I seen which has this stupid thing.

I don’t really care.
It’s similarly weird that you need to search with spaces instead of underbars in the Acrobat reader once you loaded the OpenGL 2.1 spec.
For example seaching for MAX_TEXTURE doesn’t find it, but MAX TEXTURE does.
Probably a special char for “_”
You get used to it. <sigh> :wink:

Is it still the case that using a varying float will actually use up a whole varying vec4? Or have any vendors corrected this problem yet?

Is it still the case that using a varying float will actually use up a whole varying vec4?
Do you mean attributes? Yep, that’s mentioned in the spec (section 4.3.4).

Originally posted by Leghorn:
[quote]Is it still the case that using a varying float will actually use up a whole varying vec4?
Do you mean attributes? Yep, that’s mentioned in the spec (section 4.3.4).
[/QUOTE]He meant varyings. Some ATI glsl compilers did not pack the varyings into vector interpolators so even single float varying consumed the same space as one vec4 varying which is violation of the specification. I do not know how is the current state of this because I am currently using the gl_* built-in varyings.

Ah, I see.

Let us hope that those days are behind us.

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