1// Copyright 2015-2021 The Khronos Group, Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[tessellation]] 6= Tessellation 7 8Tessellation involves three pipeline stages. 9First, a <<shaders-tessellation-control,tessellation control shader>> 10transforms control points of a patch and can: produce per-patch data. 11Second, a fixed-function tessellator generates multiple primitives 12corresponding to a tessellation of the patch in (u,v) or (u,v,w) parameter 13space. 14Third, a <<shaders-tessellation-evaluation,tessellation evaluation shader>> 15transforms the vertices of the tessellated patch, for example to compute 16their positions and attributes as part of the tessellated surface. 17The tessellator is enabled when the pipeline contains both a tessellation 18control shader and a tessellation evaluation shader. 19 20 21== Tessellator 22 23If a pipeline includes both tessellation shaders (control and evaluation), 24the tessellator consumes each input patch (after vertex shading) and 25produces a new set of independent primitives (points, lines, or triangles). 26These primitives are logically produced by subdividing a geometric primitive 27(rectangle or triangle) according to the per-patch outer and inner 28tessellation levels written by the tessellation control shader. 29These levels are specified using the <<interfaces-builtin-variables,built-in 30variables>> code:TessLevelOuter and code:TessLevelInner, respectively. 31This subdivision is performed in an implementation-dependent manner. 32If no tessellation shaders are present in the pipeline, the tessellator is 33disabled and incoming primitives are passed through without modification. 34 35The type of subdivision performed by the tessellator is specified by an 36code:OpExecutionMode instruction in the tessellation evaluation or 37tessellation control shader using one of execution modes code:Triangles, 38code:Quads, and code:IsoLines. 39Other tessellation-related execution modes can: also be specified in either 40the tessellation control or tessellation evaluation shaders, and if they are 41specified in both then the modes must: be the same. 42 43Tessellation execution modes include: 44 45 * code:Triangles, code:Quads, and code:IsoLines. 46 These control the type of subdivision and topology of the output 47 primitives. 48 One mode must: be set in at least one of the tessellation shader stages. 49ifdef::VK_KHR_portability_subset[] 50 If the `apiext:VK_KHR_portability_subset` extension is enabled, and 51 slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationIsolines 52 is ename:VK_FALSE, then isoline tessellation is not supported by the 53 implementation, and code:IsoLines must: not be used in either 54 tessellation shader stage. 55endif::VK_KHR_portability_subset[] 56 * code:VertexOrderCw and code:VertexOrderCcw. 57 These control the orientation of triangles generated by the tessellator. 58 One mode must: be set in at least one of the tessellation shader stages. 59 * code:PointMode. 60 Controls generation of points rather than triangles or lines. 61 This functionality defaults to disabled, and is enabled if either shader 62 stage includes the execution mode. 63ifdef::VK_KHR_portability_subset[] 64 If the `apiext:VK_KHR_portability_subset` extension is enabled, and 65 slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationPointMode 66 is ename:VK_FALSE, then point mode tessellation is not supported by the 67 implementation, and code:PointMode must: not be used in either 68 tessellation shader stage. 69endif::VK_KHR_portability_subset[] 70 * code:SpacingEqual, code:SpacingFractionalEven, and 71 code:SpacingFractionalOdd. 72 Controls the spacing of segments on the edges of tessellated primitives. 73 One mode must: be set in at least one of the tessellation shader stages. 74 * code:OutputVertices. 75 Controls the size of the output patch of the tessellation control 76 shader. 77 One value must: be set in at least one of the tessellation shader 78 stages. 79 80For triangles, the tessellator subdivides a triangle primitive into smaller 81triangles. 82For quads, the tessellator subdivides a rectangle primitive into smaller 83triangles. 84For isolines, the tessellator subdivides a rectangle primitive into a 85collection of line segments arranged in strips stretching across the 86rectangle in the [eq]#u# dimension (i.e. the coordinates in code:TessCoord 87are of the form (0,x) through (1,x) for all tessellation evaluation shader 88invocations that share a line). 89 90Each vertex produced by the tessellator has an associated (u,v,w) or (u,v) 91position in a normalized parameter space, with parameter values in the range 92[eq]#[0,1]#, as illustrated 93ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 94in figures <<img-tessellation-topology-ul>> and 95<<img-tessellation-topology-ll>>. 96The domain space can: have either an upper-left or lower-left origin, 97selected by the pname:domainOrigin member of 98slink:VkPipelineTessellationDomainOriginStateCreateInfo. 99endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 100ifndef::VK_VERSION_1_1,VK_KHR_maintenance2[] 101in figure <<img-tessellation-topology-ul>>. 102The domain space has an upper-left origin. 103endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 104 105[[img-tessellation-topology-ul]] 106image::{images}/tessparamUL.svg[align="center",title="Domain parameterization for tessellation primitive modes (upper-left origin)",opts="{imageopts}"] 107 108ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 109[[img-tessellation-topology-ll]] 110image::{images}/tessparam.svg[align="center",title="Domain parameterization for tessellation primitive modes (lower-left origin)",opts="{imageopts}"] 111endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 112 113.Caption 114**** 115In the domain parameterization diagrams, the coordinates illustrate the 116value of code:TessCoord at the corners of the domain. 117The labels on the edges indicate the inner (IL0 and IL1) and outer (OL0 118through OL3) tessellation level values used to control the number of 119subdivisions along each edge of the domain. 120**** 121 122For triangles, the vertex's position is a barycentric coordinate 123[eq]#(u,v,w)#, where [eq]#u {plus} v {plus} w = 1.0#, and indicates the 124relative influence of the three vertices of the triangle on the position of 125the vertex. 126For quads and isolines, the position is a [eq]#(u,v)# coordinate indicating 127the relative horizontal and vertical position of the vertex relative to the 128subdivided rectangle. 129The subdivision process is explained in more detail in subsequent sections. 130 131 132== Tessellator Patch Discard 133 134A patch is discarded by the tessellator if any relevant outer tessellation 135level is less than or equal to zero. 136 137Patches will also be discarded if any relevant outer tessellation level 138corresponds to a floating-point [eq]#NaN# (not a number) in implementations 139supporting [eq]#NaN#. 140 141No new primitives are generated and the tessellation evaluation shader is 142not executed for patches that are discarded. 143For code:Quads, all four outer levels are relevant. 144For code:Triangles and code:IsoLines, only the first three or two outer 145levels, respectively, are relevant. 146Negative inner levels will not cause a patch to be discarded; they will be 147clamped as described below. 148 149 150[[tessellation-tessellator-spacing]] 151== Tessellator Spacing 152 153Each of the tessellation levels is used to determine the number and spacing 154of segments used to subdivide a corresponding edge. 155The method used to derive the number and spacing of segments is specified by 156an code:OpExecutionMode in the tessellation control or tessellation 157evaluation shader using one of the identifiers code:SpacingEqual, 158code:SpacingFractionalEven, or code:SpacingFractionalOdd. 159 160If code:SpacingEqual is used, the floating-point tessellation level is first 161clamped to [eq]#[1, pname:maxLevel]#, where [eq]#pname:maxLevel# is the 162implementation-dependent maximum tessellation level 163(sname:VkPhysicalDeviceLimits::pname:maxTessellationGenerationLevel). 164The result is rounded up to the nearest integer [eq]#n#, and the 165corresponding edge is divided into [eq]#n# segments of equal length in (u,v) 166space. 167 168If code:SpacingFractionalEven is used, the tessellation level is first 169clamped to [eq]#[2, pname:maxLevel]# and then rounded up to the nearest even 170integer [eq]#n#. 171If code:SpacingFractionalOdd is used, the tessellation level is clamped to 172[eq]#[1, pname:maxLevel - 1]# and then rounded up to the nearest odd integer 173[eq]#n#. 174If [eq]#n# is one, the edge will not be subdivided. 175Otherwise, the corresponding edge will be divided into [eq]#n - 2# segments 176of equal length, and two additional segments of equal length that are 177typically shorter than the other segments. 178The length of the two additional segments relative to the others will 179decrease monotonically with [eq]#n - f#, where [eq]#f# is the clamped 180floating-point tessellation level. 181When [eq]#n - f# is zero, the additional segments will have equal length to 182the other segments. 183As [eq]#n - f# approaches 2.0, the relative length of the additional 184segments approaches zero. 185The two additional segments must: be placed symmetrically on opposite sides 186of the subdivided edge. 187The relative location of these two segments is implementation-dependent, but 188must: be identical for any pair of subdivided edges with identical values of 189[eq]#f#. 190 191When tessellating triangles or quads using <<tessellation-point-mode, point 192mode>> with fractional odd spacing, the tessellator may: produce _interior 193vertices_ that are positioned on the edge of the patch if an inner 194tessellation level is less than or equal to one. 195Such vertices are considered distinct from vertices produced by subdividing 196the outer edge of the patch, even if there are pairs of vertices with 197identical coordinates. 198 199 200[[tessellation-primitive-order]] 201== Tessellation Primitive Ordering 202 203Few guarantees are provided for the relative ordering of primitives produced 204by tessellation, as they pertain to <<drawing-primitive-order, primitive 205order>>. 206 207 * The output primitives generated from each input primitive are passed to 208 subsequent pipeline stages in an implementation-dependent order. 209 * All output primitives generated from a given input primitive are passed 210 to subsequent pipeline stages before any output primitives generated 211 from subsequent input primitives. 212 213 214[[tessellation-vertex-winding-order]] 215== Tessellator Vertex Winding Order 216 217When the tessellator produces triangles (in the code:Triangles or code:Quads 218modes), the orientation of all triangles is specified with an 219code:OpExecutionMode of code:VertexOrderCw or code:VertexOrderCcw in the 220tessellation control or tessellation evaluation shaders. 221If the order is code:VertexOrderCw, the vertices of all generated triangles 222will have clockwise ordering in (u,v) or (u,v,w) space. 223If the order is code:VertexOrderCcw, the vertices will have 224counter-clockwise ordering in that space. 225 226If the tessellation domain has an upper-left origin, the vertices of a 227triangle have counter-clockwise ordering if 228 229 {empty}:: [eq]#a = u~0~ v~1~ - u~1~ v~0~ {plus} u~1~ v~2~ - u~2~ v~1~ 230 {plus} u~2~ v~0~ - u~0~ v~2~# 231 232is negative, and clockwise ordering if [eq]#a# is positive. 233[eq]#u~i~# and [eq]#v~i~# are the [eq]#u# and [eq]#v# coordinates in 234normalized parameter space of the [eq]##i##th vertex of the triangle. 235ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 236If the tessellation domain has a lower-left origin, the vertices of a 237triangle have counter-clockwise ordering if [eq]#a# is positive, and 238clockwise ordering if [eq]#a# is negative. 239endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 240 241[NOTE] 242.Note 243==== 244The value [eq]#a# is proportional (with a positive factor) to the signed 245area of the triangle. 246 247In code:Triangles mode, even though the vertex coordinates have a [eq]#w# 248value, it does not participate directly in the computation of [eq]#a#, being 249an affine combination of [eq]#u# and [eq]#v#. 250==== 251 252 253[[tessellation-triangle-tessellation]] 254== Triangle Tessellation 255 256If the tessellation primitive mode is code:Triangles, an equilateral 257triangle is subdivided into a collection of triangles covering the area of 258the original triangle. 259First, the original triangle is subdivided into a collection of concentric 260equilateral triangles. 261The edges of each of these triangles are subdivided, and the area between 262each triangle pair is filled by triangles produced by joining the vertices 263on the subdivided edges. 264The number of concentric triangles and the number of subdivisions along each 265triangle except the outermost is derived from the first inner tessellation 266level. 267The edges of the outermost triangle are subdivided independently, using the 268first, second, and third outer tessellation levels to control the number of 269subdivisions of the [eq]#u = 0# (left), [eq]#v = 0# (bottom), and [eq]#w = 2700# (right) edges, respectively. 271The second inner tessellation level and the fourth outer tessellation level 272have no effect in this mode. 273 274If the first inner tessellation level and all three outer tessellation 275levels are exactly one after clamping and rounding, only a single triangle 276with [eq]#(u,v,w)# coordinates of [eq]#(0,0,1)#, [eq]#(1,0,0)#, and 277[eq]#(0,1,0)# is generated. 278If the inner tessellation level is one and any of the outer tessellation 279levels is greater than one, the inner tessellation level is treated as 280though it were originally specified as [eq]#1 {plus} {epsilon}# and will 281result in a two- or three-segment subdivision depending on the tessellation 282spacing. 283When used with fractional odd spacing, the three-segment subdivision may: 284produce _inner vertices_ positioned on the edge of the triangle. 285 286If any tessellation level is greater than one, tessellation begins by 287producing a set of concentric inner triangles and subdividing their edges. 288First, the three outer edges are temporarily subdivided using the clamped 289and rounded first inner tessellation level and the specified tessellation 290spacing, generating [eq]#n# segments. 291For the outermost inner triangle, the inner triangle is degenerate -- a 292single point at the center of the triangle -- if [eq]#n# is two. 293Otherwise, for each corner of the outer triangle, an inner triangle corner 294is produced at the intersection of two lines extended perpendicular to the 295corner's two adjacent edges running through the vertex of the subdivided 296outer edge nearest that corner. 297If [eq]#n# is three, the edges of the inner triangle are not subdivided and 298it is the final triangle in the set of concentric triangles. 299Otherwise, each edge of the inner triangle is divided into [eq]#n - 2# 300segments, with the [eq]#n - 1# vertices of this subdivision produced by 301intersecting the inner edge with lines perpendicular to the edge running 302through the [eq]#n - 1# innermost vertices of the subdivision of the outer 303edge. 304Once the outermost inner triangle is subdivided, the previous subdivision 305process repeats itself, using the generated triangle as an outer triangle. 306This subdivision process is illustrated in <<img-innertri,Inner Triangle 307Tessellation>>. 308 309[[img-innertri]] 310image::{images}/innertri.svg[align="center",title="Inner Triangle Tessellation",opts="{imageopts}"] 311 312.Caption 313**** 314In the <<img-innertri,Inner Triangle Tessellation>> diagram, inner 315tessellation levels of (a) five and (b) four are shown (not to scale). 316Solid black circles depict vertices along the edges of the concentric 317triangles. 318The edges of inner triangles are subdivided by intersecting the edge with 319segments perpendicular to the edge passing through each inner vertex of the 320subdivided outer edge. 321Dotted lines depict edges connecting corresponding vertices on the inner and 322outer triangle edges. 323**** 324 325Once all the concentric triangles are produced and their edges are 326subdivided, the area between each pair of adjacent inner triangles is filled 327completely with a set of non-overlapping triangles. 328In this subdivision, two of the three vertices of each triangle are taken 329from adjacent vertices on a subdivided edge of one triangle; the third is 330one of the vertices on the corresponding edge of the other triangle. 331If the innermost triangle is degenerate (i.e., a point), the triangle 332containing it is subdivided into six triangles by connecting each of the six 333vertices on that triangle with the center point. 334If the innermost triangle is not degenerate, that triangle is added to the 335set of generated triangles as-is. 336 337After the area corresponding to any inner triangles is filled, the 338tessellator generates triangles to cover the area between the outermost 339triangle and the outermost inner triangle. 340To do this, the temporary subdivision of the outer triangle edge above is 341discarded. 342Instead, the [eq]#u = 0#, [eq]#v = 0#, and [eq]#w = 0# edges are subdivided 343according to the first, second, and third outer tessellation levels, 344respectively, and the tessellation spacing. 345The original subdivision of the first inner triangle is retained. 346The area between the outer and first inner triangles is completely filled by 347non-overlapping triangles as described above. 348If the first (and only) inner triangle is degenerate, a set of triangles is 349produced by connecting each vertex on the outer triangle edges with the 350center point. 351 352After all triangles are generated, each vertex in the subdivided triangle is 353assigned a barycentric (u,v,w) coordinate based on its location relative to 354the three vertices of the outer triangle. 355 356The algorithm used to subdivide the triangular domain in (u,v,w) space into 357individual triangles is implementation-dependent. 358However, the set of triangles produced will completely cover the domain, and 359no portion of the domain will be covered by multiple triangles. 360 361Output triangles are generated with a topology similar to 362<<drawing-triangle-lists, triangle lists>>, except that the order in which 363each triangle is generated, and the order in which the vertices are 364generated for each triangle, are implementation-dependent. 365However, the order of vertices in each triangle is consistent across the 366domain as described in <<tessellation-vertex-winding-order>>. 367 368 369[[tessellation-quad-tessellation]] 370== Quad Tessellation 371 372If the tessellation primitive mode is code:Quads, a rectangle is subdivided 373into a collection of triangles covering the area of the original rectangle. 374First, the original rectangle is subdivided into a regular mesh of 375rectangles, where the number of rectangles along the [eq]#u = 0# and [eq]#u 376= 1# (vertical) and [eq]#v = 0# and [eq]#v = 1# (horizontal) edges are 377derived from the first and second inner tessellation levels, respectively. 378All rectangles, except those adjacent to one of the outer rectangle edges, 379are decomposed into triangle pairs. 380The outermost rectangle edges are subdivided independently, using the first, 381second, third, and fourth outer tessellation levels to control the number of 382subdivisions of the [eq]#u = 0# (left), [eq]#v = 0# (bottom), [eq]#u = 1# 383(right), and [eq]#v = 1# (top) edges, respectively. 384The area between the inner rectangles of the mesh and the outer rectangle 385edges are filled by triangles produced by joining the vertices on the 386subdivided outer edges to the vertices on the edge of the inner rectangle 387mesh. 388 389If both clamped inner tessellation levels and all four clamped outer 390tessellation levels are exactly one, only a single triangle pair covering 391the outer rectangle is generated. 392Otherwise, if either clamped inner tessellation level is one, that 393tessellation level is treated as though it was originally specified as 394[eq]#1 {plus} {epsilon}# and will result in a two- or three-segment 395subdivision depending on the tessellation spacing. 396When used with fractional odd spacing, the three-segment subdivision may: 397produce _inner vertices_ positioned on the edge of the rectangle. 398 399If any tessellation level is greater than one, tessellation begins by 400subdividing the [eq]#u = 0# and [eq]#u = 1# edges of the outer rectangle 401into [eq]#m# segments using the clamped and rounded first inner tessellation 402level and the tessellation spacing. 403The [eq]#v = 0# and [eq]#v = 1# edges are subdivided into [eq]#n# segments 404using the second inner tessellation level. 405Each vertex on the [eq]#u = 0# and [eq]#v = 0# edges are joined with the 406corresponding vertex on the [eq]#u = 1# and [eq]#v = 1# edges to produce a 407set of vertical and horizontal lines that divide the rectangle into a grid 408of smaller rectangles. 409The primitive generator emits a pair of non-overlapping triangles covering 410each such rectangle not adjacent to an edge of the outer rectangle. 411The boundary of the region covered by these triangles forms an inner 412rectangle, the edges of which are subdivided by the grid vertices that lie 413on the edge. 414If either [eq]#m# or [eq]#n# is two, the inner rectangle is degenerate, and 415one or both of the rectangle's _edges_ consist of a single point. 416This subdivision is illustrated in Figure <<img-innerquad,Inner Quad 417Tessellation>>. 418 419[[img-innerquad]] 420image::{images}/innerquad.svg[align="center",title="Inner Quad Tessellation",opts="{imageopts}"] 421 422.Caption 423**** 424In the <<img-innerquad,Inner Quad Tessellation>> diagram, inner quad 425tessellation levels of (a) [eq]#(4,2)# and (b) [eq]#(7,4)# are shown. 426The regions highlighted in red in figure (b) depict the 10 inner rectangles, 427each of which will be subdivided into two triangles. 428Solid black circles depict vertices on the boundary of the outer and inner 429rectangles, where the inner rectangle of figure (a) is degenerate (a single 430line segment). 431Dotted lines depict the horizontal and vertical edges connecting 432corresponding vertices on the inner and outer rectangle edges. 433**** 434 435After the area corresponding to the inner rectangle is filled, the 436tessellator must: produce triangles to cover the area between the inner and 437outer rectangles. 438To do this, the subdivision of the outer rectangle edge above is discarded. 439Instead, the [eq]#u = 0#, [eq]#v = 0#, [eq]#u = 1#, and [eq]#v = 1# edges 440are subdivided according to the first, second, third, and fourth outer 441tessellation levels, respectively, and the tessellation spacing. 442The original subdivision of the inner rectangle is retained. 443The area between the outer and inner rectangles is completely filled by 444non-overlapping triangles. 445Two of the three vertices of each triangle are adjacent vertices on a 446subdivided edge of one rectangle; the third is one of the vertices on the 447corresponding edge of the other rectangle. 448If either edge of the innermost rectangle is degenerate, the area near the 449corresponding outer edges is filled by connecting each vertex on the outer 450edge with the single vertex making up the _inner edge_. 451 452The algorithm used to subdivide the rectangular domain in (u,v) space into 453individual triangles is implementation-dependent. 454However, the set of triangles produced will completely cover the domain, and 455no portion of the domain will be covered by multiple triangles. 456 457Output triangles are generated with a topology similar to 458<<drawing-triangle-lists, triangle lists>>, except that the order in which 459each triangle is generated, and the order in which the vertices are 460generated for each triangle, are implementation-dependent. 461However, the order of vertices in each triangle is consistent across the 462domain as described in <<tessellation-vertex-winding-order>>. 463 464 465[[tessellation-isoline-tessellation]] 466== Isoline Tessellation 467 468If the tessellation primitive mode is code:IsoLines, a set of independent 469horizontal line segments is drawn. 470The segments are arranged into connected strips called _isolines_, where the 471vertices of each isoline have a constant v coordinate and u coordinates 472covering the full range [eq]#[0,1]#. 473The number of isolines generated is derived from the first outer 474tessellation level; the number of segments in each isoline is derived from 475the second outer tessellation level. 476Both inner tessellation levels and the third and fourth outer tessellation 477levels have no effect in this mode. 478 479As with quad tessellation above, isoline tessellation begins with a 480rectangle. 481The [eq]#u = 0# and [eq]#u = 1# edges of the rectangle are subdivided 482according to the first outer tessellation level. 483For the purposes of this subdivision, the tessellation spacing mode is 484ignored and treated as equal_spacing. 485An isoline is drawn connecting each vertex on the [eq]#u = 0# rectangle edge 486to the corresponding vertex on the [eq]#u = 1# rectangle edge, except that 487no line is drawn between (0,1) and (1,1). 488If the number of isolines on the subdivided [eq]#u = 0# and [eq]#u = 1# 489edges is [eq]#n#, this process will result in [eq]#n# equally spaced lines 490with constant v coordinates of 0, latexmath:[\frac{1}{n}, \frac{2}{n}, 491\ldots, \frac{n-1}{n}]. 492 493Each of the [eq]#n# isolines is then subdivided according to the second 494outer tessellation level and the tessellation spacing, resulting in [eq]#m# 495line segments. 496Each segment of each line is emitted by the tessellator. 497These line segments are generated with a topology similar to 498<<drawing-line-lists, line lists>>, except that the order in which each line 499is generated, and the order in which the vertices are generated for each 500line segment, are implementation-dependent. 501 502ifdef::VK_KHR_portability_subset[] 503[NOTE] 504.Note 505==== 506If the `apiext:VK_KHR_portability_subset` extension is enabled, and 507slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationIsolines 508is ename:VK_FALSE, then isoline tessellation is not supported by the 509implementation. 510==== 511endif::VK_KHR_portability_subset[] 512 513[[tessellation-point-mode]] 514== Tessellation Point Mode 515 516For all primitive modes, the tessellator is capable of generating points 517instead of lines or triangles. 518If the tessellation control or tessellation evaluation shader specifies the 519code:OpExecutionMode code:PointMode, the primitive generator will generate 520one point for each distinct vertex produced by tessellation, rather than 521emitting triangles or lines. 522Otherwise, the tessellator will produce a collection of line segments or 523triangles according to the primitive mode. 524These points are generated with a topology similar to <<drawing-point-lists, 525point lists>>, except the order in which the points are generated for each 526input primitive is undefined:. 527 528ifdef::VK_KHR_portability_subset[] 529[NOTE] 530.Note 531==== 532If the `apiext:VK_KHR_portability_subset` extension is enabled, and 533slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationPointMode 534is ename:VK_FALSE, then tessellation point mode is not supported by the 535implementation. 536==== 537endif::VK_KHR_portability_subset[] 538 539 540== Tessellation Pipeline State 541 542The pname:pTessellationState member of slink:VkGraphicsPipelineCreateInfo is 543a pointer to a sname:VkPipelineTessellationStateCreateInfo structure. 544 545[open,refpage='VkPipelineTessellationStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline tessellation state',type='structs'] 546-- 547The sname:VkPipelineTessellationStateCreateInfo structure is defined as: 548 549include::{generated}/api/structs/VkPipelineTessellationStateCreateInfo.txt[] 550 551 * pname:sType is the type of this structure. 552 * pname:pNext is `NULL` or a pointer to a structure extending this 553 structure. 554 * pname:flags is reserved for future use. 555 * pname:patchControlPoints is the number of control points per patch. 556 557.Valid Usage 558**** 559 * [[VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214]] 560 pname:patchControlPoints must: be greater than zero and less than or 561 equal to sname:VkPhysicalDeviceLimits::pname:maxTessellationPatchSize 562**** 563 564include::{generated}/validity/structs/VkPipelineTessellationStateCreateInfo.txt[] 565-- 566 567[open,refpage='VkPipelineTessellationStateCreateFlags',desc='Reserved for future use',type='flags'] 568-- 569include::{generated}/api/flags/VkPipelineTessellationStateCreateFlags.txt[] 570 571tname:VkPipelineTessellationStateCreateFlags is a bitmask type for setting a 572mask, but is currently reserved for future use. 573-- 574 575ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 576[open,refpage='VkPipelineTessellationDomainOriginStateCreateInfo',desc='Structure specifying the orientation of the tessellation domain',type='structs'] 577-- 578The sname:VkPipelineTessellationDomainOriginStateCreateInfo structure is 579defined as: 580 581include::{generated}/api/structs/VkPipelineTessellationDomainOriginStateCreateInfo.txt[] 582 583ifdef::VK_KHR_maintenance2[] 584or the equivalent 585 586include::{generated}/api/structs/VkPipelineTessellationDomainOriginStateCreateInfoKHR.txt[] 587endif::VK_KHR_maintenance2[] 588 589 * pname:sType is the type of this structure. 590 * pname:pNext is `NULL` or a pointer to a structure extending this 591 structure. 592 * pname:domainOrigin is a elink:VkTessellationDomainOrigin value 593 controlling the origin of the tessellation domain space. 594 595If the sname:VkPipelineTessellationDomainOriginStateCreateInfo structure is 596included in the pname:pNext chain of 597slink:VkPipelineTessellationStateCreateInfo, it controls the origin of the 598tessellation domain. 599If this structure is not present, it is as if pname:domainOrigin was 600ename:VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT. 601 602include::{generated}/validity/structs/VkPipelineTessellationDomainOriginStateCreateInfo.txt[] 603-- 604 605[open,refpage='VkTessellationDomainOrigin',desc='Enum describing tessellation domain origin',type='enums'] 606-- 607The possible tessellation domain origins are specified by the 608elink:VkTessellationDomainOrigin enumeration: 609 610include::{generated}/api/enums/VkTessellationDomainOrigin.txt[] 611 612ifdef::VK_KHR_maintenance2[] 613or the equivalent 614 615include::{generated}/api/enums/VkTessellationDomainOriginKHR.txt[] 616endif::VK_KHR_maintenance2[] 617 618 * ename:VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT specifies that the origin 619 of the domain space is in the upper left corner, as shown in figure 620 <<img-tessellation-topology-ul>>. 621 * ename:VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT specifies that the origin 622 of the domain space is in the lower left corner, as shown in figure 623 <<img-tessellation-topology-ll>>. 624 625This enum affects how the code:VertexOrderCw and code:VertexOrderCcw 626tessellation execution modes are interpreted, since the winding is defined 627relative to the orientation of the domain. 628-- 629endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 630