Graphics Reference
In-Depth Information
Figure 3.28. The domain shader stage.
3.7.1 Domain Shader Pipeline Input
The domain shader stage is required to produce vertices to complete the tessellation pro-
cess and produce output geometry. It is invoked once for each coordinate point produced
by the tessellator stage. To create these vertices, it receives the complete control patch pro-
duced by the hull shader stage. This can vary from 1 to 32 control points, but it must match
the number of output points declared in the hull shader program's outputcontrolpoints
attribute. The control patch is declared here in a similar manner to how it was used in the
hull shader program, where the individual control points are provided in a template style
attribute. The structure type for each control point is the first argument, and the number of
points in the control patch is the second argument. Listing 3.15 provides a sample domain
shader program input signature, which demonstrates this template style attribute.
struct HS_CONTROL_POINT_OUTPUT
{
float3 WorldPosition
: POSITION;
} ;
Struct HS_CONSTANT_DATA_OUTPUT
{
float Edges[3] : SV_TessFactor;
float Inside : SV_InsideTessFactor;
};
[domain("tri")]
DS_OUTPUT DSMAIN(
const OutputPatch<HS_CONTROL_POINT_OUTPUT, 3> TrianglePatch,
float3 BarycentricCoordinates : SV_DomainLocation,
HS_CONSTANT_DATA_OUTPUT input )
{
// ...
}
Listing 3.15. A sample domain shader declaration, demonstrating the input attribute declarations.
Search WWH ::




Custom Search