PDA

View Full Version : maximum number of active uniform variables



powerpad
06-20-2005, 11:55 AM
Is there a limit on the number of active uniform variables within a shader? Because it seems to me that I cannot have more than 8 active uniform variables in my fragment shader.
I found nothing about that in the spec.

thanks

Korval
06-20-2005, 01:30 PM
In a vertex shader, you should be able to have upwards of 128 4-vector uniforms available, if not more. In a fragment shader, you can have as few as 12 or so. Note that built-in uniforms count against this limit. But only if you actually declare them.

And this is a querriable implementation-defined number.

powerpad
06-20-2005, 07:23 PM
thanks

powerpad
06-21-2005, 06:47 AM
how do I query that number...

since this

GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB

tells me I have 512 uniform components within my fragment program.

And the spec. says
const int gl_MaxFragmentUniformComponents = 64;// ARB_fragment_shader

However I use two builtin 4x4 matrices - thus 32 uniforms + 4 vec4 = 16 + a sampler2D

in total this is 48 + sampler2D

zed
06-21-2005, 11:55 AM
Because it seems to me that I cannot have more than 8 active uniform variablesas korval saiz u need to include the built in ones eg texturecoords, also perhaps u dont realise its components
thus vec4 counts as 4 not as 1

powerpad
06-21-2005, 12:33 PM
I did realize that a vec4 consists of 4 components and I thought that only active uniforms count thus if I don't use gl_TexCoord[i] it will not count or am I wrong here?