Let's say I have a variable variable between any two stages of the GLSL shader (for example, the vertex and fragment stage) declared as vec4
:
in/out/varying vec4 texCoord;
What happens if I use only part of this variable (say through swizzling) in both shaders, i.e. I write only its part in the vertex shader and read only the same part in the fragment shader?
texCoord.st = ...
... = texture2D(..., texCoord.st);
Is it a guarantee (i.e. specification) to always give reasonable results? It seems reasonable that this is so, but I'm not too good at the intricacies of the language of GLSL lawyers and don "I don’t know if this variable is interpreted somehow by the" incomplete "compiler / linker, because it is not completely written down at the previous stage. I I'm sure that the values texCoord.pq
will be undefined in any case, but does it affect the reliability texCoord.st
too or does the whole system as a whole work at a pure component level?
GLSL , , , "" , , ( , ). GLSL, , , gl_TexCoord[]
GLSL 1.10.