Graphics Reference
In-Depth Information
Function Attributes
To control the tessellation scheme used in the three tessellation stages, several function at-
tributes are required in the HLSL code of the hull shader. These attributes are different than
the input and output pipeline data flow attributes passed between pipeline stages. Instead,
these are individual statements that perform a specific configuration of the tessellation
system. The attributes must be located above the hull shader program in the HLSL source
code, since they are used to validate the shader program itself. The list of attributes is pro-
vided in Listing 3.14. Each attribute will be described when its subject area is discussed
throughout this section. We list them here, followed by a brief description.
// Specifies the 'domain' of the primitive being tessellated.
[domain("tri")]
// Specifies the method to tessellate with.
[partitioning("fractional_even")l
// Specifies the type of primitives to be created from the tessellation.
[outputtopology("triangle_cw")]
// Specifies the number of points created by the Hull Shader program (which
// is also the number of times the hull shader program will execute).
[outputcontrolpoints(3)]
// Specifies the name of the patch constant function.
[patchconstantfunc("PassThroughConstantHS")l
// Specifies the largest tessellation factor that the patch constant
// function will be able to produce.
This is optional and provided as a
// hint to the driver.
[maxtessfactor(5)]
Listing 3.14. Function attributes of the hull shader program.
3.5.3 Hull Shader Stage Processing
The processing tasks intended for the hull shader stage are split between the two HLSL
functions that an application must provide. Since the hull shader program creates the out-
put control points that are passed down the pipeline, its primary responsibility is to read
the input control patches that were produced earlier in the pipeline, and translate them to
the desired output control patch format. The patch constant function is responsible for de-
termining the necessary tessellation factors according to a developer-defined metric. In the
following sections, we will examine some higher-level concepts that these functions may
be used to perform.
Search WWH ::




Custom Search