As far as I know, EndStreamPrimitive (...)
currently has no use; likely provided simply for consistency with the non-stream GLSL design. If the restriction on points
being the only type of output primitive is lifted it may become useful in the future.
To answer your second question, that is the maximum number of vertices you will ever emit in a single invocation of your GS. Geometry Shaders are different from other stages in that the size of their output data can vary at run-time. You could decide because of some condition at run-time that you want to output 8 vertices to stream 1 -- GLSL needs to know an upper-bound and it cannot figure that out if your flow control is based on a variable set elsewhere.
There are implementation limits set on both the number of vertices (GL_MAX_GEOMETRY_OUTPUT_VERTICES
) a GS invocation can emit and the sum total number of vector components (GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS
). These limits are also defined in the shading language.
Implementations must support the following minimums:
const int gl_MaxGeometryOutputVertices = 256;
const int gl_MaxGeometryTotalOutputComponents = 1024;
If your shader exceeds those limits, you will need to split it into multiple invocations. You can either do that using multiple draw calls or you can have GL4+ automatically invoke your GS multiple times:
layout (invocations = <num_invocations>) in;
You can determine which invocation the GS is performing by the value of gl_InvocationID
(GL4+).