4 cbuffer TessellationBuffer : register(b0)
6 float tessellationAmount;
16 float3 position : POSITION;
20 struct ConstantOutputType
22 float edges[3] : SV_TessFactor;
23 float inside : SV_InsideTessFactor;
28 float3 position : POSITION;
33 ////////////////////////////////////////////////////////////////////////////////
34 // Patch Constant Function
35 ////////////////////////////////////////////////////////////////////////////////
36 ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
38 ConstantOutputType output;
41 // Set the tessellation factors for the three edges of the triangle.
42 output.edges[0] = tessellationAmount;
43 output.edges[1] = tessellationAmount;
44 output.edges[2] = tessellationAmount;
46 // Set the tessellation factor for tessallating inside the triangle.
47 output.inside = tessellationAmount;
53 ////////////////////////////////////////////////////////////////////////////////
55 ////////////////////////////////////////////////////////////////////////////////
57 [partitioning("integer")]
58 [outputtopology("triangle_cw")]
59 [outputcontrolpoints(3)]
60 [patchconstantfunc("ColorPatchConstantFunction")]
62 HullOutputType main(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
64 HullOutputType output;
66 // Set the position for this control point as the output position.
67 output.position = patch[pointId].position;
69 // Set the input color as the output color.
70 output.color = patch[pointId].color;