1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[writing]] 6e5c31af7Sopenharmony_ci= Writing Style 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciNew specification language should, whenever possible, closely follow related 9e5c31af7Sopenharmony_ciexamples in the existing specification documents. 10e5c31af7Sopenharmony_ci 11e5c31af7Sopenharmony_ciWhenever possible follow existing API design patterns. 12e5c31af7Sopenharmony_ciSome specific patterns to follow (this list is very incomplete) include: 13e5c31af7Sopenharmony_ci 14e5c31af7Sopenharmony_ci * Behavior of queries which return arrays of unknown length (see e.g. 15e5c31af7Sopenharmony_ci `vkEnumeratePhysicalDevices`). 16e5c31af7Sopenharmony_ci * Behavior of creation commands which create multiple objects at once (see 17e5c31af7Sopenharmony_ci e.g. `vkCreateGraphicsPipelines`). 18e5c31af7Sopenharmony_ci 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ci[[writing-misc]] 21e5c31af7Sopenharmony_ci== Miscellaneous Grammar, Spelling, and Punctuation Issues 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ci=== Use the Oxford Comma (Serial Comma) 24e5c31af7Sopenharmony_ci 25e5c31af7Sopenharmony_ciWhen writing a sentence listing a series of items, include a comma before 26e5c31af7Sopenharmony_cithe "`and`" separating the last item. 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ci*Correct:* The red, green, blue, and alpha components. 29e5c31af7Sopenharmony_ci 30e5c31af7Sopenharmony_ci*Incorrect:* The red, green, blue and alpha components. 31e5c31af7Sopenharmony_ci 32e5c31af7Sopenharmony_ciAlso see this 33e5c31af7Sopenharmony_cilink:https://blog.oxforddictionaries.com/2015/01/21/video-oxford-comma/[video 34e5c31af7Sopenharmony_cidiscussion of the Oxford comma] provided by the Oxford Dictionary. 35e5c31af7Sopenharmony_ci 36e5c31af7Sopenharmony_ci 37e5c31af7Sopenharmony_ci[[writing-titlecase]] 38e5c31af7Sopenharmony_ci=== Use AP Title Case for Chapter and Section Titles 39e5c31af7Sopenharmony_ci 40e5c31af7Sopenharmony_ciHere is a link:https://titlecaseconverter.com/rules/[summary] of the rules: 41e5c31af7Sopenharmony_ci 42e5c31af7Sopenharmony_ci * Capitalize the first word and the last word of the title. 43e5c31af7Sopenharmony_ci * Capitalize the principal words. 44e5c31af7Sopenharmony_ci * Capitalize "`to`" in infinitives. 45e5c31af7Sopenharmony_ci * Capitalize all words of four letters or more. 46e5c31af7Sopenharmony_ci * Do not capitalize articles, conjunctions, and prepositions of three 47e5c31af7Sopenharmony_ci letters or fewer. 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ci[NOTE] 50e5c31af7Sopenharmony_ci.Note 51e5c31af7Sopenharmony_ci==== 52e5c31af7Sopenharmony_ciThe actual AP style guide is behind a paywall. 53e5c31af7Sopenharmony_ciThe summary here is from a commercial website. 54e5c31af7Sopenharmony_ci==== 55e5c31af7Sopenharmony_ci 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_ci=== Date Format 58e5c31af7Sopenharmony_ci 59e5c31af7Sopenharmony_ciWhenever possible, write dates in the <<iso-8601,ISO 8601>> format: 60e5c31af7Sopenharmony_ciYYYY-MM-DD. 61e5c31af7Sopenharmony_ci 62e5c31af7Sopenharmony_ciIf needed for consistency with existing dates, e.g. in appendix changelogs, 63e5c31af7Sopenharmony_ciyou can also write "`Month DD, YYYY`" where "`Month`" is the English name of 64e5c31af7Sopenharmony_cithe month. 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ciNever use ambiguous formats such as "`09/12/16`". 67e5c31af7Sopenharmony_ci 68e5c31af7Sopenharmony_ci[source,asciidoc] 69e5c31af7Sopenharmony_ci.Example Markup 70e5c31af7Sopenharmony_ci---- 71e5c31af7Sopenharmony_ci * 2016-09-12 72e5c31af7Sopenharmony_ci * September 12, 2016 73e5c31af7Sopenharmony_ci---- 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ci 76e5c31af7Sopenharmony_ci[[writing-misc-a-an]] 77e5c31af7Sopenharmony_ci=== A/An and Markup Macros 78e5c31af7Sopenharmony_ci 79e5c31af7Sopenharmony_ciUse "`a`" and "`an`" 80e5c31af7Sopenharmony_cilink:https://www.grammar.com/a-vs-an-when-to-use/[correctly], based on the 81e5c31af7Sopenharmony_ci*sound* of the letter beginning the following word. 82e5c31af7Sopenharmony_ci 83e5c31af7Sopenharmony_ciIt is easy to get this wrong when talking about Vulkan API names tagged with 84e5c31af7Sopenharmony_cithe <<markup-macros,markup macros>>. 85e5c31af7Sopenharmony_ciFor example, if you wanted to say: 86e5c31af7Sopenharmony_ci 87e5c31af7Sopenharmony_ciA ename:VK_ERROR_DEVICE_LOST error 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_cithe correct way to mark this up in asciidoctor would be: 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ci[source,asciidoc] 92e5c31af7Sopenharmony_ci---- 93e5c31af7Sopenharmony_ciA ename:VK_ERROR_DEVICE_LOST error 94e5c31af7Sopenharmony_ci---- 95e5c31af7Sopenharmony_ci 96e5c31af7Sopenharmony_ciHowever, on first glance at this it *appears* wrong, because the "`word`" 97e5c31af7Sopenharmony_cifollowing "`a`" is the macro name, "`ename{cl}`". 98e5c31af7Sopenharmony_ciThat starts with a vowel, so the temptation is to say 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ci[source,asciidoc] 101e5c31af7Sopenharmony_ci---- 102e5c31af7Sopenharmony_ciAn ename:VK_ERROR_DEVICE_LOST error may occur. 103e5c31af7Sopenharmony_ci---- 104e5c31af7Sopenharmony_ci 105e5c31af7Sopenharmony_ciWhat matters here is how the *output* document is formatted. 106e5c31af7Sopenharmony_ci 107e5c31af7Sopenharmony_ci 108e5c31af7Sopenharmony_ci=== Numbers in Text 109e5c31af7Sopenharmony_ci 110e5c31af7Sopenharmony_ciWhen describing the need for a small number of objects, smaller than ten, 111e5c31af7Sopenharmony_cispell the number out (e.g. "`one`"). 112e5c31af7Sopenharmony_ciIf you are describing a literal value that is a small number, you may use a 113e5c31af7Sopenharmony_cinumeric value (e.g. "`1`"). 114e5c31af7Sopenharmony_ci 115e5c31af7Sopenharmony_ciFor example, instead of writing that a bitmask "`contains 1 or more bits`", 116e5c31af7Sopenharmony_ciwrite that it "`contains one or more bits`". 117e5c31af7Sopenharmony_ciA counter example is that it is okay to write "`For non-stereoscopic-3D 118e5c31af7Sopenharmony_ciapplications, this value is 1.`" 119e5c31af7Sopenharmony_ci 120e5c31af7Sopenharmony_ci 121e5c31af7Sopenharmony_ci[[writing-conventions]] 122e5c31af7Sopenharmony_ci=== Use American Spelling Conventions 123e5c31af7Sopenharmony_ci 124e5c31af7Sopenharmony_ciIn case of conflict, use American rather than British spelling conventions, 125e5c31af7Sopenharmony_ciexcept for noted exceptions in the table below. 126e5c31af7Sopenharmony_ci 127e5c31af7Sopenharmony_ci.Spelling 128e5c31af7Sopenharmony_ci[width="60%",options="header"] 129e5c31af7Sopenharmony_ci|==== 130e5c31af7Sopenharmony_ci| Use Spelling | Instead Of | Comments 131e5c31af7Sopenharmony_ci| color | colour | 132e5c31af7Sopenharmony_ci| signaled | signalled | 133e5c31af7Sopenharmony_ci| tessellation | tesselation | Historical exception 134e5c31af7Sopenharmony_ci|==== 135e5c31af7Sopenharmony_ci 136e5c31af7Sopenharmony_ci[NOTE] 137e5c31af7Sopenharmony_ci.Note 138e5c31af7Sopenharmony_ci==== 139e5c31af7Sopenharmony_ciThere are a few exceptions to `color` in the Vulkan Video extensions, such 140e5c31af7Sopenharmony_cias ename:VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT. 141e5c31af7Sopenharmony_ciThis is for because those extensions refer to externally defined video 142e5c31af7Sopenharmony_cicompression standards and headers using that spelling. 143e5c31af7Sopenharmony_ci==== 144e5c31af7Sopenharmony_ci 145e5c31af7Sopenharmony_ci 146e5c31af7Sopenharmony_ci[[writing-inclusivity]] 147e5c31af7Sopenharmony_ci=== Use Inclusive Language 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_ciThe Vulkan Working Group has begun to apply the 150e5c31af7Sopenharmony_cilink:https://www.khronos.org/about/inclusive-language[Khronos Inclusive 151e5c31af7Sopenharmony_ciLanguage] list to our specifications and other documents. 152e5c31af7Sopenharmony_ciThe Khronos Inclusive Language list contains terms to avoid due to their use 153e5c31af7Sopenharmony_ciin discriminatory contexts that make people uncomfortable, or cause 154e5c31af7Sopenharmony_cidivision. 155e5c31af7Sopenharmony_ci 156e5c31af7Sopenharmony_ciWe are working through the Vulkan Specification repository to make 157e5c31af7Sopenharmony_ciappropriate changes, and enhancing the repository continuous integration 158e5c31af7Sopenharmony_ciscripts to report questionable terminology usage. 159e5c31af7Sopenharmony_ciThis process will take some time. 160e5c31af7Sopenharmony_ci 161e5c31af7Sopenharmony_ciSome files in the repository are incorporated unmodified from external 162e5c31af7Sopenharmony_ciprojects we do not control, and which may not comply with the Inclusive 163e5c31af7Sopenharmony_ciLanguage list. 164e5c31af7Sopenharmony_ciWe will ask those projects to update their terminology usage, but cannot 165e5c31af7Sopenharmony_cicontrol their choices. 166e5c31af7Sopenharmony_ci 167e5c31af7Sopenharmony_ci 168e5c31af7Sopenharmony_ci[[writing-pointers-instances]] 169e5c31af7Sopenharmony_ci=== Describing Pointers, Handles, Structures, and Arrays 170e5c31af7Sopenharmony_ci 171e5c31af7Sopenharmony_ciWhen describing pointer parameters or members, use "`is a pointer to`" 172e5c31af7Sopenharmony_cirather than more informal phrasing such as "`points to`". 173e5c31af7Sopenharmony_ci 174e5c31af7Sopenharmony_ciWhen describing individual structures, use "`VkStructname structure`" rather 175e5c31af7Sopenharmony_cithan longer phrasing such as "`instance of the VkStructname structure`" or 176e5c31af7Sopenharmony_ci"`structure of type VkStructname`". 177e5c31af7Sopenharmony_ci 178e5c31af7Sopenharmony_ciWhen describing array parameters or members, use "`is a pointer to an array 179e5c31af7Sopenharmony_ciof`" rather than "`is an array of`" unless it is a structure member that is 180e5c31af7Sopenharmony_cia fixed-size array. 181e5c31af7Sopenharmony_ciReference the dynamic size of the array that is pointed to (usually another 182e5c31af7Sopenharmony_cistructure member), or the static size for fixed-size arrays, in the 183e5c31af7Sopenharmony_cidescription. 184e5c31af7Sopenharmony_ci 185e5c31af7Sopenharmony_ciWhen describing pointers which may be `NULL`, use "`is `NULL` or a pointer 186e5c31af7Sopenharmony_cito`" rather than "`is an optional pointer`". 187e5c31af7Sopenharmony_ciThe same principle applies when describing a handle which may be 188e5c31af7Sopenharmony_cidname:VK_NULL_HANDLE. 189e5c31af7Sopenharmony_ci"`Optional pointer/handle`" are not well-defined terms in the Specification. 190e5c31af7Sopenharmony_ci 191e5c31af7Sopenharmony_ci[source,asciidoc] 192e5c31af7Sopenharmony_ci.Example Markup 193e5c31af7Sopenharmony_ci---- 194e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a slink:VkDebugUtilsLabelEXT structure 195e5c31af7Sopenharmony_ci specifying the parameters of the label to insert. 196e5c31af7Sopenharmony_ci * pname:pBindInfos is a pointer to an array of pname:bindInfoCount 197e5c31af7Sopenharmony_ci slink:VkBindBufferMemoryInfo structures describing buffers and memory to 198e5c31af7Sopenharmony_ci bind. 199e5c31af7Sopenharmony_ci * pname:pStrides is `NULL` or a pointer to an array 200e5c31af7Sopenharmony_ci of buffer strides. 201e5c31af7Sopenharmony_ci * pname:image is dlink:VK_NULL_HANDLE or a handle of an image which this 202e5c31af7Sopenharmony_ci memory will be bound to. 203e5c31af7Sopenharmony_ci---- 204e5c31af7Sopenharmony_ci 205e5c31af7Sopenharmony_ci 206e5c31af7Sopenharmony_ci[[writing-arrays]] 207e5c31af7Sopenharmony_ci=== Describing Properties of Array Elements 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ciMany Vulkan parameters are arrays, or pointers to arrays. 210e5c31af7Sopenharmony_ciWhen describing array elements, use the terminology "`each element`" when 211e5c31af7Sopenharmony_cithe description applies uniformly and independently to every element of the 212e5c31af7Sopenharmony_ciarray. 213e5c31af7Sopenharmony_ciFor example: 214e5c31af7Sopenharmony_ci 215e5c31af7Sopenharmony_ci[source,asciidoc] 216e5c31af7Sopenharmony_ci.Example Markup 217e5c31af7Sopenharmony_ci---- 218e5c31af7Sopenharmony_ci * Each element of the pname:pCommandBuffers member of each element of 219e5c31af7Sopenharmony_ci pname:pSubmits must: be in the <<commandbuffers-lifecycle, pending or 220e5c31af7Sopenharmony_ci executable state>>. 221e5c31af7Sopenharmony_ci---- 222e5c31af7Sopenharmony_ci 223e5c31af7Sopenharmony_ciUse the terminology "`any element`" when the description is of zero or more 224e5c31af7Sopenharmony_cielements of the array sharing a property. 225e5c31af7Sopenharmony_ciFor example: 226e5c31af7Sopenharmony_ci 227e5c31af7Sopenharmony_ci[source,asciidoc] 228e5c31af7Sopenharmony_ci.Example Markup 229e5c31af7Sopenharmony_ci---- 230e5c31af7Sopenharmony_ci * If any element of the pname:pCommandBuffers member of any element 231e5c31af7Sopenharmony_ci of pname:pSubmits was not recorded with the 232e5c31af7Sopenharmony_ci ename:VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, it must: not be in 233e5c31af7Sopenharmony_ci the <<commandbuffers-lifecycle, pending state>>. 234e5c31af7Sopenharmony_ci---- 235e5c31af7Sopenharmony_ci 236e5c31af7Sopenharmony_ciNever use the redundant terminology "`any *given* element`". 237e5c31af7Sopenharmony_ci 238e5c31af7Sopenharmony_ci 239e5c31af7Sopenharmony_ci[[writing-compound-words]] 240e5c31af7Sopenharmony_ci=== Compound Words and Preferred Orthography 241e5c31af7Sopenharmony_ci 242e5c31af7Sopenharmony_ciUnless there is longstanding precedent in computer science literature, or 243e5c31af7Sopenharmony_cithe word is a <<spelling-exception-table, noted exception>>, do not 244e5c31af7Sopenharmony_ciarbitrarily combine terms together with hyphens, or as a single compound 245e5c31af7Sopenharmony_ciword without hyphens. 246e5c31af7Sopenharmony_ci 247e5c31af7Sopenharmony_ciThis does not apply to parameter names in the API, where capitalization is 248e5c31af7Sopenharmony_ciused to distinguish words. 249e5c31af7Sopenharmony_ciFor example, it is proper to refer to the use of a pname:colorSpace member 250e5c31af7Sopenharmony_ciof a structure as a "`color space`" value. 251e5c31af7Sopenharmony_ci 252e5c31af7Sopenharmony_ci.Spelling 253e5c31af7Sopenharmony_ci[width="70%",options="header",cols="20%,20%,60%"] 254e5c31af7Sopenharmony_ci|==== 255e5c31af7Sopenharmony_ci| Use Spelling | Instead Of | Comments 256e5c31af7Sopenharmony_ci| bit plane | bitplane | 257e5c31af7Sopenharmony_ci| compile time | compile-time | Per Wikipedia "`compile time`" 258e5c31af7Sopenharmony_ci| color space | colorspace | 259e5c31af7Sopenharmony_ci| cube map | cubemap | 260e5c31af7Sopenharmony_ci| double-buffer | doublebuffer | 261e5c31af7Sopenharmony_ci| entry point | entry-point, + 262e5c31af7Sopenharmony_ci entrypoint 263e5c31af7Sopenharmony_ci | Except if needed to disambiguate from surrounding terms 264e5c31af7Sopenharmony_ci| flat shading | flatshading | 265e5c31af7Sopenharmony_ci| GitHub | Github | Site's preferred spelling 266e5c31af7Sopenharmony_ci| indirect (drawing/dispatching) command 267e5c31af7Sopenharmony_ci | indirect command (draw/dispatch) 268e5c31af7Sopenharmony_ci | Even though related commands are named 269e5c31af7Sopenharmony_ci ftext:vk*Draw*Indirect 270e5c31af7Sopenharmony_ci| LOD | lod, + 271e5c31af7Sopenharmony_ci level of detail, + 272e5c31af7Sopenharmony_ci level-of-detail| Acronym for "`Level of Detail`" 273e5c31af7Sopenharmony_ci| mip level + 274e5c31af7Sopenharmony_ci mip layer + 275e5c31af7Sopenharmony_ci mip size + 276e5c31af7Sopenharmony_ci mip tail 277e5c31af7Sopenharmony_ci | miplevel + 278e5c31af7Sopenharmony_ci miplayer + 279e5c31af7Sopenharmony_ci mipsize + 280e5c31af7Sopenharmony_ci miptail | "`mipmap *term*`" may be used in time 281e5c31af7Sopenharmony_ci| render pass | renderpass | 282e5c31af7Sopenharmony_ci| reuse | re-use | 283e5c31af7Sopenharmony_ci| side effect | side-effect | 284e5c31af7Sopenharmony_ci| use case | use-case | 285e5c31af7Sopenharmony_ci|==== 286e5c31af7Sopenharmony_ci 287e5c31af7Sopenharmony_ci[[spelling-exception-table]] 288e5c31af7Sopenharmony_ci.Spelling Exceptions 289e5c31af7Sopenharmony_ci[width="70%",options="header",cols="20%,20%,60%"] 290e5c31af7Sopenharmony_ci|==== 291e5c31af7Sopenharmony_ci| general-purpose 292e5c31af7Sopenharmony_ci | general purpose| When used as an adjective 293e5c31af7Sopenharmony_ci| happen-before + 294e5c31af7Sopenharmony_ci happen-after | happen before + 295e5c31af7Sopenharmony_ci happen after | As used in concurrent languages such as 296e5c31af7Sopenharmony_ci C++11, Java and OpenCL C. 297e5c31af7Sopenharmony_ci| implementation-dependent 298e5c31af7Sopenharmony_ci | implementation dependent 299e5c31af7Sopenharmony_ci | When used as an adjective 300e5c31af7Sopenharmony_ci| mipmap | mip map | Exception for historical reasons 301e5c31af7Sopenharmony_ci| pname:pNext chain 302e5c31af7Sopenharmony_ci | pname:pNext-chain, + 303e5c31af7Sopenharmony_ci pname:pNext extension chain 304e5c31af7Sopenharmony_ci | 305e5c31af7Sopenharmony_ci| swapchain | swap chain | Exception due to heavy use in WSI extensions 306e5c31af7Sopenharmony_ci|==== 307e5c31af7Sopenharmony_ci 308e5c31af7Sopenharmony_ci[NOTE] 309e5c31af7Sopenharmony_ci.Note 310e5c31af7Sopenharmony_ci==== 311e5c31af7Sopenharmony_ciThese examples are not complete, and will be added to over time when there 312e5c31af7Sopenharmony_ciis reason to. 313e5c31af7Sopenharmony_ci 314e5c31af7Sopenharmony_ciDifferent sources and individuals can and do reasonably disagree with regard 315e5c31af7Sopenharmony_cito some of the examples. 316e5c31af7Sopenharmony_ci==== 317e5c31af7Sopenharmony_ci 318e5c31af7Sopenharmony_ci 319e5c31af7Sopenharmony_ci==== Words With "Pre-" Prefixes 320e5c31af7Sopenharmony_ci 321e5c31af7Sopenharmony_ci// also: premultiply preorder prerotation predefined 322e5c31af7Sopenharmony_ci 323e5c31af7Sopenharmony_ciWhen using the prefix "`pre`" to indicate "`prior to`", such as in the words 324e5c31af7Sopenharmony_ci"`preinitialized`", "`preprocess`", and "`pretransform`", do not separate 325e5c31af7Sopenharmony_cithe prefix from the word with a hyphen. 326e5c31af7Sopenharmony_ciThis list is not intended to be complete. 327e5c31af7Sopenharmony_ci 328e5c31af7Sopenharmony_ci 329e5c31af7Sopenharmony_ci[[writing-references]] 330e5c31af7Sopenharmony_ci=== References 331e5c31af7Sopenharmony_ci 332e5c31af7Sopenharmony_ciWhen citing external references, use the appropriate <<acm-references, 333e5c31af7Sopenharmony_ciAssociation for Computing Machinery Citation Style>>. 334e5c31af7Sopenharmony_ciMost citations in our specifications should follow the _For an online 335e5c31af7Sopenharmony_cidocument/WWW resource_ style, using the actual date on the document being 336e5c31af7Sopenharmony_cireferenced rather than the document retrieval date. 337e5c31af7Sopenharmony_ciSee the <<vulkan-spec, Vulkan API Specification>> citation in this document 338e5c31af7Sopenharmony_cifor an example. 339e5c31af7Sopenharmony_ci 340e5c31af7Sopenharmony_ci 341e5c31af7Sopenharmony_ci[[writing-undefined]] 342e5c31af7Sopenharmony_ci== Describing Undefined Behavior 343e5c31af7Sopenharmony_ci 344e5c31af7Sopenharmony_ciWhen describing undefined behavior that results only in the values of 345e5c31af7Sopenharmony_cispecified variables, or the contents of specified memory, becoming undefined 346e5c31af7Sopenharmony_cior implementation-defined, use the undefined{cl} macro to indicate that each 347e5c31af7Sopenharmony_ciuse of the term "`undefined`" has been carefully considered and accurately 348e5c31af7Sopenharmony_cirepresents the degree of undefined behavior allowed. 349e5c31af7Sopenharmony_ci 350e5c31af7Sopenharmony_ciThe word "`undefined`" should not be used without the trailing {cl}. 351e5c31af7Sopenharmony_ciThis is enforced by internal CI tests. 352e5c31af7Sopenharmony_ci 353e5c31af7Sopenharmony_ciThe undefined{cl} macro does not result in visible markup in the output 354e5c31af7Sopenharmony_cidocument, and is not itself a normative term. 355e5c31af7Sopenharmony_ciThe macro is simply markup to help ensure that use of the word has been 356e5c31af7Sopenharmony_ciconsciously chosen. 357e5c31af7Sopenharmony_ci 358e5c31af7Sopenharmony_ciWhen describing more general types of undefined behavior (up to and 359e5c31af7Sopenharmony_ciincluding termination of the application), do *not* use the term 360e5c31af7Sopenharmony_ci"`undefined`". 361e5c31af7Sopenharmony_ciInstead, specify that the application must{cl} not create circumstances that 362e5c31af7Sopenharmony_ciwould lead to such behavior. 363e5c31af7Sopenharmony_ciSuch statements should be written as valid usage statements, if possible. 364e5c31af7Sopenharmony_ci 365e5c31af7Sopenharmony_ci 366e5c31af7Sopenharmony_ci[[writing-describing]] 367e5c31af7Sopenharmony_ci== Describing Commands and Parameters 368e5c31af7Sopenharmony_ci 369e5c31af7Sopenharmony_ciThe <<vulkan-spec,Vulkan API Specification>> describes API commands followed 370e5c31af7Sopenharmony_ciby descriptions of their parameters, which are usually simple scalar types, 371e5c31af7Sopenharmony_cihandles or pointers to Vulkan objects or arrays of objects; enumerated types 372e5c31af7Sopenharmony_cispecifying values or bitmasks which affect the operation of a command; or 373e5c31af7Sopenharmony_cistructures containing combinations of scalar types and objects. 374e5c31af7Sopenharmony_ciThe templates and examples shown and annotated here are based on the 375e5c31af7Sopenharmony_ci<<vulkan-spec,Vulkan API Specification>>. 376e5c31af7Sopenharmony_ciDo not vary from them without compelling need. 377e5c31af7Sopenharmony_ci 378e5c31af7Sopenharmony_ciNormative parts of the <<vulkan-spec,Vulkan API Specification>> should 379e5c31af7Sopenharmony_cidescribe _what_ something does, rather than _how_ or _why_ an application 380e5c31af7Sopenharmony_ciwould want to use it. 381e5c31af7Sopenharmony_ci 382e5c31af7Sopenharmony_ciWhen explicitly allowed by the Specification, the reserved value `NULL` may: 383e5c31af7Sopenharmony_cibe used for pointer parameters and members and dispatchable object handles, 384e5c31af7Sopenharmony_ciand the reserved value dname:VK_NULL_HANDLE may: be used for 385e5c31af7Sopenharmony_cinon-dispatchable Vulkan object handle parameters and members. 386e5c31af7Sopenharmony_ciOtherwise, pointers and handles must: refer to valid memory and valid Vulkan 387e5c31af7Sopenharmony_ciobjects, respectively. 388e5c31af7Sopenharmony_ci 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_ci[NOTE] 391e5c31af7Sopenharmony_ci.Guideline 392e5c31af7Sopenharmony_ci==== 393e5c31af7Sopenharmony_ciAs a simple example, say 394e5c31af7Sopenharmony_ci 395e5c31af7Sopenharmony_ci"`To create a command pool, call fname:vkCreateCommandPool`" 396e5c31af7Sopenharmony_ci 397e5c31af7Sopenharmony_cirather than 398e5c31af7Sopenharmony_ci 399e5c31af7Sopenharmony_ci"`You/The application/The user can create a command pool by calling 400e5c31af7Sopenharmony_cifname:vkCreateCommandPool`". 401e5c31af7Sopenharmony_ci==== 402e5c31af7Sopenharmony_ci 403e5c31af7Sopenharmony_ciExplanations of _why_ and _how_ should largely be confined to reference 404e5c31af7Sopenharmony_cidocumentation, sample code, tutorials, and other such documents. 405e5c31af7Sopenharmony_ciOccasional non-normative explanations can be included in the 406e5c31af7Sopenharmony_ci<<vulkan-spec,Vulkan API Specification>> using 407e5c31af7Sopenharmony_ci<<markup-informative-notes,informative notes>>. 408e5c31af7Sopenharmony_ci 409e5c31af7Sopenharmony_ci 410e5c31af7Sopenharmony_ci[[writing-describing-errors]] 411e5c31af7Sopenharmony_ci=== Commands Which Return Error Codes 412e5c31af7Sopenharmony_ci 413e5c31af7Sopenharmony_ciCommands which return elink:VkResult values must list all possible error 414e5c31af7Sopenharmony_cicodes for the command in the `errorcodes` XML attribute for the command. 415e5c31af7Sopenharmony_ciAlmost all such commands may return the ename:VK_ERROR_OUT_OF_HOST_MEMORY 416e5c31af7Sopenharmony_cierror code. 417e5c31af7Sopenharmony_ciAny exceptions to this rule should be carefully considered by the 418e5c31af7Sopenharmony_cispecification author, and a rationale for this anomalous behavior may be 419e5c31af7Sopenharmony_ciprovided in a NOTE or in the Issues section of the extension appendix 420e5c31af7Sopenharmony_cicorresponding to the new command. 421e5c31af7Sopenharmony_ci 422e5c31af7Sopenharmony_ciSee the "`Return Codes`" section of the <<vulkan-spec,Vulkan API 423e5c31af7Sopenharmony_ciSpecification>> for additional information. 424e5c31af7Sopenharmony_ci 425e5c31af7Sopenharmony_ci 426e5c31af7Sopenharmony_ci[[writing-describing-layers]] 427e5c31af7Sopenharmony_ci== Extensions and Grouping Related Language 428e5c31af7Sopenharmony_ci 429e5c31af7Sopenharmony_ciLanguage specifying behavior of a command or structure that does not 430e5c31af7Sopenharmony_cioriginate in an extension should be placed in a single contiguous region of 431e5c31af7Sopenharmony_cithe specification. 432e5c31af7Sopenharmony_ci 433e5c31af7Sopenharmony_ciWhen defining a new command or structure from an extension that introduces 434e5c31af7Sopenharmony_ciadditional behavior or options, do not insert such new language in a way 435e5c31af7Sopenharmony_cithat "`orphans`" part of an existing description by splitting up the 436e5c31af7Sopenharmony_ciexisting language. 437e5c31af7Sopenharmony_ci 438e5c31af7Sopenharmony_ciThis constraint does not apply to enumerated types. 439e5c31af7Sopenharmony_ciLanguage for new enumerants defined by extensions should be added to the 440e5c31af7Sopenharmony_ciexisting enumerant definition, <<extensions-documenting-extensions, 441e5c31af7Sopenharmony_ciprotected by asciidoctor conditionals>> for the new extension. 442e5c31af7Sopenharmony_ci 443e5c31af7Sopenharmony_ci[NOTE] 444e5c31af7Sopenharmony_ci.Guideline 445e5c31af7Sopenharmony_ci==== 446e5c31af7Sopenharmony_ciSpecification language should be structured, whenever possible, so it fits 447e5c31af7Sopenharmony_ciinto a single open block defining a <<writing-refpages, reference page>>. 448e5c31af7Sopenharmony_ci==== 449e5c31af7Sopenharmony_ci 450e5c31af7Sopenharmony_ci 451e5c31af7Sopenharmony_ci[[writing-math]] 452e5c31af7Sopenharmony_ci== Math Markup 453e5c31af7Sopenharmony_ci 454e5c31af7Sopenharmony_ciThere is a considerable amount of math in the documentation, ranging from 455e5c31af7Sopenharmony_cisimple arithmetic expressions to complicated conditionals. 456e5c31af7Sopenharmony_ciThere are two ways of marking up math expressions, described below. 457e5c31af7Sopenharmony_ci 458e5c31af7Sopenharmony_ci 459e5c31af7Sopenharmony_ci=== Asciidoc Math Markup 460e5c31af7Sopenharmony_ci 461e5c31af7Sopenharmony_ciWhere possible, math is marked up using straight asciidoctor features. 462e5c31af7Sopenharmony_ciFor commonality with LaTeX math (see below), some common LaTeX operators and 463e5c31af7Sopenharmony_cinames are defined as asciidoctor attributes using the same names, expanding 464e5c31af7Sopenharmony_cito the corresponding Unicode entities. 465e5c31af7Sopenharmony_ciThe complete set of these attributes is found in `config/attribs.adoc`. 466e5c31af7Sopenharmony_ci 467e5c31af7Sopenharmony_ci.Spelling 468e5c31af7Sopenharmony_ci[width="100%",options="header",cols="20%,20%,60%"] 469e5c31af7Sopenharmony_ci|==== 470e5c31af7Sopenharmony_ci| Feature | Result | Sample Markup 471e5c31af7Sopenharmony_ci 472e5c31af7Sopenharmony_ci| Subscripts 473e5c31af7Sopenharmony_ci| [eq]#a~x~# 474e5c31af7Sopenharmony_ci| +++[eq]#a~x~#+++ 475e5c31af7Sopenharmony_ci 476e5c31af7Sopenharmony_ci| Superscripts 477e5c31af7Sopenharmony_ci| [eq]#-2^(b-1)^# 478e5c31af7Sopenharmony_ci| +++[eq]#-2^(b-1)^#+++ 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ci| Struct/parameter names as variables 481e5c31af7Sopenharmony_ci| [eq]#2^pname:bits^# 482e5c31af7Sopenharmony_ci| +++[eq]#2^pname:bits^#+++ 483e5c31af7Sopenharmony_ci 484e5c31af7Sopenharmony_ci| Greek Letters (selected) 485e5c31af7Sopenharmony_ci| [eq]#{alpha}, {beta}, {gamma}, {delta}, {DeltaUpper}, {epsilon}, {lambda}, 486e5c31af7Sopenharmony_ci {rho}, {tau}# 487e5c31af7Sopenharmony_ci| +++[eq]#{alpha}, {beta}, {gamma}, {delta}, {DeltaUpper}, {epsilon}, {lambda}, 488e5c31af7Sopenharmony_ci {rho}, {tau}#+++ 489e5c31af7Sopenharmony_ci 490e5c31af7Sopenharmony_ci| Fractions 491e5c31af7Sopenharmony_ci| [eq]#{onequarter} {plus} {onehalf}# 492e5c31af7Sopenharmony_ci| +++[eq]#{onequarter} {plus} {onehalf}#+++ 493e5c31af7Sopenharmony_ci 494e5c31af7Sopenharmony_ci| Closed Ranges 495e5c31af7Sopenharmony_ci| [eq]#[0,1]# 496e5c31af7Sopenharmony_ci| +++[eq]#[0,1]#+++ 497e5c31af7Sopenharmony_ci 498e5c31af7Sopenharmony_ci| Open Ranges 499e5c31af7Sopenharmony_ci| [eq]#[0,1)# 500e5c31af7Sopenharmony_ci| +++[eq]#[0,1)#+++ 501e5c31af7Sopenharmony_ci 502e5c31af7Sopenharmony_ci| Arithmetic and Relational Operators 503e5c31af7Sopenharmony_ci| [eq]#a {times} b#, [eq]#a {leq} b#, [eq]#a {neq} b#, [eq]#a {geq} b#, [eq]#{vert}x{vert}# 504e5c31af7Sopenharmony_ci| +++[eq]#a {times} b#+++, +++[eq]#a {leq} b#+++, +++[eq]#a {neq} b#+++, +++[eq]#a {geq} b#+++, +++[eq]#{vert}x{vert}#+++ 505e5c31af7Sopenharmony_ci 506e5c31af7Sopenharmony_ci| Floor 507e5c31af7Sopenharmony_ci| [eq]#{lfloor}w - {onehalf}{rfloor}# 508e5c31af7Sopenharmony_ci| +++[eq]#{lfloor}w - {onehalf}{rfloor}#+++ 509e5c31af7Sopenharmony_ci 510e5c31af7Sopenharmony_ci| Ceiling 511e5c31af7Sopenharmony_ci| [eq]#{lceil}log~2~(max(pname:width, pname:height)){rceil} {plus} 1# 512e5c31af7Sopenharmony_ci| +++[eq]#{lceil}log~2~(max(pname:width, pname:height)){rceil} {plus} 1#+++ 513e5c31af7Sopenharmony_ci 514e5c31af7Sopenharmony_ci| Logical and Set Operators 515e5c31af7Sopenharmony_ci| [eq]#{land} {lnot} {lor} {oplus} {elem}# 516e5c31af7Sopenharmony_ci| +++[eq]#{land} {lnot} {lor} {oplus} {elem}#+++ 517e5c31af7Sopenharmony_ci 518e5c31af7Sopenharmony_ci| Partial Derivatives 519e5c31af7Sopenharmony_ci| [eq]#{partial}r~x~ / {partial}x = 0# 520e5c31af7Sopenharmony_ci| +++[eq]#{partial}r~x~ / {partial}x = 0#+++ 521e5c31af7Sopenharmony_ci 522e5c31af7Sopenharmony_ci| Matrix/Vector Parameter Names 523e5c31af7Sopenharmony_ci| [eq]#**P** = t **P**~1~ {plus} (1-t) **P**~2~# 524e5c31af7Sopenharmony_ci| +++[eq]#**P** = t **P**~1~ {plus} (1-t) **P**~2~#+++ 525e5c31af7Sopenharmony_ci 526e5c31af7Sopenharmony_ci|==== 527e5c31af7Sopenharmony_ci 528e5c31af7Sopenharmony_ci 529e5c31af7Sopenharmony_ci[[writing-math-latexmath]] 530e5c31af7Sopenharmony_ci=== LaTeX Math Markup 531e5c31af7Sopenharmony_ci 532e5c31af7Sopenharmony_ciMath markup more complex than easily supported in straight asciidoctor 533e5c31af7Sopenharmony_cimarkup (examples found in the Vulkan Specification include matrices, 534e5c31af7Sopenharmony_citensors, summation notation, conditional assignments, and division of 535e5c31af7Sopenharmony_cicomplex expressions) are marked up using LaTeX math notation, which is 536e5c31af7Sopenharmony_cieither passed through to the KaTeX in-browser rendering script for HTML 537e5c31af7Sopenharmony_cioutputs, or passed through asciidoctor-mathematical for PDF outputs. 538e5c31af7Sopenharmony_ci 539e5c31af7Sopenharmony_ci[NOTE] 540e5c31af7Sopenharmony_ci.Note 541e5c31af7Sopenharmony_ci==== 542e5c31af7Sopenharmony_ciThere are font and style differences between LaTeX and asciidoctor math 543e5c31af7Sopenharmony_cimarkup which lead to minor visual inconsistencies. 544e5c31af7Sopenharmony_ciWe will try to make this better over time, but it is not significant enough 545e5c31af7Sopenharmony_cito be a big priority. 546e5c31af7Sopenharmony_ci==== 547e5c31af7Sopenharmony_ci 548e5c31af7Sopenharmony_ciWhile LaTeX math macros, including the amsmath package, are supported, 549e5c31af7Sopenharmony_cigeneral LaTeX constructs are not. 550e5c31af7Sopenharmony_ci 551e5c31af7Sopenharmony_ci_Inline math_ is encoded using the latexmath{cl} macro. 552e5c31af7Sopenharmony_ciFor example: 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_ci * latexmath:[[0,1\]] 555e5c31af7Sopenharmony_ci * latexmath:[\frac{1 - \frac{x}{2}}{x - 1}] 556e5c31af7Sopenharmony_ci * latexmath:[\mathbf{c} = t \mathbf{c}_1 + (1-t) \mathbf{c}_2.] 557e5c31af7Sopenharmony_ci 558e5c31af7Sopenharmony_ci[source,asciidoc] 559e5c31af7Sopenharmony_ci.Example Markup 560e5c31af7Sopenharmony_ci---- 561e5c31af7Sopenharmony_ci * latexmath:[[0,1\]] 562e5c31af7Sopenharmony_ci * latexmath:[\frac{1 - \frac{x}{2}}{x - 1}] 563e5c31af7Sopenharmony_ci * latexmath:[\mathbf{c} = t \mathbf{c}_1 + (1-t) \mathbf{c}_2. ] 564e5c31af7Sopenharmony_ci---- 565e5c31af7Sopenharmony_ci 566e5c31af7Sopenharmony_ciNote the escaped bracket in markup for the first expression, which is 567e5c31af7Sopenharmony_cinecessary to work around asciidoctor macro parsing. 568e5c31af7Sopenharmony_ci 569e5c31af7Sopenharmony_ci_Block math_ is used for more complex equations. 570e5c31af7Sopenharmony_ciThis example uses the `aligned` environment to delimit the expression. 571e5c31af7Sopenharmony_ci 572e5c31af7Sopenharmony_ci[latexmath] 573e5c31af7Sopenharmony_ci+++++++++++++++++++ 574e5c31af7Sopenharmony_ci\begin{aligned} 575e5c31af7Sopenharmony_cic_{RGB} & = 576e5c31af7Sopenharmony_ci \begin{cases} 577e5c31af7Sopenharmony_ci \frac{c_{sRGB}}{12.92} & \text{for}\ c_{sRGB} \leq 0.04045 \\ 578e5c31af7Sopenharmony_ci \left ( \frac{c_{sRGB}+0.055}{1.055} \right )^{2.4} & \text{for}\ c_{sRGB} > 0.04045 579e5c31af7Sopenharmony_ci \end{cases} 580e5c31af7Sopenharmony_ci\end{aligned} 581e5c31af7Sopenharmony_ci+++++++++++++++++++ 582e5c31af7Sopenharmony_ci 583e5c31af7Sopenharmony_ci[source,asciidoc] 584e5c31af7Sopenharmony_ci.Example Markup 585e5c31af7Sopenharmony_ci---- 586e5c31af7Sopenharmony_ci[latexmath] 587e5c31af7Sopenharmony_ci+++++++++++++++++++ 588e5c31af7Sopenharmony_ci\begin{aligned} 589e5c31af7Sopenharmony_cic_{RGB} & = 590e5c31af7Sopenharmony_ci \begin{cases} 591e5c31af7Sopenharmony_ci \frac{c_{sRGB}}{12.92} & \text{for}\ c_{sRGB} \leq 0.04045 \\ 592e5c31af7Sopenharmony_ci \left ( \frac{c_{sRGB}+0.055}{1.055} \right )^{2.4} & \text{for}\ c_{sRGB} > 0.04045 593e5c31af7Sopenharmony_ci \end{cases} 594e5c31af7Sopenharmony_ci\end{aligned} 595e5c31af7Sopenharmony_ci+++++++++++++++++++ 596e5c31af7Sopenharmony_ci---- 597e5c31af7Sopenharmony_ci 598e5c31af7Sopenharmony_ci[NOTE] 599e5c31af7Sopenharmony_ci.Note 600e5c31af7Sopenharmony_ci==== 601e5c31af7Sopenharmony_ciThe KaTeX processor used to render LaTeX math inside HTML documents does not 602e5c31af7Sopenharmony_cisupport all features of LaTeX math. 603e5c31af7Sopenharmony_ci 604e5c31af7Sopenharmony_ciSimilarly, the asciidoctor-mathematical processor does not support 605e5c31af7Sopenharmony_cieverything, though does have some support for AMSMath. 606e5c31af7Sopenharmony_ci 607e5c31af7Sopenharmony_ciSome workarounds we use are: 608e5c31af7Sopenharmony_ci 609e5c31af7Sopenharmony_ci.LaTeX math replacements for KaTeX compatibility 610e5c31af7Sopenharmony_ci[width="70%",options="header",cols="20%,20%,60%"] 611e5c31af7Sopenharmony_ci|==== 612e5c31af7Sopenharmony_ci| Replace | With | Comments 613e5c31af7Sopenharmony_ci| `++\begin{equation}++`, + 614e5c31af7Sopenharmony_ci `++\end{equation}++` | _nothing_ | Unnecessary in blocks. Should not be used for inline. 615e5c31af7Sopenharmony_ci| `\begin{align*}` | `++\begin{aligned}++` | 616e5c31af7Sopenharmony_ci| `\end{align*}` | `++\end{aligned}++` | 617e5c31af7Sopenharmony_ci| `++\operatorname{foo}++` | `++\mathbin{foo}++` | 618e5c31af7Sopenharmony_ci| `{\rm A}` | `++\mathrm{A}++` | 619e5c31af7Sopenharmony_ci| `\text{for }` | `\text{++for++}\` | Text ending in spaces is unpredictable - favour escaped spaces after text 620e5c31af7Sopenharmony_ci|==== 621e5c31af7Sopenharmony_ci 622e5c31af7Sopenharmony_ciThe KaTeX repository provides a 623e5c31af7Sopenharmony_cilink:https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX[list of 624e5c31af7Sopenharmony_cicurrently supported LaTeX functionality]. 625e5c31af7Sopenharmony_ciYou can also use the link:https://khan.github.io/KaTeX/[live katex preview 626e5c31af7Sopenharmony_citool] on the KaTeX website to double check support, without building the 627e5c31af7Sopenharmony_ciwhole specification. 628e5c31af7Sopenharmony_ci 629e5c31af7Sopenharmony_ciNote that we use a locally-cached copy of KaTeX which may lag the latest 630e5c31af7Sopenharmony_cipublished version on the website. 631e5c31af7Sopenharmony_ciAs of April 2021, we are using v0.11.1. 632e5c31af7Sopenharmony_ci 633e5c31af7Sopenharmony_ciSee the mtex2MML repository for a 634e5c31af7Sopenharmony_cilink:https://github.com/gjtorikian/mtex2MML/blob/master/SUPPORTED.md[list of 635e5c31af7Sopenharmony_cisupported operations in the PDF build]. 636e5c31af7Sopenharmony_ciIn particular, `\mathop` is not supported properly, but most other standard 637e5c31af7Sopenharmony_cifunctionality is included. 638e5c31af7Sopenharmony_ci 639e5c31af7Sopenharmony_ciIt is necessary to cross reference these two to make sure that support 640e5c31af7Sopenharmony_ciexists before using anything, but almost all standard functionality is 641e5c31af7Sopenharmony_cisupported for both. 642e5c31af7Sopenharmony_ci==== 643e5c31af7Sopenharmony_ci 644e5c31af7Sopenharmony_ciThis example is among the most complex expressions in the Vulkan 645e5c31af7Sopenharmony_cispecification: 646e5c31af7Sopenharmony_ci 647e5c31af7Sopenharmony_ci[latexmath] 648e5c31af7Sopenharmony_ci+++++++++++++++++++ 649e5c31af7Sopenharmony_ciV = 650e5c31af7Sopenharmony_ci \begin{cases} 651e5c31af7Sopenharmony_ci (-1)^S \times 0.0, & E = 0, M = 0 \\ 652e5c31af7Sopenharmony_ci (-1)^S \times 2^{-14} \times { M \over 2^{10} }, 653e5c31af7Sopenharmony_ci & E = 0, M \neq 0 \\ 654e5c31af7Sopenharmony_ci (-1)^S \times 2^{E-15} \times { \left( 1 + { M \over 2^{10} } \right) }, 655e5c31af7Sopenharmony_ci & 0 < E < 31 \\ 656e5c31af7Sopenharmony_ci (-1)^S \times Inf, & E = 31, M = 0 \\ 657e5c31af7Sopenharmony_ci NaN, & E = 31, M \neq 0 658e5c31af7Sopenharmony_ci \end{cases} 659e5c31af7Sopenharmony_ci+++++++++++++++++++ 660e5c31af7Sopenharmony_ci 661e5c31af7Sopenharmony_ci[source,asciidoc] 662e5c31af7Sopenharmony_ci.Example Markup 663e5c31af7Sopenharmony_ci---- 664e5c31af7Sopenharmony_ci[latexmath] 665e5c31af7Sopenharmony_ci+++++++++++++++++++ 666e5c31af7Sopenharmony_ciV = 667e5c31af7Sopenharmony_ci \begin{cases} 668e5c31af7Sopenharmony_ci (-1)^S \times 0.0, & E = 0, M = 0 \\ 669e5c31af7Sopenharmony_ci (-1)^S \times 2^{-14} \times { M \over 2^{10} }, 670e5c31af7Sopenharmony_ci & E = 0, M \neq 0 \\ 671e5c31af7Sopenharmony_ci (-1)^S \times 2^{E-15} \times { \left( 1 + { M \over 2^{10} } \right) }, 672e5c31af7Sopenharmony_ci & 0 < E < 31 \\ 673e5c31af7Sopenharmony_ci (-1)^S \times Inf, & E = 31, M = 0 \\ 674e5c31af7Sopenharmony_ci NaN, & E = 31, M \neq 0 675e5c31af7Sopenharmony_ci \end{cases} 676e5c31af7Sopenharmony_ci+++++++++++++++++++ 677e5c31af7Sopenharmony_ci---- 678e5c31af7Sopenharmony_ci 679e5c31af7Sopenharmony_ci 680e5c31af7Sopenharmony_ci[[writing-latexmath-in-table-cells]] 681e5c31af7Sopenharmony_ci=== LaTeX Math in Table Cells 682e5c31af7Sopenharmony_ci 683e5c31af7Sopenharmony_ciTo use `[latexmath]` or `latexmath{cl}` constructs inside table cells, the 684e5c31af7Sopenharmony_cicell separator must be `a|` instead of just `|`: 685e5c31af7Sopenharmony_ci 686e5c31af7Sopenharmony_ci[source,asciidoc] 687e5c31af7Sopenharmony_ci.Example Markup 688e5c31af7Sopenharmony_ci---- 689e5c31af7Sopenharmony_ci.Advanced Blend Overlap Modes 690e5c31af7Sopenharmony_ci[width="80%",options="header"] 691e5c31af7Sopenharmony_ci|==== 692e5c31af7Sopenharmony_ci| Overlap Mode | Weighting Equations 693e5c31af7Sopenharmony_ci| ename:VK_BLEND_OVERLAP_UNCORRELATED_EXT a| 694e5c31af7Sopenharmony_ci[latexmath] 695e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 696e5c31af7Sopenharmony_ci \begin{aligned} 697e5c31af7Sopenharmony_ci p_0(A_s,A_d) & = A_sA_d \\ 698e5c31af7Sopenharmony_ci p_1(A_s,A_d) & = A_s(1-A_d) \\ 699e5c31af7Sopenharmony_ci p_2(A_s,A_d) & = A_d(1-A_s) \\ 700e5c31af7Sopenharmony_ci \end{aligned} 701e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 702e5c31af7Sopenharmony_ci|==== 703e5c31af7Sopenharmony_ci---- 704e5c31af7Sopenharmony_ci 705e5c31af7Sopenharmony_ci 706e5c31af7Sopenharmony_ci[[writing-pNext-chain]] 707e5c31af7Sopenharmony_ci== Describing Extending Structure Chains 708e5c31af7Sopenharmony_ci 709e5c31af7Sopenharmony_ciWhen describing an extending structure which is passed to an existing 710e5c31af7Sopenharmony_cicommand by including it in the pname:pNext chain of a structure parameter of 711e5c31af7Sopenharmony_cithat command, introduce the structure description in this fashion: 712e5c31af7Sopenharmony_ci 713e5c31af7Sopenharmony_ci[source,asciidoc] 714e5c31af7Sopenharmony_ci---- 715e5c31af7Sopenharmony_ciWhen *performing an operation described by the extending structure*, add 716e5c31af7Sopenharmony_cia slink:VkExtensionStructNameID structure to the pname:pNext chain of the 717e5c31af7Sopenharmony_cislink:VkBaseExtensionStructName structure passed to the 718e5c31af7Sopenharmony_ciflink:vkBaseFunctionName command *saying what the extending structure 719e5c31af7Sopenharmony_cidoes*. 720e5c31af7Sopenharmony_ci---- 721e5c31af7Sopenharmony_ci 722e5c31af7Sopenharmony_ciWhen describing properties of a structure included in a pname:pNext chain, 723e5c31af7Sopenharmony_cirefer to that structure as "`included in the pname:pNext chain`" rather than 724e5c31af7Sopenharmony_ci`"present in`" or other similar terms, in this fashion: 725e5c31af7Sopenharmony_ci 726e5c31af7Sopenharmony_ci[source,asciidoc] 727e5c31af7Sopenharmony_ci---- 728e5c31af7Sopenharmony_ciIf the pname:pNext chain includes a slink:VkPhysicalDeviceFeatures2 729e5c31af7Sopenharmony_cistructure, then pname:pEnabledFeatures must: be `NULL` 730e5c31af7Sopenharmony_ci---- 731e5c31af7Sopenharmony_ci 732e5c31af7Sopenharmony_ci 733e5c31af7Sopenharmony_ci[[writing-example]] 734e5c31af7Sopenharmony_ci== Example Command, Structure, and Enumerant Descriptions 735e5c31af7Sopenharmony_ci 736e5c31af7Sopenharmony_ciThe <<sample-command,next section>> is a sample based on the 737e5c31af7Sopenharmony_ci<<vulkan-spec,Vulkan API Specification>>, and describes a command and 738e5c31af7Sopenharmony_cirelated structures and enumerated types in enough detail to see the 739e5c31af7Sopenharmony_cidifferent usage patterns and layout / markup used. 740e5c31af7Sopenharmony_ciInformative notes discussing markup and guidelines are interspersed with the 741e5c31af7Sopenharmony_ciexample description to explain how and why it looks as it does. 742e5c31af7Sopenharmony_ci 743e5c31af7Sopenharmony_ci 744e5c31af7Sopenharmony_ci[[sample-command]] 745e5c31af7Sopenharmony_ci== Sample Command Description: Creating Command Pools 746e5c31af7Sopenharmony_ci 747e5c31af7Sopenharmony_ci[open,refpage='vkCreateCommandPool',desc='Create a new command pool object',type='protos'] 748e5c31af7Sopenharmony_ci-- 749e5c31af7Sopenharmony_ciTo create a command pool, call: 750e5c31af7Sopenharmony_ci 751e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateCommandPool.adoc[] 752e5c31af7Sopenharmony_ci 753e5c31af7Sopenharmony_ci[NOTE] 754e5c31af7Sopenharmony_ci.Guideline 755e5c31af7Sopenharmony_ci==== 756e5c31af7Sopenharmony_ciBegin the command description with an open block delimiting the contents as 757e5c31af7Sopenharmony_cia reference page. 758e5c31af7Sopenharmony_ciThe open block contains several required attribute values, as described for 759e5c31af7Sopenharmony_ci<<writing-refpages, automatic extraction into a reference page>>. 760e5c31af7Sopenharmony_ci 761e5c31af7Sopenharmony_ciUse a short, active sentence when describing what commands do, instead of 762e5c31af7Sopenharmony_cimore passive phrasing like "`A command pool is created by calling:`" or 763e5c31af7Sopenharmony_ci"`The application may create a command pool by calling:`". 764e5c31af7Sopenharmony_ci 765e5c31af7Sopenharmony_ciAfter the description, include the autogenerated prototype for the command 766e5c31af7Sopenharmony_cifrom the `\{generated}/api/protos/` directory: 767e5c31af7Sopenharmony_ci 768e5c31af7Sopenharmony_ci// The 'subs=attributes+' and '{blank}--' are one way to allow the inner 769e5c31af7Sopenharmony_ci// [source] block to show the correct two dashes. See 770e5c31af7Sopenharmony_ci// https://discuss.asciidoctor.org/Another-markup-escaping-question-td5665.html 771e5c31af7Sopenharmony_ci 772e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 773e5c31af7Sopenharmony_ci---- 774e5c31af7Sopenharmony_ci[open,refpage='vkCreateCommandPool',desc='Create a new command pool object',type='protos'] 775e5c31af7Sopenharmony_ci{blank}-- 776e5c31af7Sopenharmony_ciTo create a command pool, call: 777e5c31af7Sopenharmony_ci 778e5c31af7Sopenharmony_ci\include::\{generated}/api/protos/vkCreateCommandPool.adoc[] 779e5c31af7Sopenharmony_ci---- 780e5c31af7Sopenharmony_ci 781e5c31af7Sopenharmony_ciNote that each autogenerated command, enumeration, flag, or structure 782e5c31af7Sopenharmony_cidefinition include file also defines a corresponding asciidoctor anchor 783e5c31af7Sopenharmony_ciwhich is the base name of the file. 784e5c31af7Sopenharmony_ciIn this case, the anchor is named `vkCreateCommandPool`. 785e5c31af7Sopenharmony_ci==== 786e5c31af7Sopenharmony_ci 787e5c31af7Sopenharmony_ci * pname:device is the logical device that the command pool is created on. 788e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkCommandPoolCreateInfo 789e5c31af7Sopenharmony_ci structure specifying the state of the command pool object. 790e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 791e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 792e5c31af7Sopenharmony_ci * pname:pCommandPool is a pointer to a slink:VkCommandPool handle in which 793e5c31af7Sopenharmony_ci the created pool is returned. 794e5c31af7Sopenharmony_ci 795e5c31af7Sopenharmony_ci[NOTE] 796e5c31af7Sopenharmony_ci.Guideline 797e5c31af7Sopenharmony_ci==== 798e5c31af7Sopenharmony_ciDescribe each command parameter in a separate bullet list item. 799e5c31af7Sopenharmony_ciin the same order that parameters appear in the command. 800e5c31af7Sopenharmony_ci 801e5c31af7Sopenharmony_ciEach description must begin with the parameter name. 802e5c31af7Sopenharmony_ciThis aids in extracting short descriptions of parameters for inclusion in 803e5c31af7Sopenharmony_ciannotated headers and similar documentation. 804e5c31af7Sopenharmony_ciMake sure to tag each parameter with the pname{cl} macro. 805e5c31af7Sopenharmony_ci 806e5c31af7Sopenharmony_ciStrive for compact notation, and in particular always try to use the 807e5c31af7Sopenharmony_ciphrasing "`pname{cl}param _is_`" rather than wordier forms such as 808e5c31af7Sopenharmony_ci"`pname{cl}param _specifies_`" or "`The pname{cl}param parameter 809e5c31af7Sopenharmony_cispecifies`". 810e5c31af7Sopenharmony_ciIn general there is no need to describe a parameter which is a Vulkan object 811e5c31af7Sopenharmony_cihandle *as* a handle; for example, say "`pname{cl}device is the logical 812e5c31af7Sopenharmony_cidevice`" rather than "`pname{cl}device is a handle to the logical device`". 813e5c31af7Sopenharmony_ciAn exception is object creation functions, where a pointer to a handle of 814e5c31af7Sopenharmony_cithe proper type is used to return the newly created object. 815e5c31af7Sopenharmony_ci==== 816e5c31af7Sopenharmony_ci 817e5c31af7Sopenharmony_ciThis is a general description of creating a command pool. 818e5c31af7Sopenharmony_ci 819e5c31af7Sopenharmony_ci.Valid Usage 820e5c31af7Sopenharmony_ci**** 821e5c31af7Sopenharmony_ci * [[VUID-vkCreateCommandPool-queueFamilyIndex-01937]] 822e5c31af7Sopenharmony_ci pname:pCreateInfo->queueFamilyIndex must: be the index of a queue family 823e5c31af7Sopenharmony_ci available in the logical device pname:device 824e5c31af7Sopenharmony_ci**** 825e5c31af7Sopenharmony_ci 826e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateCommandPool.adoc[] 827e5c31af7Sopenharmony_ci-- 828e5c31af7Sopenharmony_ci 829e5c31af7Sopenharmony_ci[NOTE] 830e5c31af7Sopenharmony_ci.Guideline 831e5c31af7Sopenharmony_ci==== 832e5c31af7Sopenharmony_ciIf there is a general description of the command, add it following the 833e5c31af7Sopenharmony_ciparameter descriptions: 834e5c31af7Sopenharmony_ci 835e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 836e5c31af7Sopenharmony_ci---- 837e5c31af7Sopenharmony_ciThis is a general description of creating a command pool. 838e5c31af7Sopenharmony_ci---- 839e5c31af7Sopenharmony_ci 840e5c31af7Sopenharmony_ciIf there are _explicit_ valid usage statements for the command, add them in 841e5c31af7Sopenharmony_citheir own valid usage block: 842e5c31af7Sopenharmony_ci 843e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 844e5c31af7Sopenharmony_ci---- 845e5c31af7Sopenharmony_ci.Valid Usage 846e5c31af7Sopenharmony_ci**** 847e5c31af7Sopenharmony_ci * [[VUID-vkCreateCommandPool-queueFamilyIndex-01937]] 848e5c31af7Sopenharmony_ci pname:pCreateInfo->queueFamilyIndex must: be the index of a queue family 849e5c31af7Sopenharmony_ci available in the logical device pname:device 850e5c31af7Sopenharmony_ci**** 851e5c31af7Sopenharmony_ci---- 852e5c31af7Sopenharmony_ci 853e5c31af7Sopenharmony_ciAlthough a valid usage ID is shown in the rendered example above, do not 854e5c31af7Sopenharmony_cispecify the ID when initially writing the statement, as 855e5c31af7Sopenharmony_ci<<sample-writing-explicit-vu, described below>>. 856e5c31af7Sopenharmony_ciVUIDs are normally assigned immediately prior to publication. 857e5c31af7Sopenharmony_ci 858e5c31af7Sopenharmony_ciSome parameter and member validation language for commands and structures is 859e5c31af7Sopenharmony_ci_implicit_ (autogenerated from `vk.xml`), and included from the 860e5c31af7Sopenharmony_ci`\{generated}/validity/` directories. 861e5c31af7Sopenharmony_ciAll Vulkan command and structure language should include the autogenerated 862e5c31af7Sopenharmony_cifile at the end of their descriptions. 863e5c31af7Sopenharmony_ciIt is harmless to include a nonexistent file, in the rare cases where no 864e5c31af7Sopenharmony_ciimplicit validity language exists. 865e5c31af7Sopenharmony_ci 866e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 867e5c31af7Sopenharmony_ci---- 868e5c31af7Sopenharmony_ci\include::\{generated}/validity/protos/vkCreateCommandPool.adoc[] 869e5c31af7Sopenharmony_ci{blank}-- 870e5c31af7Sopenharmony_ci---- 871e5c31af7Sopenharmony_ci 872e5c31af7Sopenharmony_ciClose the open block surrounding the command description after the implicit 873e5c31af7Sopenharmony_civalidity include. 874e5c31af7Sopenharmony_ciAll content within the block will be extracted for the corresponding 875e5c31af7Sopenharmony_cireference page. 876e5c31af7Sopenharmony_ci 877e5c31af7Sopenharmony_ciOpen blocks delimiting reference page content should not themselves contain 878e5c31af7Sopenharmony_cisection headers, as asciidoctor cannot render such nested content correctly. 879e5c31af7Sopenharmony_ciReference pages should in general be relatively short, so this limitation is 880e5c31af7Sopenharmony_cinot severe. 881e5c31af7Sopenharmony_ci 882e5c31af7Sopenharmony_ciStructures and enumerations first introduced as parameters of a command are 883e5c31af7Sopenharmony_cidescribed next. 884e5c31af7Sopenharmony_ci==== 885e5c31af7Sopenharmony_ci 886e5c31af7Sopenharmony_ci[open,refpage='VkCommandPoolCreateInfo',desc='Structure specifying parameters of a newly created command pool',type='structs'] 887e5c31af7Sopenharmony_ci-- 888e5c31af7Sopenharmony_ciThe sname:VkCommandPoolCreateInfo structure is defined as: 889e5c31af7Sopenharmony_ci 890e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCommandPoolCreateInfo.adoc[] 891e5c31af7Sopenharmony_ci 892e5c31af7Sopenharmony_ci[NOTE] 893e5c31af7Sopenharmony_ci.Guideline 894e5c31af7Sopenharmony_ci==== 895e5c31af7Sopenharmony_ciBegin the structure description with an open block delimiting the contents 896e5c31af7Sopenharmony_cias a reference page, in the same fashion as described above for commands. 897e5c31af7Sopenharmony_ciThe open block contains several required attribute values, as described for 898e5c31af7Sopenharmony_ci<<writing-refpages, automatic extraction into a reference page>>. 899e5c31af7Sopenharmony_ci 900e5c31af7Sopenharmony_ciUse a short, active paragraph to introduce the structure, usually just "`The 901e5c31af7Sopenharmony_cisname:VkStructureName structure is defined as:`". 902e5c31af7Sopenharmony_ci 903e5c31af7Sopenharmony_ciAfter the description, include the autogenerated definition for the 904e5c31af7Sopenharmony_cistructure from the `\{generated}/api/structs/` directory: 905e5c31af7Sopenharmony_ci 906e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 907e5c31af7Sopenharmony_ci---- 908e5c31af7Sopenharmony_ci[open,refpage='VkCommandPoolCreateInfo',desc='Structure specifying parameters of a newly created command pool',type='structs'] 909e5c31af7Sopenharmony_ci{blank}-- 910e5c31af7Sopenharmony_ci 911e5c31af7Sopenharmony_ciThe sname:VkCommandPoolCreateInfo structure is defined as: 912e5c31af7Sopenharmony_ci 913e5c31af7Sopenharmony_ci\include::\{generated}/api/structs/VkCommandPoolCreateInfo.adoc[] 914e5c31af7Sopenharmony_ci---- 915e5c31af7Sopenharmony_ci==== 916e5c31af7Sopenharmony_ci 917e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 918e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 919e5c31af7Sopenharmony_ci structure. 920e5c31af7Sopenharmony_ci+ 921e5c31af7Sopenharmony_ci-- 922e5c31af7Sopenharmony_ciThis demonstrates how to create a continuation paragraph in a member 923e5c31af7Sopenharmony_cidescription. 924e5c31af7Sopenharmony_ciThis paragraph is not present in the actual specification the example is 925e5c31af7Sopenharmony_cibased on. 926e5c31af7Sopenharmony_ci-- 927e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkCommandPoolCreateFlagBits indicating 928e5c31af7Sopenharmony_ci usage behavior for the pool and command buffers allocated from it. 929e5c31af7Sopenharmony_ci * pname:queueFamilyIndex designates a queue family as described in section 930e5c31af7Sopenharmony_ci <<devsandqueues-queueprops,Queue Family Properties>>. 931e5c31af7Sopenharmony_ci All command buffers allocated from this command pool must: be submitted 932e5c31af7Sopenharmony_ci on queues from the same queue family. 933e5c31af7Sopenharmony_ci 934e5c31af7Sopenharmony_ci[NOTE] 935e5c31af7Sopenharmony_ci.Guideline 936e5c31af7Sopenharmony_ci==== 937e5c31af7Sopenharmony_ciEach structure member is described in a separate bullet list item. 938e5c31af7Sopenharmony_ciFor structures with pname:sType and pname:pNext members, there is standard 939e5c31af7Sopenharmony_ciboilerplate for their descriptions. 940e5c31af7Sopenharmony_ciDescriptions of other members of the structure follow. 941e5c31af7Sopenharmony_ci 942e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 943e5c31af7Sopenharmony_ci---- 944e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 945e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 946e5c31af7Sopenharmony_ci structure. 947e5c31af7Sopenharmony_ci+ 948e5c31af7Sopenharmony_ci{blank}-- 949e5c31af7Sopenharmony_ciThis demonstrates how to create a continuation paragraph in a member 950e5c31af7Sopenharmony_cidescription. 951e5c31af7Sopenharmony_ciThis paragraph is not present in the actual specification the example is 952e5c31af7Sopenharmony_cibased on. 953e5c31af7Sopenharmony_ci{blank}-- 954e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkCommandPoolCreateFlagBits indicating 955e5c31af7Sopenharmony_ci usage behavior for the pool and command buffers allocated from it. 956e5c31af7Sopenharmony_ci * pname:queueFamilyIndex designates a queue family as described in section 957e5c31af7Sopenharmony_ci <<devsandqueues-queueprops,Queue Family Properties>>. 958e5c31af7Sopenharmony_ci All command buffers allocated from this command pool must: be submitted 959e5c31af7Sopenharmony_ci on queues from the same queue family. 960e5c31af7Sopenharmony_ci---- 961e5c31af7Sopenharmony_ci 962e5c31af7Sopenharmony_ciThese entries should be short and functional, without describing details of 963e5c31af7Sopenharmony_cie.g. new enumerant values, function of individual parameter settings, etc. 964e5c31af7Sopenharmony_ciThey can refer to other types using the appropriate *link: macros or to 965e5c31af7Sopenharmony_cirelated sections of the specification using asciidoctor xrefs. 966e5c31af7Sopenharmony_ci 967e5c31af7Sopenharmony_ciIn rare cases, a member description will cover multiple paragraphs. 968e5c31af7Sopenharmony_ciIn these cases the normal list nesting and indentation guidelines cannot be 969e5c31af7Sopenharmony_ciapplied due to limitations of the asciidoctor parser. 970e5c31af7Sopenharmony_ciIt is usually best to append a continuation block following the first 971e5c31af7Sopenharmony_ciparagraph of such a list item, as shown for pname:pNext above. 972e5c31af7Sopenharmony_ci 973e5c31af7Sopenharmony_ciAdd general descriptions of the structure, if any, following the member 974e5c31af7Sopenharmony_cidescriptions. 975e5c31af7Sopenharmony_ciNo general description is shown in this example. 976e5c31af7Sopenharmony_ci==== 977e5c31af7Sopenharmony_ci 978e5c31af7Sopenharmony_ci.Valid Usage 979e5c31af7Sopenharmony_ci**** 980e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 981e5c31af7Sopenharmony_ci * [[VUID-VkCommandPoolCreateInfo-flags-02860]] 982e5c31af7Sopenharmony_ci If the <<features-protectedMemory, pname:protectedMemory>> feature is 983e5c31af7Sopenharmony_ci not enabled, the ename:VK_COMMAND_POOL_CREATE_PROTECTED_BIT bit of 984e5c31af7Sopenharmony_ci pname:flags must: not be set 985e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 986e5c31af7Sopenharmony_ci**** 987e5c31af7Sopenharmony_ci 988e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCommandPoolCreateInfo.adoc[] 989e5c31af7Sopenharmony_ci-- 990e5c31af7Sopenharmony_ci 991e5c31af7Sopenharmony_ci[NOTE] 992e5c31af7Sopenharmony_ci.Guideline 993e5c31af7Sopenharmony_ci==== 994e5c31af7Sopenharmony_ciAdd explicit valid usage statements (if any) and the implicit autovalidity 995e5c31af7Sopenharmony_ciinclude in the same fashion as described for commands above, then close the 996e5c31af7Sopenharmony_ciopen block. 997e5c31af7Sopenharmony_ci 998e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 999e5c31af7Sopenharmony_ci---- 1000e5c31af7Sopenharmony_ci.Valid Usage 1001e5c31af7Sopenharmony_ci**** 1002e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 1003e5c31af7Sopenharmony_ci * [[VUID-VkCommandPoolCreateInfo-flags-02860]] 1004e5c31af7Sopenharmony_ci If the <<features-protectedMemory, pname:protectedMemory>> feature is 1005e5c31af7Sopenharmony_ci not enabled, the ename:VK_COMMAND_POOL_CREATE_PROTECTED_BIT bit of 1006e5c31af7Sopenharmony_ci pname:flags must: not be set 1007e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 1008e5c31af7Sopenharmony_ci**** 1009e5c31af7Sopenharmony_ci 1010e5c31af7Sopenharmony_ci\include::\{generated}/validity/structs/VkCommandPoolCreateInfo.adoc[] 1011e5c31af7Sopenharmony_ci{blank}-- 1012e5c31af7Sopenharmony_ci---- 1013e5c31af7Sopenharmony_ci==== 1014e5c31af7Sopenharmony_ci 1015e5c31af7Sopenharmony_ci[open,refpage='VkCommandPoolCreateFlagBits',desc='Bitmask specifying usage behavior for a command pool',type='enums'] 1016e5c31af7Sopenharmony_ci-- 1017e5c31af7Sopenharmony_ciBits which can: be set in slink:VkCommandPoolCreateInfo::pname:flags to 1018e5c31af7Sopenharmony_cispecify usage behavior for a command pool are: 1019e5c31af7Sopenharmony_ci 1020e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCommandPoolCreateFlagBits.adoc[] 1021e5c31af7Sopenharmony_ci 1022e5c31af7Sopenharmony_ci[NOTE] 1023e5c31af7Sopenharmony_ci.Guideline 1024e5c31af7Sopenharmony_ci==== 1025e5c31af7Sopenharmony_ciBegin an enumerated type description with an open block delimiting the 1026e5c31af7Sopenharmony_cicontents as a reference page, in the same fashion as described above for 1027e5c31af7Sopenharmony_cicommands and structures. 1028e5c31af7Sopenharmony_ci 1029e5c31af7Sopenharmony_ciUse boilerplate language similar to that above to introduce the type. 1030e5c31af7Sopenharmony_ci 1031e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1032e5c31af7Sopenharmony_ci---- 1033e5c31af7Sopenharmony_ci[open,refpage='VkCommandPoolCreateFlagBits',desc='Bitmask specifying usage behavior for a command pool',type='enums'] 1034e5c31af7Sopenharmony_ci{blank}-- 1035e5c31af7Sopenharmony_ciBits which can: be set in slink:VkCommandPoolCreateInfo::pname:flags to 1036e5c31af7Sopenharmony_cispecify usage behavior for a command pool are: 1037e5c31af7Sopenharmony_ci 1038e5c31af7Sopenharmony_ci\include::\{generated}/api/enums/VkCommandPoolCreateFlagBits.adoc[] 1039e5c31af7Sopenharmony_ci---- 1040e5c31af7Sopenharmony_ci==== 1041e5c31af7Sopenharmony_ci 1042e5c31af7Sopenharmony_ci * ename:VK_COMMAND_POOL_CREATE_TRANSIENT_BIT specifies that command 1043e5c31af7Sopenharmony_ci buffers allocated from the pool will be short-lived, meaning that they 1044e5c31af7Sopenharmony_ci will be reset or freed in a relatively short timeframe. 1045e5c31af7Sopenharmony_ci This flag may: be used by the implementation to control memory 1046e5c31af7Sopenharmony_ci allocation behavior within the pool. 1047e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 1048e5c31af7Sopenharmony_ci * ename:VK_COMMAND_POOL_CREATE_PROTECTED_BIT specifies that command 1049e5c31af7Sopenharmony_ci buffers allocated from the pool are protected command buffers. 1050e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 1051e5c31af7Sopenharmony_ci-- 1052e5c31af7Sopenharmony_ci 1053e5c31af7Sopenharmony_ci[NOTE] 1054e5c31af7Sopenharmony_ci.Guideline 1055e5c31af7Sopenharmony_ci==== 1056e5c31af7Sopenharmony_ciEach enumerant in the enumerated type is described in a separate bullet list 1057e5c31af7Sopenharmony_ciitem. 1058e5c31af7Sopenharmony_ciMake sure to protect enumerants added to the type by extensions or future 1059e5c31af7Sopenharmony_cicore versions with asciidoctor conditionals. 1060e5c31af7Sopenharmony_ciClose the open block after all enumerants are described. 1061e5c31af7Sopenharmony_ci 1062e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1063e5c31af7Sopenharmony_ci---- 1064e5c31af7Sopenharmony_ci * ename:VK_COMMAND_POOL_CREATE_TRANSIENT_BIT specifies that command 1065e5c31af7Sopenharmony_ci buffers allocated from the pool will be short-lived, meaning that they 1066e5c31af7Sopenharmony_ci will be reset or freed in a relatively short timeframe. 1067e5c31af7Sopenharmony_ci This flag may: be used by the implementation to control memory 1068e5c31af7Sopenharmony_ci allocation behavior within the pool. 1069e5c31af7Sopenharmony_ci\ifdef::VK_VERSION_1_1[] 1070e5c31af7Sopenharmony_ci * ename:VK_COMMAND_POOL_CREATE_PROTECTED_BIT specifies that command 1071e5c31af7Sopenharmony_ci buffers allocated from the pool are protected command buffers. 1072e5c31af7Sopenharmony_ci\endif::VK_VERSION_1_1[] 1073e5c31af7Sopenharmony_ci{blank}-- 1074e5c31af7Sopenharmony_ci---- 1075e5c31af7Sopenharmony_ci==== 1076e5c31af7Sopenharmony_ci 1077e5c31af7Sopenharmony_ci 1078e5c31af7Sopenharmony_ci[[sample-writing-explicit-vu]] 1079e5c31af7Sopenharmony_ci== Writing Explicit Valid Usage Statements 1080e5c31af7Sopenharmony_ci 1081e5c31af7Sopenharmony_ciExplicit valid usage statements must be written at a point that all 1082e5c31af7Sopenharmony_ciinformation needed to evaluate them is known. 1083e5c31af7Sopenharmony_ciIn particular, if validity of structure parameters depends on other 1084e5c31af7Sopenharmony_ciparameters of a command that structure is passed to, such valid usage 1085e5c31af7Sopenharmony_cistatements must be written for the command, rather than the structure. 1086e5c31af7Sopenharmony_ci 1087e5c31af7Sopenharmony_ciEach explicit valid usage statement should be a single, self-contained 1088e5c31af7Sopenharmony_ciassertion, possibly involving multiple subexpressions or parameters. 1089e5c31af7Sopenharmony_ciFor example, instead of writing "`width, height, and depth must: all be 1090e5c31af7Sopenharmony_cigreater than zero`", write each condition as a separate statement. 1091e5c31af7Sopenharmony_ciIn contrast, "`width {times} height must: be less than 1024`" is a single 1092e5c31af7Sopenharmony_ciassertion involving multiple parameters. 1093e5c31af7Sopenharmony_ci 1094e5c31af7Sopenharmony_ciDo not use "`unless`" to call out exceptions - always write valid usage 1095e5c31af7Sopenharmony_cistatements of the form "`if _A_ then _B_`". 1096e5c31af7Sopenharmony_ciThis may result in harder to read statements in a few cases, but maintains 1097e5c31af7Sopenharmony_ciconsistency. 1098e5c31af7Sopenharmony_ciIn many cases, it may lead to a simpler VU statement, or splitting one large 1099e5c31af7Sopenharmony_ciVU into multiple new ones. 1100e5c31af7Sopenharmony_ci 1101e5c31af7Sopenharmony_ciA valid usage statement may used nested bullet lists or other asciidoc 1102e5c31af7Sopenharmony_cimarkup. 1103e5c31af7Sopenharmony_ci 1104e5c31af7Sopenharmony_ciBe clear on the distinction between a "`valid pointer`" and a "`pointer to a 1105e5c31af7Sopenharmony_civalid object`" when writing valid usage statements. 1106e5c31af7Sopenharmony_ciSee the "`Valid Usage`" section of the Vulkan Specification, and 1107e5c31af7Sopenharmony_ciparticularly the "`Valid Usage for Pointers`" section. 1108e5c31af7Sopenharmony_ci 1109e5c31af7Sopenharmony_ciWhen clauses in valid usage statements apply only when specific extensions 1110e5c31af7Sopenharmony_ciand/or core API versions are enabled at runtime, use appropriate asciidoctor 1111e5c31af7Sopenharmony_ciconditionals around such clauses. 1112e5c31af7Sopenharmony_ci 1113e5c31af7Sopenharmony_ci[NOTE] 1114e5c31af7Sopenharmony_ci==== 1115e5c31af7Sopenharmony_ciPrior to specification update 1.3.255, there were stronger restrictions on 1116e5c31af7Sopenharmony_ciplacement of asciidoctor conditionals that have been relaxed, allowing 1117e5c31af7Sopenharmony_ciwriting such valid usage statements in a more natural manner and with less 1118e5c31af7Sopenharmony_ciduplication of language. 1119e5c31af7Sopenharmony_ci==== 1120e5c31af7Sopenharmony_ci 1121e5c31af7Sopenharmony_ciExplicit valid usage statements must be assigned Valid Usage ID tags before 1122e5c31af7Sopenharmony_cipublication. 1123e5c31af7Sopenharmony_ciThis process is described in the <<vuid, Valid Usage ID Tags>> appendix, but 1124e5c31af7Sopenharmony_ciis normally performed only when preparing to integrate functionality into 1125e5c31af7Sopenharmony_cithe Vulkan Specification prior to publication. 1126e5c31af7Sopenharmony_ciIt is something authors of new functionality should be aware of, but are not 1127e5c31af7Sopenharmony_cithemselves responsible for. 1128e5c31af7Sopenharmony_ciFor example, when writing the explicit 1129e5c31af7Sopenharmony_ciflink:vkCreateCommandPool::pname:queueFamilyIndex valid usage statement 1130e5c31af7Sopenharmony_cishown above, the tag 1131e5c31af7Sopenharmony_ci 1132e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1133e5c31af7Sopenharmony_ci---- 1134e5c31af7Sopenharmony_ci[[VUID-vkCreateCommandPool-queueFamilyIndex-01937]] 1135e5c31af7Sopenharmony_ci---- 1136e5c31af7Sopenharmony_ci 1137e5c31af7Sopenharmony_ciwas inserted by a script, not the original author. 1138e5c31af7Sopenharmony_ci 1139e5c31af7Sopenharmony_ci[NOTE] 1140e5c31af7Sopenharmony_ci.Guideline 1141e5c31af7Sopenharmony_ci==== 1142e5c31af7Sopenharmony_ciIf the same set of valid usage statements are going to be common to multiple 1143e5c31af7Sopenharmony_cicommands or structures, these should be extracted into a separate file under 1144e5c31af7Sopenharmony_ci`chapters/commonvalidity/`. 1145e5c31af7Sopenharmony_ciThe file name should be short but to the point (e.g. `draw_common.adoc`), 1146e5c31af7Sopenharmony_ciand then the file can be included in the relevant API features using 1147e5c31af7Sopenharmony_cistandard include syntax: 1148e5c31af7Sopenharmony_ci 1149e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1150e5c31af7Sopenharmony_ci---- 1151e5c31af7Sopenharmony_ci.Valid Usage 1152e5c31af7Sopenharmony_ci**** 1153e5c31af7Sopenharmony_ci\include::\{chapters}/commonvalidity/draw_common.adoc[] 1154e5c31af7Sopenharmony_ci\include::\{chapters}/commonvalidity/draw_vertex_binding.adoc[] 1155e5c31af7Sopenharmony_ci * [[VUID-vkCmdDrawIndirectByteCountEXT-transformFeedback-02287]] 1156e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackFeaturesEXT::pname:transformFeedback 1157e5c31af7Sopenharmony_ci must: be enabled 1158e5c31af7Sopenharmony_ci**** 1159e5c31af7Sopenharmony_ci---- 1160e5c31af7Sopenharmony_ci 1161e5c31af7Sopenharmony_ciCommon VU includes should appear before individual VUs for consistency. 1162e5c31af7Sopenharmony_ci 1163e5c31af7Sopenharmony_ciThe file itself should be structured with the comment `// Common Valid 1164e5c31af7Sopenharmony_ciUsage` used as a delimiter at the start and end of the file, with a comment 1165e5c31af7Sopenharmony_cidescribing in more detail where these are included, and then the valid usage 1166e5c31af7Sopenharmony_cistatement bullets outside of a valid usage block. 1167e5c31af7Sopenharmony_ciFor example: 1168e5c31af7Sopenharmony_ci 1169e5c31af7Sopenharmony_ci[source,asciidoc] 1170e5c31af7Sopenharmony_ci---- 1171e5c31af7Sopenharmony_ci// Common Valid Usage 1172e5c31af7Sopenharmony_ci// Common to drawing commands that consume vertex binding state 1173e5c31af7Sopenharmony_ci * All vertex input bindings accessed via vertex input variables declared 1174e5c31af7Sopenharmony_ci in the vertex shader entry point's interface must: have valid buffers 1175e5c31af7Sopenharmony_ci bound 1176e5c31af7Sopenharmony_ci * For a given vertex buffer binding, any attribute data fetched must: be 1177e5c31af7Sopenharmony_ci entirely contained within the corresponding vertex buffer binding, as 1178e5c31af7Sopenharmony_ci described in <<fxvertex-input>> 1179e5c31af7Sopenharmony_ci// Common Valid Usage 1180e5c31af7Sopenharmony_ci---- 1181e5c31af7Sopenharmony_ci 1182e5c31af7Sopenharmony_ciFinally, the original feature section needs to define the `:refpage:` 1183e5c31af7Sopenharmony_ciattribute to match the name of the feature, as this is used to correctly 1184e5c31af7Sopenharmony_cigenerate links to expanded common valid usage statements in the built 1185e5c31af7Sopenharmony_cispecification. 1186e5c31af7Sopenharmony_ci 1187e5c31af7Sopenharmony_ci[source,asciidoc] 1188e5c31af7Sopenharmony_ci---- 1189e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndirectByteCountEXT',desc='Draw primitives where the vertex count is derived from the counter byte value in the counter buffer',type='protos'] 1190e5c31af7Sopenharmony_ci-- 1191e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndirectByteCountEXT 1192e5c31af7Sopenharmony_ci---- 1193e5c31af7Sopenharmony_ci 1194e5c31af7Sopenharmony_ciIn general, this methodology should be preferred over any other method of 1195e5c31af7Sopenharmony_ciconsolidation - e.g. calling out a block of common valid usage statements, 1196e5c31af7Sopenharmony_cior referencing the valid usage statements of another command. 1197e5c31af7Sopenharmony_ciHowever, for cases where the boilerplate of setting this up creates more 1198e5c31af7Sopenharmony_citext than a simple copy paste (e.g. only two commands consume a single 1199e5c31af7Sopenharmony_civalid usage statement), the original VUs can be left intact. 1200e5c31af7Sopenharmony_ci==== 1201e5c31af7Sopenharmony_ci 1202e5c31af7Sopenharmony_ci 1203e5c31af7Sopenharmony_ci[[writing-empty-enumerations]] 1204e5c31af7Sopenharmony_ci== Markup for Empty Enumerated Types 1205e5c31af7Sopenharmony_ci 1206e5c31af7Sopenharmony_ciSometimes an enumerated type has all values defined by extensions, and each 1207e5c31af7Sopenharmony_cienumerated value defined by the type will be surrounded by an asciidoctor 1208e5c31af7Sopenharmony_ciconditional for the corresponding extension. 1209e5c31af7Sopenharmony_ciWhen a specification is built without any of those extensions enabled, the 1210e5c31af7Sopenharmony_citype should still be included, even though it is empty. 1211e5c31af7Sopenharmony_ciIn this case, the enumerated value descriptions must be followed by one 1212e5c31af7Sopenharmony_ciadditional conditional section which is only included when *none* of the 1213e5c31af7Sopenharmony_cirelevant extensions are enabled. 1214e5c31af7Sopenharmony_ci 1215e5c31af7Sopenharmony_ciFor example, the relevant part of the 1216e5c31af7Sopenharmony_ciename:VkDescriptorSetLayoutCreateFlagBits description, whose only value is 1217e5c31af7Sopenharmony_cidefined by an extension, will look like this: 1218e5c31af7Sopenharmony_ci 1219e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1220e5c31af7Sopenharmony_ci---- 1221e5c31af7Sopenharmony_ci\include::\{generated}/api/enums/VkDescriptorSetLayoutCreateFlagBits.adoc[] 1222e5c31af7Sopenharmony_ci 1223e5c31af7Sopenharmony_ci\ifdef::VK_KHR_push_descriptor[] 1224e5c31af7Sopenharmony_ci * ename:VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR specifies 1225e5c31af7Sopenharmony_ci that descriptor sets must: not be allocated using this layout, and 1226e5c31af7Sopenharmony_ci descriptors are instead pushed by flink:vkCmdPushDescriptorSetKHR. 1227e5c31af7Sopenharmony_ci\endif::VK_KHR_push_descriptor[] 1228e5c31af7Sopenharmony_ci 1229e5c31af7Sopenharmony_ci\ifndef::VK_KHR_push_descriptor[] 1230e5c31af7Sopenharmony_ci[NOTE] 1231e5c31af7Sopenharmony_ci.Note 1232e5c31af7Sopenharmony_ci==== 1233e5c31af7Sopenharmony_ciAll bits for this type are defined by extensions, and none of those 1234e5c31af7Sopenharmony_ciextensions are enabled in this build of the specification. 1235e5c31af7Sopenharmony_ci==== 1236e5c31af7Sopenharmony_ci\endif::VK_KHR_push_descriptor[] 1237e5c31af7Sopenharmony_ci---- 1238e5c31af7Sopenharmony_ci 1239e5c31af7Sopenharmony_ci 1240e5c31af7Sopenharmony_ci[[writing-refpages]] 1241e5c31af7Sopenharmony_ci== Markup for Automatic Reference Page Extraction 1242e5c31af7Sopenharmony_ci 1243e5c31af7Sopenharmony_ciThe Vulkan reference pages are (mostly) extracted from corresponding 1244e5c31af7Sopenharmony_cisections of the API Specification. 1245e5c31af7Sopenharmony_ciThis requires that the markup and writing conventions described above be 1246e5c31af7Sopenharmony_ciadhered to rigidly. 1247e5c31af7Sopenharmony_ci 1248e5c31af7Sopenharmony_ciThe extraction scripts for a given page rely on the existence of an 1249e5c31af7Sopenharmony_ciasciidoctor `open` block surrounding markup describing that page, with 1250e5c31af7Sopenharmony_ciattributes used to specify properties of the reference page. 1251e5c31af7Sopenharmony_ciAdditional heuristics and non-asciidoctor tags, described below, are used to 1252e5c31af7Sopenharmony_ciidentify subsections of a reference page in some cases. 1253e5c31af7Sopenharmony_ci 1254e5c31af7Sopenharmony_ciIn general the open block introduction will look like: 1255e5c31af7Sopenharmony_ci 1256e5c31af7Sopenharmony_ci[source,asciidoc] 1257e5c31af7Sopenharmony_ci---- 1258e5c31af7Sopenharmony_ci[open,refpage='name',desc='short description',type='pagetype',alias='alias',anchor='anchor',xrefs='xrefs'] 1259e5c31af7Sopenharmony_ci-- 1260e5c31af7Sopenharmony_ci---- 1261e5c31af7Sopenharmony_ci 1262e5c31af7Sopenharmony_ciAttributes which can be set on the block are: 1263e5c31af7Sopenharmony_ci 1264e5c31af7Sopenharmony_ci * *refpage* - the name of the reference page, e.g. the Vulkan interface 1265e5c31af7Sopenharmony_ci (command, structure, enumerant, handle, etc.) name. This attribute is 1266e5c31af7Sopenharmony_ci required. 1267e5c31af7Sopenharmony_ci * *desc* - short description / summary of the page, used in the page 1268e5c31af7Sopenharmony_ci title. 1269e5c31af7Sopenharmony_ci This attribute is required. 1270e5c31af7Sopenharmony_ci * *type* - type of the interface, which must match the directory name 1271e5c31af7Sopenharmony_ci following `api/` in the interface `include::` line within the block, and 1272e5c31af7Sopenharmony_ci must be one of `basetypes`, `defines`, `enums`, `flags`, `funcpointers`, 1273e5c31af7Sopenharmony_ci `handles`, `protos`, or `structs`; or the non-API block types `feature`, 1274e5c31af7Sopenharmony_ci `freeform`. or `spirv`. 1275e5c31af7Sopenharmony_ci This attribute is required. 1276e5c31af7Sopenharmony_ci * *alias* - list of comma-separated names of other API entities which this 1277e5c31af7Sopenharmony_ci refpage also describes. This is used when an API is promoted and the 1278e5c31af7Sopenharmony_ci refpage block describes both the old and promoted APIs. 1279e5c31af7Sopenharmony_ci This attribute is optional. 1280e5c31af7Sopenharmony_ci * *anchor* - anchor name at which this reference page is fully described 1281e5c31af7Sopenharmony_ci in the API specification document. 1282e5c31af7Sopenharmony_ci This attribute is optional except for the non-API block types, which do 1283e5c31af7Sopenharmony_ci not correspond to Vulkan APIs. 1284e5c31af7Sopenharmony_ci * *xrefs* - list of whitespace-separated names of other reference pages 1285e5c31af7Sopenharmony_ci which should be added to the `See Also` section of this page. 1286e5c31af7Sopenharmony_ci Most cross-references are automatically generated based on the immediate 1287e5c31af7Sopenharmony_ci dependency information in `vk.xml`, but in some cases, such as referring 1288e5c31af7Sopenharmony_ci between `*FlagBits` and `*Flags` types, this additional tagging is 1289e5c31af7Sopenharmony_ci useful. 1290e5c31af7Sopenharmony_ci This attribute is optional. 1291e5c31af7Sopenharmony_ci 1292e5c31af7Sopenharmony_ciAttributes of the open block must be written in this format, using single 1293e5c31af7Sopenharmony_ciquotes as delimiters (even though asciidoctor markup also allows double 1294e5c31af7Sopenharmony_ciquotes), and escape single quotes in e.g. the *desc* attribute value with 1295e5c31af7Sopenharmony_cibackquotes. 1296e5c31af7Sopenharmony_ci 1297e5c31af7Sopenharmony_ciAfter the open block is started, the following markup should be provided: 1298e5c31af7Sopenharmony_ci 1299e5c31af7Sopenharmony_ci * A single paragraph of text describing the definition of the interface. 1300e5c31af7Sopenharmony_ci This paragraph is optional, but strongly recommended. 1301e5c31af7Sopenharmony_ci * The `include` line for the interface, which must be consistent with the 1302e5c31af7Sopenharmony_ci page name and type in the open block attributes. 1303e5c31af7Sopenharmony_ci This paragraph is required. 1304e5c31af7Sopenharmony_ci * A bullet list describing function parameters, structure members, 1305e5c31af7Sopenharmony_ci enumerants in an enumerated type, etc. 1306e5c31af7Sopenharmony_ci This list should contain no empty lines, as the extraction script 1307e5c31af7Sopenharmony_ci classifies the uninterrupted block of text following the `include` 1308e5c31af7Sopenharmony_ci directive as the `Parameters` or `Members` section of the ref page. 1309e5c31af7Sopenharmony_ci This list is required, unless the interface has nothing to describe, 1310e5c31af7Sopenharmony_ci such as an empty structure or enumeration, or a function with no 1311e5c31af7Sopenharmony_ci parameters. 1312e5c31af7Sopenharmony_ci * Paragraphs of text making up the `Description` section of the ref page. 1313e5c31af7Sopenharmony_ci This section is optional. 1314e5c31af7Sopenharmony_ci If it is necessary due to constraints of asciidoctor markup to have an 1315e5c31af7Sopenharmony_ci empty line in the bullet list section, add a `// refBody` comment 1316e5c31af7Sopenharmony_ci immediately following the bullet list and preceding this section: 1317e5c31af7Sopenharmony_ci+ 1318e5c31af7Sopenharmony_ci[source,asciidoc] 1319e5c31af7Sopenharmony_ci---- 1320e5c31af7Sopenharmony_ci// refBody 1321e5c31af7Sopenharmony_ci---- 1322e5c31af7Sopenharmony_ci+ 1323e5c31af7Sopenharmony_ciThere are no examples of this usage in the Vulkan 1.2.192 Specification, 1324e5c31af7Sopenharmony_cibut it has been needed in the past and may again in the future. 1325e5c31af7Sopenharmony_ci+ 1326e5c31af7Sopenharmony_ci * An explicit valid usage block. 1327e5c31af7Sopenharmony_ci This block is required if the interface has such valid usage 1328e5c31af7Sopenharmony_ci constraints. 1329e5c31af7Sopenharmony_ci * The `include` line for the implicit valid usage block. 1330e5c31af7Sopenharmony_ci This line is required for commands and structures, but not for 1331e5c31af7Sopenharmony_ci interfaces such as enumerated types, which do not have implicit valid 1332e5c31af7Sopenharmony_ci usage blocks. 1333e5c31af7Sopenharmony_ci * Finally, a two-dash asciidoctor delimiter closing the open block: 1334e5c31af7Sopenharmony_ci+ 1335e5c31af7Sopenharmony_ci[source,asciidoc] 1336e5c31af7Sopenharmony_ci---- 1337e5c31af7Sopenharmony_ci-- 1338e5c31af7Sopenharmony_ci---- 1339e5c31af7Sopenharmony_ci 1340e5c31af7Sopenharmony_ciAll elements specifying an interface name (open block `refpage` attributes, 1341e5c31af7Sopenharmony_ciinterface `include` lines, and validity `include` lines) must use the same 1342e5c31af7Sopenharmony_ciinterface name, if present. 1343e5c31af7Sopenharmony_ciOtherwise the extraction script is either unable to extract that page, or 1344e5c31af7Sopenharmony_ciwill extract the wrong text - and the language will be structurally 1345e5c31af7Sopenharmony_ciincorrect, as well. 1346e5c31af7Sopenharmony_ciThe extraction process is somewhat fragile, so care should be taken and the 1347e5c31af7Sopenharmony_ciresults of reference page extraction verified after making changes to that 1348e5c31af7Sopenharmony_ciportion of the specification source. 1349e5c31af7Sopenharmony_ci 1350e5c31af7Sopenharmony_ciContent that should only appear in reference pages, such as 1351e5c31af7Sopenharmony_cideveloper-oriented guidelines for reference pages describing extensions, may 1352e5c31af7Sopenharmony_cibe conditionally included in the specification as follows: 1353e5c31af7Sopenharmony_ci 1354e5c31af7Sopenharmony_ci[source,asciidoc,subs=attributes+] 1355e5c31af7Sopenharmony_ci---- 1356e5c31af7Sopenharmony_ci\ifdef::isrefpage[] 1357e5c31af7Sopenharmony_ci 1358e5c31af7Sopenharmony_ci=== Refpage-Only Section 1359e5c31af7Sopenharmony_ci 1360e5c31af7Sopenharmony_ci*This section will appear only when generating an extension refpage, 1361e5c31af7Sopenharmony_cibut not in the specification extensions appendix.* 1362e5c31af7Sopenharmony_ci 1363e5c31af7Sopenharmony_ci\endif::isrefpage[] 1364e5c31af7Sopenharmony_ci---- 1365