I am sorry to post a question that may be easily tested, but I don't have an OGL4+ hardware at the moment and I have to make some design decision beforehand so I wanted a clear scenario.

Looking at various tutorial that involve tessellation shaders, each single parameter that I want to send from the texture shader to the fragment shader are before passed through tessellation shaders as well (as they always needed in the case I saw). If I have a variable that I want to send from vertex shader to the fragment one, but that's not needed by TCS and TES, can I just do something like

//// Vertex shader

out vec3 foo;

// Ignore foo in tessellation control and eval shader

//// Fragment shader
in vec3 foo;

or I have to pass foo through the tessellation shaders as well? I always understood the out variables are just being passed to the next stage, but what if the variable is not "picked" until another non-consecutive stage?

Thank you!


2 Answers 2


I'm not using a tessellation shader but I just ran a quick test trying to skip a variable past the geometry shader:

// vertex shader
out float foo;
foo = 0.5;

// ignore foo in geometry shader

// fragment shader
in float foo;

The result was a warning and an error:

WARNING: Output of vertex shader 'foo' not read by geometry shader

ERROR: Input of fragment shader 'foo' not written by geometry shader


I think you'd have to setup a seperate program object where the shader chain doesn't have a tesselation shader, but I suppose this isn't desirable most likely.

Just simply letting the variables pass through the shader would be the best option I guess, I don't know about tesselation shaders specifically but if they're like the vertex shader a simple line of code saying something like this should suffice:

in vec3 inFoo;
out vec3 outFoo;

void main() {
    outFoo = inFoo;
  • \$\begingroup\$ Thanks for the reply. Yes I'm aware that the solution you posted is perfectly possible, I was curious if a stage is skipped in the chain if the in for a given out was not put in the consequent stage. It is a "general knowledge" curiosity more than a practical issue. So you're saying that I can't skip stages in situations like the one I depicted in the question text? \$\endgroup\$
    – JTulip
    Commented Jul 18, 2014 at 12:40
  • \$\begingroup\$ As far as my knowledge goes, a shader chain is decided per program, and passing variables through the shaders means passing those through all the shaders until the last occurrence you need said variables. \$\endgroup\$
    – dammkewl
    Commented Jul 19, 2014 at 23:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .