View Full Version : Max Varying float?

adamnation

06-07-2005, 08:57 AM

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.

My varying variable are:

varying vec4 LightDir[8];

varying vec3 n1;

varying vec3 t1;

varying vec3 b1;Running on a Radeon 9600 Pro, using the latest catalyst drivers.

adamnation

06-07-2005, 09:35 AM

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.

help please.

Korval

06-07-2005, 10:17 AM

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

fs

texcoord[0]

adamnation

06-07-2005, 09:05 PM

Well it looks like my 9600 Pro only let's me have ten.

It works with

varying vec4 LighPos;

varying vec4 SpotPos;

varying vec2 foo;But not with:

varying vec4 LighPos;

varying vec4 SpotPos;

varying vec3 foo;Anyway around this?

V-man

06-27-2005, 06:06 PM

adamnation,

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.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.