I’ve read the spec a hundred times,but i just don’t get how varying variables work.(I work in GFX 5200 56.64)
For example:
Vertex code
varying vec4 v0;
varying vec4 v1;
Fragment code
varying vec4 v0;
varying vec4 v1;
As I see in the assembly output,v0 maps to TEXCOORD0 and v1 to TEXCOORD1.Now,in the vertex shader,if i write in the main() function:
“gl_TexCoord[0]=somevector” and I dont’t add a reference to gl_TexCoord[0] in the fragment shader,then the whole program is screwed up!
The vertex shader maps v0 to TEXCOORD1 and v1 to TEXCOORD2,but the fragment shader keeps mapping them to TEXCOORD0 and TEXCOORD1!
What I understand from all of this mess is this:
The mapping of a variable depends of its order of declaration and not its name.The first varying maps to TEXCOORD0,the second to TEXCOORD1…etc
Each shader maps first every built-in varying that is used and then maps the user-defined.
Are my thoughts correct?Is it a bug,poor design or what?