1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[tessellation]] 6e5c31af7Sopenharmony_ci= Tessellation 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciTessellation involves three pipeline stages. 9e5c31af7Sopenharmony_ciFirst, a <<shaders-tessellation-control,tessellation control shader>> 10e5c31af7Sopenharmony_citransforms control points of a patch and can: produce per-patch data. 11e5c31af7Sopenharmony_ciSecond, a fixed-function tessellator generates multiple primitives 12e5c31af7Sopenharmony_cicorresponding to a tessellation of the patch in (u,v) or (u,v,w) parameter 13e5c31af7Sopenharmony_cispace. 14e5c31af7Sopenharmony_ciThird, a <<shaders-tessellation-evaluation,tessellation evaluation shader>> 15e5c31af7Sopenharmony_citransforms the vertices of the tessellated patch, for example to compute 16e5c31af7Sopenharmony_citheir positions and attributes as part of the tessellated surface. 17e5c31af7Sopenharmony_ciThe tessellator is enabled when the pipeline contains both a tessellation 18e5c31af7Sopenharmony_cicontrol shader and a tessellation evaluation shader. 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ci 21e5c31af7Sopenharmony_ci== Tessellator 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ciIf a pipeline includes both tessellation shaders (control and evaluation), 24e5c31af7Sopenharmony_cithe tessellator consumes each input patch (after vertex shading) and 25e5c31af7Sopenharmony_ciproduces a new set of independent primitives (points, lines, or triangles). 26e5c31af7Sopenharmony_ciThese primitives are logically produced by subdividing a geometric primitive 27e5c31af7Sopenharmony_ci(rectangle or triangle) according to the per-patch outer and inner 28e5c31af7Sopenharmony_citessellation levels written by the tessellation control shader. 29e5c31af7Sopenharmony_ciThese levels are specified using the <<interfaces-builtin-variables,built-in 30e5c31af7Sopenharmony_civariables>> code:TessLevelOuter and code:TessLevelInner, respectively. 31e5c31af7Sopenharmony_ciThis subdivision is performed in an implementation-dependent manner. 32e5c31af7Sopenharmony_ciIf no tessellation shaders are present in the pipeline, the tessellator is 33e5c31af7Sopenharmony_cidisabled and incoming primitives are passed through without modification. 34e5c31af7Sopenharmony_ci 35e5c31af7Sopenharmony_ciThe type of subdivision performed by the tessellator is specified by an 36e5c31af7Sopenharmony_cicode:OpExecutionMode instruction using one of the code:Triangles, 37e5c31af7Sopenharmony_cicode:Quads, or code:IsoLines execution modes. 38e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 39e5c31af7Sopenharmony_ciWhen using <<shaders-objects, shader objects>>, this instruction must: be 40e5c31af7Sopenharmony_cispecified in the tessellation evaluation shader, and may: also be specified 41e5c31af7Sopenharmony_ciin the tessellation control shader. 42e5c31af7Sopenharmony_ciWhen using pipelines, this 43e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 44e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[This] 45e5c31af7Sopenharmony_ciinstruction may: be specified in either the tessellation evaluation or 46e5c31af7Sopenharmony_citessellation control shader. 47e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 48e5c31af7Sopenharmony_ciWhen using shader objects, tessellation-related modes that are required: 49e5c31af7Sopenharmony_cimust: be specified in the tessellation evaluation shader, and may: also be 50e5c31af7Sopenharmony_cispecified in the tessellation control shader. 51e5c31af7Sopenharmony_ciOther tessellation-related modes may: be specified in the tessellation 52e5c31af7Sopenharmony_cievaluation shader. 53e5c31af7Sopenharmony_ciWhen using pipelines, other 54e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 55e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[Other] 56e5c31af7Sopenharmony_citessellation-related execution modes can: also be specified in either the 57e5c31af7Sopenharmony_citessellation control or tessellation evaluation shaders. 58e5c31af7Sopenharmony_ci 59e5c31af7Sopenharmony_ciAny tessellation-related modes specified in both the tessellation control 60e5c31af7Sopenharmony_ciand tessellation evaluation shaders must: be the same. 61e5c31af7Sopenharmony_ci 62e5c31af7Sopenharmony_ciTessellation execution modes include: 63e5c31af7Sopenharmony_ci 64e5c31af7Sopenharmony_ci * code:Triangles, code:Quads, and code:IsoLines. 65e5c31af7Sopenharmony_ci These control the type of subdivision and topology of the output 66e5c31af7Sopenharmony_ci primitives. 67e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 68e5c31af7Sopenharmony_ci When using <<shaders-objects, shader objects>>, one mode must: be set in 69e5c31af7Sopenharmony_ci at least the tessellation evaluation stage. 70e5c31af7Sopenharmony_ci When using pipelines, one 71e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 72e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[One] 73e5c31af7Sopenharmony_ci mode must: be set in at least one of the tessellation shader stages. 74e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 75e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 76e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationIsolines 77e5c31af7Sopenharmony_ci is ename:VK_FALSE, then isoline tessellation is not supported by the 78e5c31af7Sopenharmony_ci implementation, and code:IsoLines must: not be used in either 79e5c31af7Sopenharmony_ci tessellation shader stage. 80e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 81e5c31af7Sopenharmony_ci * code:VertexOrderCw and code:VertexOrderCcw. 82e5c31af7Sopenharmony_ci These control the orientation of triangles generated by the tessellator. 83e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 84e5c31af7Sopenharmony_ci When using <<shaders-objects, shader objects>>, one mode must: be set in 85e5c31af7Sopenharmony_ci at least the tessellation evaluation stage. 86e5c31af7Sopenharmony_ci When using pipelines, one 87e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 88e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[One] 89e5c31af7Sopenharmony_ci mode must: be set in at least one of the tessellation shader stages. 90e5c31af7Sopenharmony_ci * code:PointMode. 91e5c31af7Sopenharmony_ci Controls generation of points rather than triangles or lines. 92e5c31af7Sopenharmony_ci This functionality defaults to disabled, and is enabled if either shader 93e5c31af7Sopenharmony_ci stage includes the execution mode. 94e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 95e5c31af7Sopenharmony_ci When using <<shaders-objects, shader objects>>, if code:PointMode is set 96e5c31af7Sopenharmony_ci in the tessellation control stage, it must: be identically set in the 97e5c31af7Sopenharmony_ci tessellation evaluation stage. 98e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 99e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 100e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 101e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationPointMode 102e5c31af7Sopenharmony_ci is ename:VK_FALSE, then point mode tessellation is not supported by the 103e5c31af7Sopenharmony_ci implementation, and code:PointMode must: not be used in either 104e5c31af7Sopenharmony_ci tessellation shader stage. 105e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 106e5c31af7Sopenharmony_ci * code:SpacingEqual, code:SpacingFractionalEven, and 107e5c31af7Sopenharmony_ci code:SpacingFractionalOdd. 108e5c31af7Sopenharmony_ci Controls the spacing of segments on the edges of tessellated primitives. 109e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 110e5c31af7Sopenharmony_ci When using <<shaders-objects, shader objects>>, one mode must: be set in 111e5c31af7Sopenharmony_ci at least the tessellation evaluation stage. 112e5c31af7Sopenharmony_ci When using pipelines, one 113e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 114e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[One] 115e5c31af7Sopenharmony_ci mode must: be set in at least one of the tessellation shader stages. 116e5c31af7Sopenharmony_ci * code:OutputVertices. 117e5c31af7Sopenharmony_ci Controls the size of the output patch of the tessellation control 118e5c31af7Sopenharmony_ci shader. 119e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 120e5c31af7Sopenharmony_ci When using <<shaders-objects, shader objects>>, one value must: be set 121e5c31af7Sopenharmony_ci in at least the tessellation control stage. 122e5c31af7Sopenharmony_ci When using pipelines, one 123e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 124e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[One] 125e5c31af7Sopenharmony_ci value must: be set in at least one of the tessellation shader stages. 126e5c31af7Sopenharmony_ci 127e5c31af7Sopenharmony_ciFor triangles, the tessellator subdivides a triangle primitive into smaller 128e5c31af7Sopenharmony_citriangles. 129e5c31af7Sopenharmony_ciFor quads, the tessellator subdivides a rectangle primitive into smaller 130e5c31af7Sopenharmony_citriangles. 131e5c31af7Sopenharmony_ciFor isolines, the tessellator subdivides a rectangle primitive into a 132e5c31af7Sopenharmony_cicollection of line segments arranged in strips stretching across the 133e5c31af7Sopenharmony_cirectangle in the [eq]#u# dimension (i.e. the coordinates in code:TessCoord 134e5c31af7Sopenharmony_ciare of the form [eq]#(0,x)# through [eq]#(1,x)# for all tessellation 135e5c31af7Sopenharmony_cievaluation shader invocations that share a line). 136e5c31af7Sopenharmony_ci 137e5c31af7Sopenharmony_ciEach vertex produced by the tessellator has an associated (u,v,w) or (u,v) 138e5c31af7Sopenharmony_ciposition in a normalized parameter space, with parameter values in the range 139e5c31af7Sopenharmony_ci[eq]#[0,1]#, as illustrated 140e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 141e5c31af7Sopenharmony_ciin figures <<img-tessellation-topology-ul>> and 142e5c31af7Sopenharmony_ci<<img-tessellation-topology-ll>>. 143e5c31af7Sopenharmony_ciThe domain space can: have either an upper-left or lower-left origin, 144e5c31af7Sopenharmony_ciselected by the pname:domainOrigin member of 145e5c31af7Sopenharmony_cislink:VkPipelineTessellationDomainOriginStateCreateInfo. 146e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[] 147e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_maintenance2[] 148e5c31af7Sopenharmony_ciin figure <<img-tessellation-topology-ul>>. 149e5c31af7Sopenharmony_ciThe domain space has an upper-left origin. 150e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[] 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ci[[img-tessellation-topology-ul]] 153e5c31af7Sopenharmony_ciimage::{images}/tessparamUL.svg[align="center",title="Domain parameterization for tessellation primitive modes (upper-left origin)",opts="{imageopts}"] 154e5c31af7Sopenharmony_ci 155e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 156e5c31af7Sopenharmony_ci[[img-tessellation-topology-ll]] 157e5c31af7Sopenharmony_ciimage::{images}/tessparam.svg[align="center",title="Domain parameterization for tessellation primitive modes (lower-left origin)",opts="{imageopts}"] 158e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[] 159e5c31af7Sopenharmony_ci 160e5c31af7Sopenharmony_ci.Caption 161e5c31af7Sopenharmony_ci**** 162e5c31af7Sopenharmony_ciIn the domain parameterization diagrams, the coordinates illustrate the 163e5c31af7Sopenharmony_civalue of code:TessCoord at the corners of the domain. 164e5c31af7Sopenharmony_ciThe labels on the edges indicate the inner (IL0 and IL1) and outer (OL0 165e5c31af7Sopenharmony_cithrough OL3) tessellation level values used to control the number of 166e5c31af7Sopenharmony_cisubdivisions along each edge of the domain. 167e5c31af7Sopenharmony_ci**** 168e5c31af7Sopenharmony_ci 169e5c31af7Sopenharmony_ciFor triangles, the vertex's position is a barycentric coordinate 170e5c31af7Sopenharmony_ci[eq]#(u,v,w)#, where [eq]#u {plus} v {plus} w = 1.0#, and indicates the 171e5c31af7Sopenharmony_cirelative influence of the three vertices of the triangle on the position of 172e5c31af7Sopenharmony_cithe vertex. 173e5c31af7Sopenharmony_ciFor quads and isolines, the position is a [eq]#(u,v)# coordinate indicating 174e5c31af7Sopenharmony_cithe relative horizontal and vertical position of the vertex relative to the 175e5c31af7Sopenharmony_cisubdivided rectangle. 176e5c31af7Sopenharmony_ciThe subdivision process is explained in more detail in subsequent sections. 177e5c31af7Sopenharmony_ci 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ci== Tessellator Patch Discard 180e5c31af7Sopenharmony_ci 181e5c31af7Sopenharmony_ciA patch is discarded by the tessellator if any relevant outer tessellation 182e5c31af7Sopenharmony_cilevel is less than or equal to zero. 183e5c31af7Sopenharmony_ci 184e5c31af7Sopenharmony_ciPatches will also be discarded if any relevant outer tessellation level 185e5c31af7Sopenharmony_cicorresponds to a floating-point [eq]#NaN# (not a number) in implementations 186e5c31af7Sopenharmony_cisupporting [eq]#NaN#. 187e5c31af7Sopenharmony_ci 188e5c31af7Sopenharmony_ciNo new primitives are generated and the tessellation evaluation shader is 189e5c31af7Sopenharmony_cinot executed for patches that are discarded. 190e5c31af7Sopenharmony_ciFor code:Quads, all four outer levels are relevant. 191e5c31af7Sopenharmony_ciFor code:Triangles and code:IsoLines, only the first three or two outer 192e5c31af7Sopenharmony_cilevels, respectively, are relevant. 193e5c31af7Sopenharmony_ciNegative inner levels will not cause a patch to be discarded; they will be 194e5c31af7Sopenharmony_ciclamped as described below. 195e5c31af7Sopenharmony_ci 196e5c31af7Sopenharmony_ci 197e5c31af7Sopenharmony_ci[[tessellation-tessellator-spacing]] 198e5c31af7Sopenharmony_ci== Tessellator Spacing 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ciEach of the tessellation levels is used to determine the number and spacing 201e5c31af7Sopenharmony_ciof segments used to subdivide a corresponding edge. 202e5c31af7Sopenharmony_ciThe method used to derive the number and spacing of segments is specified by 203e5c31af7Sopenharmony_cian code:OpExecutionMode in the tessellation control or tessellation 204e5c31af7Sopenharmony_cievaluation shader using one of the identifiers code:SpacingEqual, 205e5c31af7Sopenharmony_cicode:SpacingFractionalEven, or code:SpacingFractionalOdd. 206e5c31af7Sopenharmony_ci 207e5c31af7Sopenharmony_ciIf code:SpacingEqual is used, the floating-point tessellation level is first 208e5c31af7Sopenharmony_ciclamped to [eq]#[1, pname:maxLevel]#, where [eq]#pname:maxLevel# is the 209e5c31af7Sopenharmony_ciimplementation-dependent maximum tessellation level 210e5c31af7Sopenharmony_ci(sname:VkPhysicalDeviceLimits::pname:maxTessellationGenerationLevel). 211e5c31af7Sopenharmony_ciThe result is rounded up to the nearest integer [eq]#n#, and the 212e5c31af7Sopenharmony_cicorresponding edge is divided into [eq]#n# segments of equal length in (u,v) 213e5c31af7Sopenharmony_cispace. 214e5c31af7Sopenharmony_ci 215e5c31af7Sopenharmony_ciIf code:SpacingFractionalEven is used, the tessellation level is first 216e5c31af7Sopenharmony_ciclamped to [eq]#[2, pname:maxLevel]# and then rounded up to the nearest even 217e5c31af7Sopenharmony_ciinteger [eq]#n#. 218e5c31af7Sopenharmony_ciIf code:SpacingFractionalOdd is used, the tessellation level is clamped to 219e5c31af7Sopenharmony_ci[eq]#[1, pname:maxLevel - 1]# and then rounded up to the nearest odd integer 220e5c31af7Sopenharmony_ci[eq]#n#. 221e5c31af7Sopenharmony_ciIf [eq]#n# is one, the edge will not be subdivided. 222e5c31af7Sopenharmony_ciOtherwise, the corresponding edge will be divided into [eq]#n - 2# segments 223e5c31af7Sopenharmony_ciof equal length, and two additional segments of equal length that are 224e5c31af7Sopenharmony_citypically shorter than the other segments. 225e5c31af7Sopenharmony_ciThe length of the two additional segments relative to the others will 226e5c31af7Sopenharmony_cidecrease monotonically with [eq]#n - f#, where [eq]#f# is the clamped 227e5c31af7Sopenharmony_cifloating-point tessellation level. 228e5c31af7Sopenharmony_ciWhen [eq]#n - f# is zero, the additional segments will have equal length to 229e5c31af7Sopenharmony_cithe other segments. 230e5c31af7Sopenharmony_ciAs [eq]#n - f# approaches 2.0, the relative length of the additional 231e5c31af7Sopenharmony_cisegments approaches zero. 232e5c31af7Sopenharmony_ciThe two additional segments must: be placed symmetrically on opposite sides 233e5c31af7Sopenharmony_ciof the subdivided edge. 234e5c31af7Sopenharmony_ciThe relative location of these two segments is implementation-dependent, but 235e5c31af7Sopenharmony_cimust: be identical for any pair of subdivided edges with identical values of 236e5c31af7Sopenharmony_ci[eq]#f#. 237e5c31af7Sopenharmony_ci 238e5c31af7Sopenharmony_ciWhen tessellating triangles or quads using <<tessellation-point-mode, point 239e5c31af7Sopenharmony_cimode>> with fractional odd spacing, the tessellator may: produce _interior 240e5c31af7Sopenharmony_civertices_ that are positioned on the edge of the patch if an inner 241e5c31af7Sopenharmony_citessellation level is less than or equal to one. 242e5c31af7Sopenharmony_ciSuch vertices are considered distinct from vertices produced by subdividing 243e5c31af7Sopenharmony_cithe outer edge of the patch, even if there are pairs of vertices with 244e5c31af7Sopenharmony_ciidentical coordinates. 245e5c31af7Sopenharmony_ci 246e5c31af7Sopenharmony_ci 247e5c31af7Sopenharmony_ci[[tessellation-primitive-order]] 248e5c31af7Sopenharmony_ci== Tessellation Primitive Ordering 249e5c31af7Sopenharmony_ci 250e5c31af7Sopenharmony_ciFew guarantees are provided for the relative ordering of primitives produced 251e5c31af7Sopenharmony_ciby tessellation, as they pertain to <<drawing-primitive-order, primitive 252e5c31af7Sopenharmony_ciorder>>. 253e5c31af7Sopenharmony_ci 254e5c31af7Sopenharmony_ci * The output primitives generated from each input primitive are passed to 255e5c31af7Sopenharmony_ci subsequent pipeline stages in an implementation-dependent order. 256e5c31af7Sopenharmony_ci * All output primitives generated from a given input primitive are passed 257e5c31af7Sopenharmony_ci to subsequent pipeline stages before any output primitives generated 258e5c31af7Sopenharmony_ci from subsequent input primitives. 259e5c31af7Sopenharmony_ci 260e5c31af7Sopenharmony_ci 261e5c31af7Sopenharmony_ci[[tessellation-vertex-winding-order]] 262e5c31af7Sopenharmony_ci== Tessellator Vertex Winding Order 263e5c31af7Sopenharmony_ci 264e5c31af7Sopenharmony_ciWhen the tessellator produces triangles (in the code:Triangles or code:Quads 265e5c31af7Sopenharmony_cimodes), the orientation of all triangles is specified with an 266e5c31af7Sopenharmony_cicode:OpExecutionMode of code:VertexOrderCw or code:VertexOrderCcw in the 267e5c31af7Sopenharmony_citessellation control or tessellation evaluation shaders. 268e5c31af7Sopenharmony_ciIf the order is code:VertexOrderCw, the vertices of all generated triangles 269e5c31af7Sopenharmony_ciwill have clockwise ordering in (u,v) or (u,v,w) space. 270e5c31af7Sopenharmony_ciIf the order is code:VertexOrderCcw, the vertices will have 271e5c31af7Sopenharmony_cicounter-clockwise ordering in that space. 272e5c31af7Sopenharmony_ci 273e5c31af7Sopenharmony_ciIf the tessellation domain has an upper-left origin, the vertices of a 274e5c31af7Sopenharmony_citriangle have counter-clockwise ordering if 275e5c31af7Sopenharmony_ci 276e5c31af7Sopenharmony_ci {empty}:: [eq]#a = u~0~ v~1~ - u~1~ v~0~ {plus} u~1~ v~2~ - u~2~ v~1~ 277e5c31af7Sopenharmony_ci {plus} u~2~ v~0~ - u~0~ v~2~# 278e5c31af7Sopenharmony_ci 279e5c31af7Sopenharmony_ciis negative, and clockwise ordering if [eq]#a# is positive. 280e5c31af7Sopenharmony_ci[eq]#u~i~# and [eq]#v~i~# are the [eq]#u# and [eq]#v# coordinates in 281e5c31af7Sopenharmony_cinormalized parameter space of the [eq]##i##th vertex of the triangle. 282e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 283e5c31af7Sopenharmony_ciIf the tessellation domain has a lower-left origin, the vertices of a 284e5c31af7Sopenharmony_citriangle have counter-clockwise ordering if [eq]#a# is positive, and 285e5c31af7Sopenharmony_ciclockwise ordering if [eq]#a# is negative. 286e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[] 287e5c31af7Sopenharmony_ci 288e5c31af7Sopenharmony_ci[NOTE] 289e5c31af7Sopenharmony_ci.Note 290e5c31af7Sopenharmony_ci==== 291e5c31af7Sopenharmony_ciThe value [eq]#a# is proportional (with a positive factor) to the signed 292e5c31af7Sopenharmony_ciarea of the triangle. 293e5c31af7Sopenharmony_ci 294e5c31af7Sopenharmony_ciIn code:Triangles mode, even though the vertex coordinates have a [eq]#w# 295e5c31af7Sopenharmony_civalue, it does not participate directly in the computation of [eq]#a#, being 296e5c31af7Sopenharmony_cian affine combination of [eq]#u# and [eq]#v#. 297e5c31af7Sopenharmony_ci==== 298e5c31af7Sopenharmony_ci 299e5c31af7Sopenharmony_ci 300e5c31af7Sopenharmony_ci[[tessellation-triangle-tessellation]] 301e5c31af7Sopenharmony_ci== Triangle Tessellation 302e5c31af7Sopenharmony_ci 303e5c31af7Sopenharmony_ciIf the tessellation primitive mode is code:Triangles, an equilateral 304e5c31af7Sopenharmony_citriangle is subdivided into a collection of triangles covering the area of 305e5c31af7Sopenharmony_cithe original triangle. 306e5c31af7Sopenharmony_ciFirst, the original triangle is subdivided into a collection of concentric 307e5c31af7Sopenharmony_ciequilateral triangles. 308e5c31af7Sopenharmony_ciThe edges of each of these triangles are subdivided, and the area between 309e5c31af7Sopenharmony_cieach triangle pair is filled by triangles produced by joining the vertices 310e5c31af7Sopenharmony_cion the subdivided edges. 311e5c31af7Sopenharmony_ciThe number of concentric triangles and the number of subdivisions along each 312e5c31af7Sopenharmony_citriangle except the outermost is derived from the first inner tessellation 313e5c31af7Sopenharmony_cilevel. 314e5c31af7Sopenharmony_ciThe edges of the outermost triangle are subdivided independently, using the 315e5c31af7Sopenharmony_cifirst, second, and third outer tessellation levels to control the number of 316e5c31af7Sopenharmony_cisubdivisions of the [eq]#u = 0# (left), [eq]#v = 0# (bottom), and [eq]#w = 317e5c31af7Sopenharmony_ci0# (right) edges, respectively. 318e5c31af7Sopenharmony_ciThe second inner tessellation level and the fourth outer tessellation level 319e5c31af7Sopenharmony_cihave no effect in this mode. 320e5c31af7Sopenharmony_ci 321e5c31af7Sopenharmony_ciIf the first inner tessellation level and all three outer tessellation 322e5c31af7Sopenharmony_cilevels are exactly one after clamping and rounding, only a single triangle 323e5c31af7Sopenharmony_ciwith [eq]#(u,v,w)# coordinates of [eq]#(0,0,1)#, [eq]#(1,0,0)#, and 324e5c31af7Sopenharmony_ci[eq]#(0,1,0)# is generated. 325e5c31af7Sopenharmony_ciIf the inner tessellation level is one and any of the outer tessellation 326e5c31af7Sopenharmony_cilevels is greater than one, the inner tessellation level is treated as 327e5c31af7Sopenharmony_cithough it were originally specified as [eq]#1 {plus} {epsilon}# and will 328e5c31af7Sopenharmony_ciresult in a two- or three-segment subdivision depending on the tessellation 329e5c31af7Sopenharmony_cispacing. 330e5c31af7Sopenharmony_ciWhen used with fractional odd spacing, the three-segment subdivision may: 331e5c31af7Sopenharmony_ciproduce _inner vertices_ positioned on the edge of the triangle. 332e5c31af7Sopenharmony_ci 333e5c31af7Sopenharmony_ciIf any tessellation level is greater than one, tessellation begins by 334e5c31af7Sopenharmony_ciproducing a set of concentric inner triangles and subdividing their edges. 335e5c31af7Sopenharmony_ciFirst, the three outer edges are temporarily subdivided using the clamped 336e5c31af7Sopenharmony_ciand rounded first inner tessellation level and the specified tessellation 337e5c31af7Sopenharmony_cispacing, generating [eq]#n# segments. 338e5c31af7Sopenharmony_ciFor the outermost inner triangle, the inner triangle is degenerate -- a 339e5c31af7Sopenharmony_cisingle point at the center of the triangle -- if [eq]#n# is two. 340e5c31af7Sopenharmony_ciOtherwise, for each corner of the outer triangle, an inner triangle corner 341e5c31af7Sopenharmony_ciis produced at the intersection of two lines extended perpendicular to the 342e5c31af7Sopenharmony_cicorner's two adjacent edges running through the vertex of the subdivided 343e5c31af7Sopenharmony_ciouter edge nearest that corner. 344e5c31af7Sopenharmony_ciIf [eq]#n# is three, the edges of the inner triangle are not subdivided and 345e5c31af7Sopenharmony_ciit is the final triangle in the set of concentric triangles. 346e5c31af7Sopenharmony_ciOtherwise, each edge of the inner triangle is divided into [eq]#n - 2# 347e5c31af7Sopenharmony_cisegments, with the [eq]#n - 1# vertices of this subdivision produced by 348e5c31af7Sopenharmony_ciintersecting the inner edge with lines perpendicular to the edge running 349e5c31af7Sopenharmony_cithrough the [eq]#n - 1# innermost vertices of the subdivision of the outer 350e5c31af7Sopenharmony_ciedge. 351e5c31af7Sopenharmony_ciOnce the outermost inner triangle is subdivided, the previous subdivision 352e5c31af7Sopenharmony_ciprocess repeats itself, using the generated triangle as an outer triangle. 353e5c31af7Sopenharmony_ciThis subdivision process is illustrated in <<img-innertri,Inner Triangle 354e5c31af7Sopenharmony_ciTessellation>>. 355e5c31af7Sopenharmony_ci 356e5c31af7Sopenharmony_ci[[img-innertri]] 357e5c31af7Sopenharmony_ciimage::{images}/innertri.svg[align="center",title="Inner Triangle Tessellation",opts="{imageopts}"] 358e5c31af7Sopenharmony_ci 359e5c31af7Sopenharmony_ci.Caption 360e5c31af7Sopenharmony_ci**** 361e5c31af7Sopenharmony_ciIn the <<img-innertri,Inner Triangle Tessellation>> diagram, inner 362e5c31af7Sopenharmony_citessellation levels of (a) four and (b) five are shown (not to scale). 363e5c31af7Sopenharmony_ciSolid black circles depict vertices along the edges of the concentric 364e5c31af7Sopenharmony_citriangles. 365e5c31af7Sopenharmony_ciThe edges of inner triangles are subdivided by intersecting the edge with 366e5c31af7Sopenharmony_cisegments perpendicular to the edge passing through each inner vertex of the 367e5c31af7Sopenharmony_cisubdivided outer edge. 368e5c31af7Sopenharmony_ciDotted lines depict edges connecting corresponding vertices on the inner and 369e5c31af7Sopenharmony_ciouter triangle edges. 370e5c31af7Sopenharmony_ci**** 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_ciOnce all the concentric triangles are produced and their edges are 373e5c31af7Sopenharmony_cisubdivided, the area between each pair of adjacent inner triangles is filled 374e5c31af7Sopenharmony_cicompletely with a set of non-overlapping triangles. 375e5c31af7Sopenharmony_ciIn this subdivision, two of the three vertices of each triangle are taken 376e5c31af7Sopenharmony_cifrom adjacent vertices on a subdivided edge of one triangle; the third is 377e5c31af7Sopenharmony_cione of the vertices on the corresponding edge of the other triangle. 378e5c31af7Sopenharmony_ciIf the innermost triangle is degenerate (i.e., a point), the triangle 379e5c31af7Sopenharmony_cicontaining it is subdivided into six triangles by connecting each of the six 380e5c31af7Sopenharmony_civertices on that triangle with the center point. 381e5c31af7Sopenharmony_ciIf the innermost triangle is not degenerate, that triangle is added to the 382e5c31af7Sopenharmony_ciset of generated triangles as-is. 383e5c31af7Sopenharmony_ci 384e5c31af7Sopenharmony_ciAfter the area corresponding to any inner triangles is filled, the 385e5c31af7Sopenharmony_citessellator generates triangles to cover the area between the outermost 386e5c31af7Sopenharmony_citriangle and the outermost inner triangle. 387e5c31af7Sopenharmony_ciTo do this, the temporary subdivision of the outer triangle edge above is 388e5c31af7Sopenharmony_cidiscarded. 389e5c31af7Sopenharmony_ciInstead, the [eq]#u = 0#, [eq]#v = 0#, and [eq]#w = 0# edges are subdivided 390e5c31af7Sopenharmony_ciaccording to the first, second, and third outer tessellation levels, 391e5c31af7Sopenharmony_cirespectively, and the tessellation spacing. 392e5c31af7Sopenharmony_ciThe original subdivision of the first inner triangle is retained. 393e5c31af7Sopenharmony_ciThe area between the outer and first inner triangles is completely filled by 394e5c31af7Sopenharmony_cinon-overlapping triangles as described above. 395e5c31af7Sopenharmony_ciIf the first (and only) inner triangle is degenerate, a set of triangles is 396e5c31af7Sopenharmony_ciproduced by connecting each vertex on the outer triangle edges with the 397e5c31af7Sopenharmony_cicenter point. 398e5c31af7Sopenharmony_ci 399e5c31af7Sopenharmony_ciAfter all triangles are generated, each vertex in the subdivided triangle is 400e5c31af7Sopenharmony_ciassigned a barycentric (u,v,w) coordinate based on its location relative to 401e5c31af7Sopenharmony_cithe three vertices of the outer triangle. 402e5c31af7Sopenharmony_ci 403e5c31af7Sopenharmony_ciThe algorithm used to subdivide the triangular domain in (u,v,w) space into 404e5c31af7Sopenharmony_ciindividual triangles is implementation-dependent. 405e5c31af7Sopenharmony_ciHowever, the set of triangles produced will completely cover the domain, and 406e5c31af7Sopenharmony_cino portion of the domain will be covered by multiple triangles. 407e5c31af7Sopenharmony_ci 408e5c31af7Sopenharmony_ciOutput triangles are generated with a topology similar to 409e5c31af7Sopenharmony_ci<<drawing-triangle-lists, triangle lists>>, except that the order in which 410e5c31af7Sopenharmony_cieach triangle is generated, and the order in which the vertices are 411e5c31af7Sopenharmony_cigenerated for each triangle, are implementation-dependent. 412e5c31af7Sopenharmony_ciHowever, the order of vertices in each triangle is consistent across the 413e5c31af7Sopenharmony_cidomain as described in <<tessellation-vertex-winding-order>>. 414e5c31af7Sopenharmony_ci 415e5c31af7Sopenharmony_ci 416e5c31af7Sopenharmony_ci[[tessellation-quad-tessellation]] 417e5c31af7Sopenharmony_ci== Quad Tessellation 418e5c31af7Sopenharmony_ci 419e5c31af7Sopenharmony_ciIf the tessellation primitive mode is code:Quads, a rectangle is subdivided 420e5c31af7Sopenharmony_ciinto a collection of triangles covering the area of the original rectangle. 421e5c31af7Sopenharmony_ciFirst, the original rectangle is subdivided into a regular mesh of 422e5c31af7Sopenharmony_cirectangles, where the number of rectangles along the [eq]#u = 0# and [eq]#u 423e5c31af7Sopenharmony_ci= 1# (vertical) and [eq]#v = 0# and [eq]#v = 1# (horizontal) edges are 424e5c31af7Sopenharmony_ciderived from the first and second inner tessellation levels, respectively. 425e5c31af7Sopenharmony_ciAll rectangles, except those adjacent to one of the outer rectangle edges, 426e5c31af7Sopenharmony_ciare decomposed into triangle pairs. 427e5c31af7Sopenharmony_ciThe outermost rectangle edges are subdivided independently, using the first, 428e5c31af7Sopenharmony_cisecond, third, and fourth outer tessellation levels to control the number of 429e5c31af7Sopenharmony_cisubdivisions of the [eq]#u = 0# (left), [eq]#v = 0# (bottom), [eq]#u = 1# 430e5c31af7Sopenharmony_ci(right), and [eq]#v = 1# (top) edges, respectively. 431e5c31af7Sopenharmony_ciThe area between the inner rectangles of the mesh and the outer rectangle 432e5c31af7Sopenharmony_ciedges are filled by triangles produced by joining the vertices on the 433e5c31af7Sopenharmony_cisubdivided outer edges to the vertices on the edge of the inner rectangle 434e5c31af7Sopenharmony_cimesh. 435e5c31af7Sopenharmony_ci 436e5c31af7Sopenharmony_ciIf both clamped inner tessellation levels and all four clamped outer 437e5c31af7Sopenharmony_citessellation levels are exactly one, only a single triangle pair covering 438e5c31af7Sopenharmony_cithe outer rectangle is generated. 439e5c31af7Sopenharmony_ciOtherwise, if either clamped inner tessellation level is one, that 440e5c31af7Sopenharmony_citessellation level is treated as though it was originally specified as 441e5c31af7Sopenharmony_ci[eq]#1 {plus} {epsilon}# and will result in a two- or three-segment 442e5c31af7Sopenharmony_cisubdivision depending on the tessellation spacing. 443e5c31af7Sopenharmony_ciWhen used with fractional odd spacing, the three-segment subdivision may: 444e5c31af7Sopenharmony_ciproduce _inner vertices_ positioned on the edge of the rectangle. 445e5c31af7Sopenharmony_ci 446e5c31af7Sopenharmony_ciIf any tessellation level is greater than one, tessellation begins by 447e5c31af7Sopenharmony_cisubdividing the [eq]#u = 0# and [eq]#u = 1# edges of the outer rectangle 448e5c31af7Sopenharmony_ciinto [eq]#m# segments using the clamped and rounded first inner tessellation 449e5c31af7Sopenharmony_cilevel and the tessellation spacing. 450e5c31af7Sopenharmony_ciThe [eq]#v = 0# and [eq]#v = 1# edges are subdivided into [eq]#n# segments 451e5c31af7Sopenharmony_ciusing the second inner tessellation level. 452e5c31af7Sopenharmony_ciEach vertex on the [eq]#u = 0# and [eq]#v = 0# edges are joined with the 453e5c31af7Sopenharmony_cicorresponding vertex on the [eq]#u = 1# and [eq]#v = 1# edges to produce a 454e5c31af7Sopenharmony_ciset of vertical and horizontal lines that divide the rectangle into a grid 455e5c31af7Sopenharmony_ciof smaller rectangles. 456e5c31af7Sopenharmony_ciThe primitive generator emits a pair of non-overlapping triangles covering 457e5c31af7Sopenharmony_cieach such rectangle not adjacent to an edge of the outer rectangle. 458e5c31af7Sopenharmony_ciThe boundary of the region covered by these triangles forms an inner 459e5c31af7Sopenharmony_cirectangle, the edges of which are subdivided by the grid vertices that lie 460e5c31af7Sopenharmony_cion the edge. 461e5c31af7Sopenharmony_ciIf either [eq]#m# or [eq]#n# is two, the inner rectangle is degenerate, and 462e5c31af7Sopenharmony_cione or both of the rectangle's _edges_ consist of a single point. 463e5c31af7Sopenharmony_ciThis subdivision is illustrated in Figure <<img-innerquad,Inner Quad 464e5c31af7Sopenharmony_ciTessellation>>. 465e5c31af7Sopenharmony_ci 466e5c31af7Sopenharmony_ci[[img-innerquad]] 467e5c31af7Sopenharmony_ciimage::{images}/innerquad.svg[align="center",title="Inner Quad Tessellation",opts="{imageopts}"] 468e5c31af7Sopenharmony_ci 469e5c31af7Sopenharmony_ci.Caption 470e5c31af7Sopenharmony_ci**** 471e5c31af7Sopenharmony_ciIn the <<img-innerquad,Inner Quad Tessellation>> diagram, inner quad 472e5c31af7Sopenharmony_citessellation levels of (a) [eq]#(4,2)# and (b) [eq]#(7,4)# are shown. 473e5c31af7Sopenharmony_ciThe regions highlighted in red in figure (b) depict the 10 inner rectangles, 474e5c31af7Sopenharmony_cieach of which will be subdivided into two triangles. 475e5c31af7Sopenharmony_ciSolid black circles depict vertices on the boundary of the outer and inner 476e5c31af7Sopenharmony_cirectangles, where the inner rectangle of figure (a) is degenerate (a single 477e5c31af7Sopenharmony_ciline segment). 478e5c31af7Sopenharmony_ciDotted lines depict the horizontal and vertical edges connecting 479e5c31af7Sopenharmony_cicorresponding vertices on the inner and outer rectangle edges. 480e5c31af7Sopenharmony_ci**** 481e5c31af7Sopenharmony_ci 482e5c31af7Sopenharmony_ciAfter the area corresponding to the inner rectangle is filled, the 483e5c31af7Sopenharmony_citessellator must: produce triangles to cover the area between the inner and 484e5c31af7Sopenharmony_ciouter rectangles. 485e5c31af7Sopenharmony_ciTo do this, the subdivision of the outer rectangle edge above is discarded. 486e5c31af7Sopenharmony_ciInstead, the [eq]#u = 0#, [eq]#v = 0#, [eq]#u = 1#, and [eq]#v = 1# edges 487e5c31af7Sopenharmony_ciare subdivided according to the first, second, third, and fourth outer 488e5c31af7Sopenharmony_citessellation levels, respectively, and the tessellation spacing. 489e5c31af7Sopenharmony_ciThe original subdivision of the inner rectangle is retained. 490e5c31af7Sopenharmony_ciThe area between the outer and inner rectangles is completely filled by 491e5c31af7Sopenharmony_cinon-overlapping triangles. 492e5c31af7Sopenharmony_ciTwo of the three vertices of each triangle are adjacent vertices on a 493e5c31af7Sopenharmony_cisubdivided edge of one rectangle; the third is one of the vertices on the 494e5c31af7Sopenharmony_cicorresponding edge of the other rectangle. 495e5c31af7Sopenharmony_ciIf either edge of the innermost rectangle is degenerate, the area near the 496e5c31af7Sopenharmony_cicorresponding outer edges is filled by connecting each vertex on the outer 497e5c31af7Sopenharmony_ciedge with the single vertex making up the _inner edge_. 498e5c31af7Sopenharmony_ci 499e5c31af7Sopenharmony_ciThe algorithm used to subdivide the rectangular domain in (u,v) space into 500e5c31af7Sopenharmony_ciindividual triangles is implementation-dependent. 501e5c31af7Sopenharmony_ciHowever, the set of triangles produced will completely cover the domain, and 502e5c31af7Sopenharmony_cino portion of the domain will be covered by multiple triangles. 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ciOutput triangles are generated with a topology similar to 505e5c31af7Sopenharmony_ci<<drawing-triangle-lists, triangle lists>>, except that the order in which 506e5c31af7Sopenharmony_cieach triangle is generated, and the order in which the vertices are 507e5c31af7Sopenharmony_cigenerated for each triangle, are implementation-dependent. 508e5c31af7Sopenharmony_ciHowever, the order of vertices in each triangle is consistent across the 509e5c31af7Sopenharmony_cidomain as described in <<tessellation-vertex-winding-order>>. 510e5c31af7Sopenharmony_ci 511e5c31af7Sopenharmony_ci 512e5c31af7Sopenharmony_ci[[tessellation-isoline-tessellation]] 513e5c31af7Sopenharmony_ci== Isoline Tessellation 514e5c31af7Sopenharmony_ci 515e5c31af7Sopenharmony_ciIf the tessellation primitive mode is code:IsoLines, a set of independent 516e5c31af7Sopenharmony_cihorizontal line segments is drawn. 517e5c31af7Sopenharmony_ciThe segments are arranged into connected strips called _isolines_, where the 518e5c31af7Sopenharmony_civertices of each isoline have a constant v coordinate and u coordinates 519e5c31af7Sopenharmony_cicovering the full range [eq]#[0,1]#. 520e5c31af7Sopenharmony_ciThe number of isolines generated is derived from the first outer 521e5c31af7Sopenharmony_citessellation level; the number of segments in each isoline is derived from 522e5c31af7Sopenharmony_cithe second outer tessellation level. 523e5c31af7Sopenharmony_ciBoth inner tessellation levels and the third and fourth outer tessellation 524e5c31af7Sopenharmony_cilevels have no effect in this mode. 525e5c31af7Sopenharmony_ci 526e5c31af7Sopenharmony_ciAs with quad tessellation above, isoline tessellation begins with a 527e5c31af7Sopenharmony_cirectangle. 528e5c31af7Sopenharmony_ciThe [eq]#u = 0# and [eq]#u = 1# edges of the rectangle are subdivided 529e5c31af7Sopenharmony_ciaccording to the first outer tessellation level. 530e5c31af7Sopenharmony_ciFor the purposes of this subdivision, the tessellation spacing mode is 531e5c31af7Sopenharmony_ciignored and treated as equal_spacing. 532e5c31af7Sopenharmony_ciAn isoline is drawn connecting each vertex on the [eq]#u = 0# rectangle edge 533e5c31af7Sopenharmony_cito the corresponding vertex on the [eq]#u = 1# rectangle edge, except that 534e5c31af7Sopenharmony_cino line is drawn between [eq]#(0,1)# and [eq]#(1,1)#. 535e5c31af7Sopenharmony_ciIf the number of isolines on the subdivided [eq]#u = 0# and [eq]#u = 1# 536e5c31af7Sopenharmony_ciedges is [eq]#n#, this process will result in [eq]#n# equally spaced lines 537e5c31af7Sopenharmony_ciwith constant v coordinates of 0, latexmath:[\frac{1}{n}, \frac{2}{n}, 538e5c31af7Sopenharmony_ci\ldots, \frac{n-1}{n}]. 539e5c31af7Sopenharmony_ci 540e5c31af7Sopenharmony_ciEach of the [eq]#n# isolines is then subdivided according to the second 541e5c31af7Sopenharmony_ciouter tessellation level and the tessellation spacing, resulting in [eq]#m# 542e5c31af7Sopenharmony_ciline segments. 543e5c31af7Sopenharmony_ciEach segment of each line is emitted by the tessellator. 544e5c31af7Sopenharmony_ciThese line segments are generated with a topology similar to 545e5c31af7Sopenharmony_ci<<drawing-line-lists, line lists>>, except that the order in which each line 546e5c31af7Sopenharmony_ciis generated, and the order in which the vertices are generated for each 547e5c31af7Sopenharmony_ciline segment, are implementation-dependent. 548e5c31af7Sopenharmony_ci 549e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 550e5c31af7Sopenharmony_ci[NOTE] 551e5c31af7Sopenharmony_ci.Note 552e5c31af7Sopenharmony_ci==== 553e5c31af7Sopenharmony_ciIf the `apiext:VK_KHR_portability_subset` extension is enabled, and 554e5c31af7Sopenharmony_cislink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationIsolines 555e5c31af7Sopenharmony_ciis ename:VK_FALSE, then isoline tessellation is not supported by the 556e5c31af7Sopenharmony_ciimplementation. 557e5c31af7Sopenharmony_ci==== 558e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 559e5c31af7Sopenharmony_ci 560e5c31af7Sopenharmony_ci 561e5c31af7Sopenharmony_ci[[tessellation-point-mode]] 562e5c31af7Sopenharmony_ci== Tessellation Point Mode 563e5c31af7Sopenharmony_ci 564e5c31af7Sopenharmony_ciFor all primitive modes, the tessellator is capable of generating points 565e5c31af7Sopenharmony_ciinstead of lines or triangles. 566e5c31af7Sopenharmony_ciIf the tessellation control or tessellation evaluation shader specifies the 567e5c31af7Sopenharmony_cicode:OpExecutionMode code:PointMode, the primitive generator will generate 568e5c31af7Sopenharmony_cione point for each distinct vertex produced by tessellation, rather than 569e5c31af7Sopenharmony_ciemitting triangles or lines. 570e5c31af7Sopenharmony_ciOtherwise, the tessellator will produce a collection of line segments or 571e5c31af7Sopenharmony_citriangles according to the primitive mode. 572e5c31af7Sopenharmony_ciThese points are generated with a topology similar to <<drawing-point-lists, 573e5c31af7Sopenharmony_cipoint lists>>, except the order in which the points are generated for each 574e5c31af7Sopenharmony_ciinput primitive is undefined:. 575e5c31af7Sopenharmony_ci 576e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 577e5c31af7Sopenharmony_ci[NOTE] 578e5c31af7Sopenharmony_ci.Note 579e5c31af7Sopenharmony_ci==== 580e5c31af7Sopenharmony_ciIf the `apiext:VK_KHR_portability_subset` extension is enabled, and 581e5c31af7Sopenharmony_cislink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationPointMode 582e5c31af7Sopenharmony_ciis ename:VK_FALSE, then tessellation point mode is not supported by the 583e5c31af7Sopenharmony_ciimplementation. 584e5c31af7Sopenharmony_ci==== 585e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 586e5c31af7Sopenharmony_ci 587e5c31af7Sopenharmony_ci 588e5c31af7Sopenharmony_ci== Tessellation Pipeline State 589e5c31af7Sopenharmony_ci 590e5c31af7Sopenharmony_ciThe pname:pTessellationState member of slink:VkGraphicsPipelineCreateInfo is 591e5c31af7Sopenharmony_cia pointer to a sname:VkPipelineTessellationStateCreateInfo structure. 592e5c31af7Sopenharmony_ci 593e5c31af7Sopenharmony_ci[open,refpage='VkPipelineTessellationStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline tessellation state',type='structs'] 594e5c31af7Sopenharmony_ci-- 595e5c31af7Sopenharmony_ciThe sname:VkPipelineTessellationStateCreateInfo structure is defined as: 596e5c31af7Sopenharmony_ci 597e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineTessellationStateCreateInfo.adoc[] 598e5c31af7Sopenharmony_ci 599e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 600e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 601e5c31af7Sopenharmony_ci structure. 602e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 603e5c31af7Sopenharmony_ci * pname:patchControlPoints is the number of control points per patch. 604e5c31af7Sopenharmony_ci 605e5c31af7Sopenharmony_ci.Valid Usage 606e5c31af7Sopenharmony_ci**** 607e5c31af7Sopenharmony_ci * [[VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214]] 608e5c31af7Sopenharmony_ci pname:patchControlPoints must: be greater than zero and less than or 609e5c31af7Sopenharmony_ci equal to sname:VkPhysicalDeviceLimits::pname:maxTessellationPatchSize 610e5c31af7Sopenharmony_ci**** 611e5c31af7Sopenharmony_ci 612e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineTessellationStateCreateInfo.adoc[] 613e5c31af7Sopenharmony_ci-- 614e5c31af7Sopenharmony_ci 615e5c31af7Sopenharmony_ci[open,refpage='VkPipelineTessellationStateCreateFlags',desc='Reserved for future use',type='flags'] 616e5c31af7Sopenharmony_ci-- 617e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineTessellationStateCreateFlags.adoc[] 618e5c31af7Sopenharmony_ci 619e5c31af7Sopenharmony_citname:VkPipelineTessellationStateCreateFlags is a bitmask type for setting a 620e5c31af7Sopenharmony_cimask, but is currently reserved for future use. 621e5c31af7Sopenharmony_ci-- 622e5c31af7Sopenharmony_ci 623e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 624e5c31af7Sopenharmony_ci[open,refpage='VkPipelineTessellationDomainOriginStateCreateInfo',desc='Structure specifying the orientation of the tessellation domain',type='structs'] 625e5c31af7Sopenharmony_ci-- 626e5c31af7Sopenharmony_ciThe sname:VkPipelineTessellationDomainOriginStateCreateInfo structure is 627e5c31af7Sopenharmony_cidefined as: 628e5c31af7Sopenharmony_ci 629e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineTessellationDomainOriginStateCreateInfo.adoc[] 630e5c31af7Sopenharmony_ci 631e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance2[] 632e5c31af7Sopenharmony_cior the equivalent 633e5c31af7Sopenharmony_ci 634e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineTessellationDomainOriginStateCreateInfoKHR.adoc[] 635e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance2[] 636e5c31af7Sopenharmony_ci 637e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 638e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 639e5c31af7Sopenharmony_ci structure. 640e5c31af7Sopenharmony_ci * pname:domainOrigin is a elink:VkTessellationDomainOrigin value 641e5c31af7Sopenharmony_ci controlling the origin of the tessellation domain space. 642e5c31af7Sopenharmony_ci 643e5c31af7Sopenharmony_ciIf the sname:VkPipelineTessellationDomainOriginStateCreateInfo structure is 644e5c31af7Sopenharmony_ciincluded in the pname:pNext chain of 645e5c31af7Sopenharmony_cislink:VkPipelineTessellationStateCreateInfo, it controls the origin of the 646e5c31af7Sopenharmony_citessellation domain. 647e5c31af7Sopenharmony_ciIf this structure is not present, it is as if pname:domainOrigin was 648e5c31af7Sopenharmony_ciename:VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT. 649e5c31af7Sopenharmony_ci 650e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineTessellationDomainOriginStateCreateInfo.adoc[] 651e5c31af7Sopenharmony_ci-- 652e5c31af7Sopenharmony_ci 653e5c31af7Sopenharmony_ci[open,refpage='VkTessellationDomainOrigin',desc='Enum describing tessellation domain origin',type='enums'] 654e5c31af7Sopenharmony_ci-- 655e5c31af7Sopenharmony_ciThe possible tessellation domain origins are specified by the 656e5c31af7Sopenharmony_cielink:VkTessellationDomainOrigin enumeration: 657e5c31af7Sopenharmony_ci 658e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkTessellationDomainOrigin.adoc[] 659e5c31af7Sopenharmony_ci 660e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance2[] 661e5c31af7Sopenharmony_cior the equivalent 662e5c31af7Sopenharmony_ci 663e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkTessellationDomainOriginKHR.adoc[] 664e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance2[] 665e5c31af7Sopenharmony_ci 666e5c31af7Sopenharmony_ci * ename:VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT specifies that the origin 667e5c31af7Sopenharmony_ci of the domain space is in the upper left corner, as shown in figure 668e5c31af7Sopenharmony_ci <<img-tessellation-topology-ul>>. 669e5c31af7Sopenharmony_ci * ename:VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT specifies that the origin 670e5c31af7Sopenharmony_ci of the domain space is in the lower left corner, as shown in figure 671e5c31af7Sopenharmony_ci <<img-tessellation-topology-ll>>. 672e5c31af7Sopenharmony_ci 673e5c31af7Sopenharmony_ciThis enum affects how the code:VertexOrderCw and code:VertexOrderCcw 674e5c31af7Sopenharmony_citessellation execution modes are interpreted, since the winding is defined 675e5c31af7Sopenharmony_cirelative to the orientation of the domain. 676e5c31af7Sopenharmony_ci-- 677e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[] 678e5c31af7Sopenharmony_ci 679e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 680e5c31af7Sopenharmony_ci 681e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetTessellationDomainOriginEXT',desc='Specify the origin of the tessellation domain space dynamically for a command buffer',type='protos'] 682e5c31af7Sopenharmony_ci-- 683e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the origin of the 684e5c31af7Sopenharmony_citessellation domain space, call: 685e5c31af7Sopenharmony_ci 686e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetTessellationDomainOriginEXT.adoc[] 687e5c31af7Sopenharmony_ci 688e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 689e5c31af7Sopenharmony_ci recorded. 690e5c31af7Sopenharmony_ci * pname:domainOrigin specifies the origin of the tessellation domain 691e5c31af7Sopenharmony_ci space. 692e5c31af7Sopenharmony_ci 693e5c31af7Sopenharmony_ciThis command sets the origin of the tessellation domain space for subsequent 694e5c31af7Sopenharmony_cidrawing commands 695e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 696e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 697e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 698e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 699e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 700e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 701e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT set in 702e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 703e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 704e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 705e5c31af7Sopenharmony_cislink:VkPipelineTessellationDomainOriginStateCreateInfo::pname:domainOrigin 706e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 707e5c31af7Sopenharmony_ci 708e5c31af7Sopenharmony_ci:refpage: vkCmdSetTessellationDomainOriginEXT 709e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3TessellationDomainOrigin 710e5c31af7Sopenharmony_ci 711e5c31af7Sopenharmony_ci.Valid Usage 712e5c31af7Sopenharmony_ci**** 713e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 714e5c31af7Sopenharmony_ci**** 715e5c31af7Sopenharmony_ci 716e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetTessellationDomainOriginEXT.adoc[] 717e5c31af7Sopenharmony_ci-- 718e5c31af7Sopenharmony_ci 719e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 720