If a pipeline includes both tessellation shaders (control and evaluation),
the tessellator consumes each input patch (after vertex shading) and
produces a new set of independent primitives (points, lines, or triangles).
These primitives are logically produced by subdividing a geometric primitive
(rectangle or triangle) according to the per-patch outer and inner
tessellation levels written by the tessellation control shader.
These levels are specified using the built-in variables TessLevelOuter
and TessLevelInner
, respectively.
This subdivision is performed in an implementation-dependent manner.
If no tessellation shaders are present in the pipeline, the tessellator is
disabled and incoming primitives are passed through without modification.
The type of subdivision performed by the tessellator is specified by an
OpExecutionMode
instruction in the tessellation evaluation or
tessellation control shader using one of execution modes Triangles
,
Quads
, and IsoLines
.
Other tessellation-related execution modes can also be specified in either
the tessellation control or tessellation evaluation shaders, and if they are
specified in both then the modes must be the same.
Tessellation execution modes include:
Triangles
, Quads
, and IsoLines
.
These control the type of subdivision and topology of the output
primitives.
One mode must be set in at least one of the tessellation shader stages.
VertexOrderCw
and VertexOrderCcw
.
These control the orientation of triangles generated by the tessellator.
One mode must be set in at least one of the tessellation shader stages.
PointMode
.
Controls generation of points rather than triangles or lines.
This functionality defaults to disabled, and is enabled if either shader
stage includes the execution mode.
SpacingEqual
, SpacingFractionalEven
, and
SpacingFractionalOdd
.
Controls the spacing of segments on the edges of tessellated primitives.
One mode must be set in at least one of the tessellation shader stages.
OutputVertices
.
Controls the size of the output patch of the tessellation control
shader.
One value must be set in at least one of the tessellation shader
stages.
For triangles, the tessellator subdivides a triangle primitive into smaller
triangles.
For quads, the tessellator subdivides a rectangle primitive into smaller
triangles.
For isolines, the tessellator subdivides a rectangle primitive into a
collection of line segments arranged in strips stretching across the
rectangle in the u dimension (i.e. the coordinates in TessCoord
are of the form (0,x) through (1,x) for all tessellation evaluation shader
invocations that share a line).
Each vertex produced by the tessellator has an associated (u,v,w) or (u,v) position in a normalized parameter space, with parameter values in the range [0,1], as illustrated in figure Figure 21.1, “Domain parameterization for tessellation primitive modes”.
For triangles, the vertex’s position is a barycentric coordinate (u,v,w), where u + v + w = 1.0, and indicates the relative influence of the three vertices of the triangle on the position of the vertex. For quads and isolines, the position is a (u,v) coordinate indicating the relative horizontal and vertical position of the vertex relative to the subdivided rectangle. The subdivision process is explained in more detail in subsequent sections.