#TRIANGLE TESSELLATION PATCH#
Per-patch tessellation factors are described by the MTLQuadTessellationFactorsHalf structure for a quad patch or the MTLTriangleTessellationFactorsHalf structure for a triangle patch.Įach value in the structure provides a specific tessellation factor:ĮdgeTessellationFactor provides the tessellation factor for the edge of the patch where u=0 (edge 0).ĮdgeTessellationFactor provides the tessellation factor for the edge of the patch where v=0 (edge 1).ĮdgeTessellationFactor provides the tessellation factor for the edge of the patch where u=1 (edge 2).ĮdgeTessellationFactor provides the tessellation factor for the edge of the patch where v=1 (edge 3). Per-patch tessellation factors specify how much each patch is subdivided by the tessellator. After the post-tessellation vertex function has completed execution, the tessellated primitives are rasterized and the remaining stages of the render pipeline are executed as normal. The post-tessellation vertex function generates the final vertex data for the tessellated triangles. The patch control point data (optionally output by the compute kernel).Īny other vertex function inputs, such as textures and buffers. The per-patch user data (optionally output by the compute kernel). The normalized vertex coordinates on the patch (output by the tessellator). The inputs to the post-tessellation vertex function are: The post-tessellation vertex function is a vertex function that calculates the vertex data for each patch surface sample produced by the tessellator. (Note that subdivision is performed in an implementation-dependent manner.) Each triangle vertex produced by the tessellator has an associated (u, v) or (u, v, w) position in normalized parameter space, with each parameter value ranging from 0.0 to 1.0. These triangles are produced by subdividing the patch according to the per-patch tessellation factors provided. The tessellator runs once per patch, consuming the input patch and producing a new set of triangles. The inputs to the tessellator are the per-patch tessellation factors. The tessellator is configured as part of your render pipeline, using a MTLRenderPipelineDescriptor object to build a MTLRenderPipelineState object. The tessellator tiles a canonical domain in a normalized coordinate system, ranging from 0.0 to 1.0. The tessellator is a fixed-function pipeline stage that creates a sampling pattern of the patch surface and generates graphics primitives that connect these samples. You can compute this data every n frames, offline, or by any other runtime means, as long as you supply the required data to the tessellator and post-tessellation vertex function when needed. Note: The compute kernel does not need to be executed every frame to compute the per-patch tessellation factors, per-patch user data, or patch control point data. Optionally, computes or modifies patch control point data. Optionally, computes per-patch user data. The compute kernel is a kernel function that performs the following operations: Per-patch tessellation factors, per-patch user data, and patch control point data are each stored in separate MTLBuffer objects. Tessellation operates on patches, with each patch representing an arbitrary arrangement of geometry defined by a collection of control points. Figure 12-1 The Metal tessellation pipeline To approximate the high-order surface, the GPU uses per-patch tessellation factors to subdivide each patch into triangles Metal Tessellation Pipelineįigure 12-1 shows the Metal tessellation pipeline, which uses a compute kernel, tessellator, and post-tessellation vertex function. Tessellation is used to calculate a more detailed surface from an initial surface constructed with quad or triangle patches made up of control points. Available in: iOS_GPUFamil圓_v2, OSX_GPUFamily1_v2