Is there a limit to the number of user defined varying parameters that you can specify?
Yes. Read the GLSL spec chapter 7.4 Built-In Constants.
gl_MaxVaryingFloats is defining it and must be at least 32.
Because most architectures are vec4 based, that translates to eight vec4 varyings.
Clever compilers will group smaller varyings into those.
The number of user varyings is also depending on how many built-in varyings you use.
Think about the user defined varyings as the eight gl_TexCoord slots. The other built-in ones are additional.
Thanks for the reply,
I’m more familiar with CG where you have the TEXCOORD0-TEXCOORD7 binding semantics to use, I guess it’s similar with GLSL.
If by “similar” you mean “completely different”, then yes.
No need for the attitude, I’m just trying to learn here. If I’m wrong, just correct me. Although 8 vec4 varyings seem similar to 8 float4 varying texcoords.
Although 8 vec4 varyings seem similar to 8 float4 varying texcoords.
It’s the same basic concept. The only difference is semantics. Literally.
In the CG/HLSL case, you’re telling the system to pretend the data is a texture coordinate. You are under no restrictions on how you may use them, but they are called texture coordinates.
Glslang, on the other hand, doesn’t pretend it’s anything in particular; it doesn’t provide any semantics on what the value is. It simply says that the floating-point values will be interpolated in a perspective-correct manor over the surface of the polygon and passed to the fragment shader.
Really, the only functional difference is that glslang specifies them as a number of floats rather than some number of vec4 values. Thus, it implies that an implementation that exposes 32 floats will allow you to have 8 vec4’s, 16 vec2’s, etc. This is rarely met in practice (as of a year ago or so; I haven’t tested it on recent drivers).
So not really “completely different”?
No, because the hardware is the same…
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.