Graphics Reference
In-Depth Information
Figure 3.21. Changing the number of control points in the control patches passed on to the domain shader
stage.
Hull Shader Program
As mentioned above, the hull shader operates once for each output control point that needs
to be produced for the selected control patch output size. The number of output control
points is configured by the application by specifying it in the outputcontrolpoints func-
tion attribute. The system value semantic input attribute SV_OutputControlPoint identi-
fies which output control point is being created in each invocation of the hull shader pro-
gram. Its values range from 0 to n-\, where n is the number of output control points defined
in the outputcontrolpoints function attribute. This function attribute is the mechanism
by which the hull shader can expand or reduce the number of points in the output control
patch. To produce these output control points, the hull shader program receives the com-
plete set of control points that are included in the input control patch primitive as an input
attribute. This concept is visualized in Figure 3.21 for a hull shader that receives a 16-point
control patch and produces a four-point control patch.
Tessellation algorithm setup. This output control patch is the data that will later be used
in the domain shader stage. Because of this configuration, the hull shader can be thought
of as somewhat of a data setup stage for the tessellation system. As we just saw, the for-
mat of the input control patches can be modified, expanded, or reduced in the hull shader.
This functionality can be used to produce a control patch type that is compatible with the
desired tessellation algorithm implemented in the domain shader stage. With this in mind,
the hull shader could be used to consume a standard control patch primitive type (perhaps
mandated by the content creation tool chosen for a given project) and then produce the
required output patch format for the desired type of tessellation algorithm. This acts as an
isolation mechanism for the tessellation system, since a standard input can be provided,
and the output from the hull shader stage will always appear in the appropriate format for
Search WWH ::




Custom Search