Tessellation Control Shader/Defined Inputs
Jump to navigation
Jump to search
Tessellation Control Shaders provide the following built-in input variables:
in int gl_PatchVerticesIn;
in int gl_PrimitiveID;
in int gl_InvocationID;
- gl_PatchVerticesIn
- the number of vertices in the input patch.
- gl_PrimitiveID
- the index of the current patch within this rendering command.
- gl_InvocationID
- the index of the TCS invocation within this patch. A TCS invocation writes to per-vertex output variables by using this to index them.
The TCS also takes the built-in variables output by the vertex shader:
in gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
} gl_in[gl_MaxPatchVertices];
Note that just because gl_in is defined to have gl_MaxPatchVertices entries does not mean that you can access beyond gl_PatchVerticesIn and get reasonable values. These variables have only the meaning the vertex shader that passed them gave them.