PDA

View Full Version : Varying Resources



PickleWorld
11-30-2006, 12:34 PM
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?

ZbuffeR
11-30-2006, 01:51 PM
min value is 32 : does that mean our program can use 32 floats or 32 vec4s?According to the vertex shader spec (http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_shader.txt) (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.

Relic
12-01-2006, 02:19 AM
search for MAX_VARYING_FLOATS, no GL_ prefix ... The OpenGL specs don't use "gl" or "GL_" prefixes because that would render glossaries useless. ;)


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.

Komat
12-01-2006, 03:22 AM
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.

ZbuffeR
12-01-2006, 03:49 AM
Originally posted by Relic:
The OpenGL specs don't use "gl" or "GL_" prefixes because that would render glossaries useless. ;) 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.

Relic
12-01-2006, 04:23 AM
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> ;)

mogumbo
12-05-2006, 11:01 AM
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?

Brolingstanz
12-05-2006, 03:49 PM
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).

Komat
12-05-2006, 04:11 PM
Originally posted by Leghorn:

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). 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.

Brolingstanz
12-05-2006, 05:20 PM
Ah, I see.

Let us hope that those days are behind us.