Graphics Reference
In-Depth Information
(
InputPatch<VS_OUTPUT, 3> ip
, uint PatchID : SV_PrimitiveID
)
{
HS_PER_PATCH_OUTPUT o = (HS_PER_PATCH_OUTPUT)0;
o.edgeTesselation[0]
= o.edgeTesselation[l]
= o.edgeTesselation[2]
= 2.0f;
o.insideTesselation[0] = 2.0f;
return o;
}
Listing 4.1 . A simple hull shader constant function.
The important detail is that the constant function MUST output SV_TessFactor and
SV_InsideTessFactor values, which specify how finely to tessellate the current primitive.
The tessellator can work on three fundamental types of primitives, and the corresponding
output structure varies accordingly. Each of these primitive types, the number of compo-
nents in their tessellation factors, and a brief sample declaration, are provided in Table 4.1.
Primitive
Type
SVTessFactor
SV_InsideTessFactor
Example
struct HS PER PATCH OUTPUT
{
struct HS PER PATCH OUTPUT
{
Line
2
0
float lenAndThick[2] : SVJessFactor;
float lenAndThick[2] : SVJessFactor;
II...
other values
};
struct HS PER PATCH OUTPUT
{
struct HS PER PATCH OUTPUT
{
float edges[3] : SV_TessFactor;
float inside[l] : SVJEnsideTessFactor;
float edges[3] : SV_TessFactor;
float inside[l] : SVJEnsideTessFactor;
// ... other values
Triangle
3
1
};
struct HS PER PATCH OUTPUT
{
struct HS PER PATCH OUTPUT
{
float edges [4] : SV_TessFactor;
float inside[2] : SVJEnsideTessFactor;
float edges [4] : SV_TessFactor;
float inside[2] : SVJEnsideTessFactor;
// ... other values };
Quad
4
2
Table 4.1. Primitive types, tessellation factors, and examples.
Search WWH ::




Custom Search