Graphics Reference
In-Depth Information
executed, the later stages cannot see any of the original data from the vertex buffer, so if
any of this source data is useful, it should be passed down as part of an output.
4.2.3 Hull Shader
This is the first new programmable unit in the Direct3D 11 pipeline. It is made up of two
developer-authored functions—the hull shader itself and a "constant function."
The constant function is executed once per patch. Its job is to compute any values
that are shared by all control points and that don't logically belong as per-control-point
attributes. As far as Direct3D 11 is concerned, the requirement is to output an array of
SV_TessFactor and SV_InsideTessFactor values. The size of these arr/ays varies, de-
pending on the primitive topology defined in the input assembler stage, details of which
are discussed later in this chapter. The outputs from a constant function are limited to 128
scalars (32 float-4s), which provides ample room for any additional per-patch constants
once the tessellation factors have been included.
An attribute on the main hull shader function declares
how many output control points will be generated. This can
be a maximum of 32 and does not have to match the to-
pology set on the input assembler it is perfectly legal for
the hull shader to increase or decrease the number of con-
trol points. This attribute determines how many times the
individual hull shader is executed, once for each of the de-
clared output control points (the index is provided through
SV_OutputControlPointID uint input). The quantity of
data can be up to 32 float4sor 128 scalars, the same as for
the per-patch constant function, but with one difference; the
maximum output for all hull shader invocations triggered by
a given input patch is 3,968 scalars. In practice, this means
that if you're outputting 32 control points, you can only use
31 float4s, instead of 32. Putting these numbers together, the
entire hull shader output size is clamped to 4 KB.
Both functions have full visibility of all vertices output
by the vertex shader and deemed to be part of this primitive.
This is represented in Figure 4.5 by the blue arrows leading from the Vertex Shading sec-
tion to each of the hull shader and constant function invocations.
Figure 4.5. Hull shader stage.
4.2.4 Fixed-Function Tessellator
The next stage of processing is entirely fixed function and operates as a black-box, except
for the two inputs—the SV_TessFactor and SV_InsideTessFactor values output by the
hull shader constant function (see Figure 4.6).
Search WWH ::




Custom Search