The input_primitive type must match the primitive type for the vertex stream provided to the GS. The accepted input primitive type is defined in the shader: This makes layered rendering easier to implement and possibly faster performing, as each layer's primitive(s) can be computed by a separate GS instance.Įach geometry shader is designed to accept a specific Primitive type as input and to output a specific primitive type. The other feature was GS instancing, which allows multiple invocations to operate over the same input primitive. This is used exclusively with transform feedback, such that different feedback buffer sets can get different transform feedback data.
One was the ability to write to multiple output streams.
In OpenGL 4.0, GS's gained two new features. Transform Feedback: This is often employed for doing computational tasks on the GPU (obviously pre- Compute Shader).Layered rendering: taking one primitive and rendering it to multiple images without having to change bound rendertargets and so forth.While the GS can be used to amplify geometry, thus implementing a crude form of tessellation, this is generally not a good use of a GS. GS's are written to accept a specific input primitive type and to output a specific primitive type. There are implementation-defined limits on how many primitives can be generated from a single GS invocation. Geometry shader invocations take a single Primitive as input and may output zero or more primitives. Geometry shaders reside between the Vertex Shaders (or the optional Tessellation stage) and the fixed-function Vertex Post-Processing stage.Ī geometry shader is optional and does not have to be used. A Geometry Shader (GS) is a Shader program written in GLSL that governs the processing of Primitives.