TessellatePatchShaderAttribute
Description
- Derived from
-
TessellateShader abstract
A Tessellation Patch Shader (TP).
The method body must have a specific syntactic form, so that code generation may identify and separate the code for computing patch constant data and patch control-points:
[TessellatePatchShader(?, ?, ?, COUNT-IN, COUNT-OUT)]
public static OUTPUT NAME(INPUT[] points, ref PATCH data, int index)
{
OUTPUT result;
if (index == 0)
{
// The code in the branch of the second statement ('if' at index 1) computes the
// constant patch data by updating 'patch', using the 'input' data. Computation
// must always include the tessellation factors and may optionally include
// additional values.
...
}
// The middle statements (indices 2..N-2) compute the data of the 'index'-th patch
// control-point, using the 'input' and 'patch' data.
...
// The last statement (index N-1) returns the data of the patch control-point.
return result;
}
The placeholders have the following meaning:
-
COUNT-IN:
The number of input control-points (from the vertex buffer). -
COUNT-OUT:
The number of output control-points (for the tessellation stage). -
OUTPUT:
A stage parameter struct that holds the index-th output control-point. Must be named'result'. -
NAME:
The name of the tessellation shader. -
INPUT:
A stage parameter struct that holds an input control-point. Must be named'points'. -
PATCH:
A stage parameter struct that holds constant patch data. Must be named'data'.
Usages
Example.TP method
Terrain.TP_Material method