Search code examples
openglglslshader

Use 'in' or 'out' in layout when create tessellation evaluation shaders?


In OpenGL Programming Guide, some code use 'in' in tessellation evaluation shader like this:

layout(triangles,equal_spacing,ccw,points) out;

and some times like this:

layout (quads,equal_spacing,cw) in;

the name of variables changes,some times it's out,some times in,I'm confused.And I changed it in my code, there are no differences,so what are the differences between in and out?


Solution

  • [...] the name of variables changes, some times it's out, some times in.

    No it is not.

    The Tessellation Evaluation Shader allows you to specify input layout qualifiers for the primitive-mode, vertex-spacing, and order.
    The Tessellation Control Shader allows you to specify the output layout qualifier for the number of vertices.

    See OpenGL Shading Language 4.60 Specification (HTML) - 4.4. Layout Qualifiers

    The layout qualifier:

    layout(triangles,equal_spacing,ccw,points) out;
    

    is incorrect and causes a compile time error.