View Single Post
Old 02-08-07, 05:44 AM   #1
squeen
Registered User
 
Join Date: Dec 2006
Location: Greenbelt, MD
Posts: 33
Default Real GLSL Shader Variable Limits (Quadro FX 5500)

I'm writing this concerning a question on the number of uniform variables available to a GLSL (fragment) shader using the 1.0-9742 driver on RHEL WS4. Although the openGL limit on GL_MAX_FRAGMENT_UNIFORM_COMPONENTS reports 2048. I am running into a far smaller limit in the fragment shader before the compiler dumps errors. For example the following declarations run just fine

Code:
#define SHADOW_MAP_SIZE  2048
#define SHADOW_AMBIENT   0.01
#define ENV_MIX          0.85
#define ENVMAP_BLUR      0
#define BLUR_DIST        0.004
#define NUMLIGHTS        4

varying vec3   Normal;
varying vec3   ecPosition3;

float mat_shininess;

uniform sampler2D       diffTex;
uniform sampler2DShadow depthTex[NUMLIGHTS];
uniform samplerCube     cubeTex;
uniform int             cnState;
However, if I increase NUMLIGHTS to 5, I get
Code:
(9) : error C5041: cannot locate suitable resource to bind parameter "ecPosition3"
and NUMLIGHTS 6 gives:

Code:
Fragment info
-------------
(8) : error C5041: cannot locate suitable resource to bind parameter "Normal"
(9) : error C5041: cannot locate suitable resource to bind parameter "ecPosition3"
This is the basic out-of-resource error I've seen before when I had too many varying variable (GL_MAX_VARYING_FLOATS = 32) being passed between vertex->fragment shader and I can accept that a real limit exists for number of varyings (which require perspective correct interpolation), I'm just surprised that the total (~32 bytes?) seems to be a combination of varying AND uniforms. Furthermore, the limit on uniforms where I'm hitting it (around 7 textures) really doesn't make sense since there are suppose to be (on the Quadro FX 5500 I'm using) GL_MAX_TEXTURE_IMAGE_UNITS=16 texture image units available to shaders. I must be getting something wrong.

Can anyone offer any insight?
squeen is offline   Reply With Quote