Geometry shader
![]() |
This article needs additional citations for verification. (July 2008) |
A geometry shader (abbreviated GS) is a shader program model introduced to DirectX with Shader Model 4.0 of DirectX 10[1]. NVIDIA GeForce 8800 GPUs were the first providing hardware support for Geometry Shaders[2]. This feature is supported in Direct3D 10 and in OpenGL 3.2 (or OpenGL 1.1 using the EXT_geometry_shader4 extension).
Function
A geometry shader can generate new graphics primitives, such as points, lines, and triangles, from those primitives that were sent to the beginning of the graphics pipeline[3].
Geometry shader programs are executed after vertex shaders. They take as input a whole primitive, possibly with adjacency information. For example, when operating on triangles, the three vertices are the geometry shader's input. The shader can then emit zero or more primitives, which are rasterized and their fragments ultimately passed to a pixel shader.
Typical uses of a geometry shader include point sprite generation, geometry tessellation, shadow volume extrusion, and single pass rendering to a cube map. A typical real world example of the benefits of geometry shaders would be automatic mesh complexity modification. A series of line strips representing control points for a curve are passed to the geometry shader and depending on the complexity required the shader can automatically generate extra lines each of which provides a better approximation of a curve. A research program led by Gernot Ziegler [4] developed Histopyramids which appear to give better performance than geometry shaders in a variety of situations[5].
Programming
Geometry shaders can be programmed in the following languages: assembly, Cg, Direct3D's HLSL (beginning with DirectX 10) and OpenGL's GLSL.