Graphics Reference
In-Depth Information
The HLSL compiler will consider it an error if the output structure does not match
the declared primitive type.
The number of components in SV_TessFactor matches the number of edges the
primitive has, except in the case of a line, where the first value is tessellation along the
length of the line, and the second value is the thickness of the tessellation.
SVInsideTessFactor makes more sense when seen visually and is covered later in
this section.
The algorithms used to determine the tessellation parameters are subject to the com-
mon HLSL and shader programming rules. The code must reside in its own function and
can use hard-coded constants, constant buffers, or regular buffers, as well as entirely from
first principles without external inputs.
The constant function has visibility of all outputs from the vertex shader, but not
the final control points as generated by the other part of the hull shader. The previously
mentioned example of adaptive tessellation according to final image contribution could be
performed with this information a rough approximation of the final size within the raster-
ized image could be made, and the tessellation factors adjusted accordingly.
4.3.3 HLSL Helper Functions
For the most part, the selection of tessellation factors is left to the author of the hull shad-
er's constant function. However Shader model 5.0 defines several utility functions that can
be useful when determining intermediary values, as well as handling the pow2 partitioning
mode. This latter point is important, as the other three partitioning modes do not require
these helper methods and are implemented "behind the scenes" by the compiler; pow2
partitioning must be configured through these intrinsic functions. Table 4.2 provides some
information.
The minimum, maximum, or average of the edge factors is then combined with the
InsideScale parameter to determine the final internal tessellation factor(s) for the primi-
tive being rendered.
In each of the methods listed above, the final three parameters are marked as outputs
that can be retrieved and inspected by HLSL code within the hull shader. With knowl-
edge of the partitioning function, it is easy to write a function of the raw (unrounded) and
rounded tessellation factors to compute the current interpolation factor, which could be
very important for the later domain shader stage. As explained in the next section, there are
important cases where knowledge of neighboring tessellation factors is essential to ensure
a continuous surface without gaps.
Search WWH ::




Custom Search