So if you're emitting vertices to a different stream, you don't have to write to them. These outputs are always associated with stream 0. Therefore, unless rasterization is being turned off, you must write to some of these values. The GS is the final Vertex Processing stage. In order to use this variable, the user must manually redeclare it with an explicit size. Each element in the array is one clip plane. A positive distance means that the vertex is inside/behind the clip plane, and a negative distance means it is outside/in front of the clip plane.
gl_ClipDistance allows the shader to set the distance from the vertex to each User-Defined Clip Plane. It only has a meaning when rendering point primitives, which in a TES requires using the point_mode input layout qualifier. gl_PointSize the pixel width/height of the point being rasterized. Gl_Position the clip-space output position of the current vertex. Primitive restart, if used, has no effect on the primitive ID.
gl_PrimitiveID the index of the current patch in the series of patches being processed for this draw call. Attempts to index per-vertex inputs by a value greater than or equal to gl_PatchVerticesIn results in undefined behavior. This is either the output vertex count specified by the TCS, or the patch vertex size specified by glPatchParameter if no TCS is active. gl_PatchVerticesIn the vertex count for the patch being processed. All valid values are normalized floats (on the range ). For triangles, all three components have valid values. For isolines and quads, only the XY components have valid values. Which components of this vec3 that have valid values depends on the abstract patch type. Every input parameter other than this one will be identical for all TES invocations within a patch. In int gl_PrimitiveID gl_TessCoord the location within the tessellated abstract patch for this particular vertex. Otherwise just the gl_ClipDistance built-in needs to be redeclared. With GLSL 4.10 or ARB_separate_shader_objects, the whole gl_PerVertex block needs to be redeclared. A non-negative distance means that the vertex is inside/behind the clip plane, and a negative distance means it is outside/in front of the clip plane. gl_ClipDistance allows the shader to set the distance from the vertex to each user-defined clipping half-space. It will be clamped to the GL_POINT_SIZE_RANGE.
It only has a meaning when rendering point primitives. These variables may not be redeclared with interpolation qualifiers. The text below explains how the Vertex Post-Processing system uses the variables. These variables only take on the meanings below if this shader is the last active Vertex Processing stage, and if rasterization is still active (ie: GL_RASTERIZER_DISCARD is not enabled). The block is defined without an instance name, so that prefixing the names is not required. Gl_PerVertex defines an interface block for outputs.