View Full Version : User Defined Varying Parameters
06-05-2007, 09:12 AM
Is there a limit to the number of user defined varying parameters that you can specify?
06-05-2007, 09:45 AM
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.
06-05-2007, 10:07 AM
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.
06-05-2007, 04:21 PM
If by "similar" you mean "completely different", then yes.
06-05-2007, 06:43 PM
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.
06-05-2007, 07:13 PM
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).
06-05-2007, 07:17 PM
So not really "completely different"?
06-06-2007, 06:34 AM
No, because the hardware is the same...
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.