The tessellation control shader starts by defining the number of vertices in the patch using the layout directive:
layout( vertices=16 ) out;
It then simply sets the tessellation levels to the value of TessLevel. It passes the vertex position along, without any modification.
The tessellation evaluation shader starts by using a layout directive to indicate the type of tessellation to be used. As we are tessellating a 4 x 4 Bezier surface patch, quad tessellation makes the most sense.
The basisFunctions function evaluates the Bernstein polynomials and their derivatives for a given value of the t parameter. The results are returned in the b and db output parameters.
Within the main function, we start by assigning the tessellation ...