This is the code that I used to create the tessellation, I hide the some code to show only the necessary for you.
ps: tess_factor is a parameter of constant buffer.
HS_OUTPUT_DATA hs_patch(InputPatch<VERTEX_PASS, 3> ip, uint pid : SV_PrimitiveID)
{
HS_OUTPUT_DATA ret;
float tess = tess_factor;
ret.edges[0] = ret.edges[1] = ret.edges[2] = tess;
ret.inside = tess; // same value that edges
return ret;
}
[domain("tri")]
[partitioning("integer")] // integer, fractional_even, fractional_odd
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("hs_patch")]
HS_OUTPUT hs(InputPatch<VERTEX_PASS, 3> ip, uint index : SV_OutputControlPointID)
{
HS_OUTPUT ret;
ret.pos = ip[index].pos;
return ret;
}
[domain("tri")]
VERTEX_PASS ds(HS_OUTPUT_DATA input, float3 dl : SV_DomainLocation, const
OutputPatch<HS_OUTPUT, 3> bp)
{
VERTEX_PASS ret;
ret.pos = bp[0].pos * dl.x + bp[1].pos * dl.y + bp[2].pos * dl.z;
return ret;
}