Graphics Reference
In-Depth Information
constant function is only executed once for each complete control patch. This function's
primary purpose is to define several tessellation factors, which tell the tessellator stage how
finely to tessellate the input primitives. It can also calculate additional attributes that are
constant for a complete control point patch, which are then supplied to the domain shader
later in the pipeline. The hull shader stage is the only programmable pipeline stage that is
required to provide two functions in HLSL.
Throughout the remainder of this chapter, we will further explore how this combina-
tion of functions allows the hull shader stage to enable a wide variety of tessellation algo-
rithms. We begin by examining the typical inputs to the stage, and what types of states are
available for configuration. This is followed by a discussion of typical processing opera-
tions that are suitable for the hull shader. Finally, we will look at the data produced by the
hull shader stage, and where in the pipeline it is passed on to.
3.5.1 Hull Shader Pipeline Input
The hull shader stage is situated immediately after the vertex shader stage in the pipeline.
Its input data is a set of processed vertices produced by the vertex shader, which is com-
bined with the primitive stream information produced by the input assembler stage to form
control patch primitives. Strictly speaking, the hull shader program operates on complete
control patches, which are made up of control points, and not vertices. However, there
is little distinction between control points and vertices. Both vertices and control points
define a position, along with some additional attributes, so there is not much difference
in their contents. The only difference between control points and vertices is actually de-
termined by the primitive topology specified in the input assembler stage. If the pipeline
configuration for a particular draw call will use the tessellation stages, 1 3
it must declare one
of the control point patch list primitive types. If an equivalent topology is passed instead
(a triangle list topology in the place of a three-point control patch list, for example) the
runtime will issue an error. Because of this, we can assume that if the tessellation stages are
active, we can say that the vertex shader processes control points. If the tessellation stages
are not active, we say that the vertex shader as processes vertices.
As mentioned above, the hull shader program is executed once for each of the de-
sired output patch's control points. Every invocation of the hull shader program has full
knowledge of all of the control points in the current input control patch. These points are
received as a pipeline input attribute, which is declared in a template-like fashion. Two
template parameters are declared in the attribute: the structure of the data produced by the
vertex shader, and the number of points in the input control patch. The number of points in
the control patch must match the number specified in the input assembler's topology type.
The geometry shader stage is also capable of receiving control patches, as well as the tessellation stages.
Search WWH ::




Custom Search