1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[naming]] 6e5c31af7Sopenharmony_ci= API Naming Conventions 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciIdentifiers in the Vulkan API (e.g. types, parameters, constants, etc.) all 9e5c31af7Sopenharmony_cifollow a set of naming rules, providing a consistent scheme for developers. 10e5c31af7Sopenharmony_ci 11e5c31af7Sopenharmony_ciThe Vulkan C API uses prefixes as an implicit namespace control mechanism. 12e5c31af7Sopenharmony_ciBindings to other languages can choose not to use these prefixes if the 13e5c31af7Sopenharmony_cilanguage provides an explicit namespace mechanism. 14e5c31af7Sopenharmony_ci 15e5c31af7Sopenharmony_ci 16e5c31af7Sopenharmony_ci== General Naming Rules 17e5c31af7Sopenharmony_ci 18e5c31af7Sopenharmony_ciNames of identifiers should generally be written with full words, as a 19e5c31af7Sopenharmony_ciconcise description of what that identifier is. 20e5c31af7Sopenharmony_ciFor example, the type of a structure containing information about how to 21e5c31af7Sopenharmony_cicreate an instance is stext:VkInstanceCreateInfo. 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ciAbbreviations and prefixes are sometimes used in the API when they do not 24e5c31af7Sopenharmony_ciimpede clarity. 25e5c31af7Sopenharmony_ciAll abbreviations and prefixes used in the API must be approved by the 26e5c31af7Sopenharmony_ciVulkan working group, and be added to the <<naming-abbreviations,Common 27e5c31af7Sopenharmony_ciAbbreviations>> and <<naming-prefixes,Standard Prefixes>> sections, 28e5c31af7Sopenharmony_cirespectively. 29e5c31af7Sopenharmony_ciWhenever an approved abbreviation exists for a particular word, it should be 30e5c31af7Sopenharmony_ciused in place of the full word unless there is good reason not to. 31e5c31af7Sopenharmony_ci 32e5c31af7Sopenharmony_ciWhen a number is part of an identifier, it is treated as a word if it is a 33e5c31af7Sopenharmony_cistandalone number, such as the extension name token 34e5c31af7Sopenharmony_ciename:VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME for the 35e5c31af7Sopenharmony_ci`VK_KHR_get_memory_requirements2` extension. 36e5c31af7Sopenharmony_ciFor uses where the number is part of a common abbreviation such as etext:2D 37e5c31af7Sopenharmony_cior etext:R8B8`, the entire abbreviation is treated as a word. 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_ciifdef::editing-notes[] 40e5c31af7Sopenharmony_ci[NOTE] 41e5c31af7Sopenharmony_ci.editing-note 42e5c31af7Sopenharmony_ci==== 43e5c31af7Sopenharmony_ciUnfortunately, there is an internal inconsistency here between extension 44e5c31af7Sopenharmony_ciname strings, such as VK_KHR_get_memory_requirements2, and tokens encoding 45e5c31af7Sopenharmony_cithose names, such as ename:VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME. 46e5c31af7Sopenharmony_ci==== 47e5c31af7Sopenharmony_ciendif::editing-notes[] 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ci 50e5c31af7Sopenharmony_ci[[naming-preprocessor]] 51e5c31af7Sopenharmony_ci== Preprocessor Defines 52e5c31af7Sopenharmony_ci 53e5c31af7Sopenharmony_ciPreprocessor definitions include an underscore `_` as a delimiter between 54e5c31af7Sopenharmony_ciwords, with every character in upper case. 55e5c31af7Sopenharmony_ci 56e5c31af7Sopenharmony_ciEach definition is prefixed with `VK_`, followed by the name. 57e5c31af7Sopenharmony_ci 58e5c31af7Sopenharmony_ciThis rule applies to most declarations with the C Preprocessor's `#define` 59e5c31af7Sopenharmony_citoken, including macros and constants. 60e5c31af7Sopenharmony_ciThere are however a few exceptions: 61e5c31af7Sopenharmony_ci 62e5c31af7Sopenharmony_ci * The header guard for each header includes an additional underscore `_` 63e5c31af7Sopenharmony_ci at the end of the identifier. 64e5c31af7Sopenharmony_ci ** Example: `VULKAN_H_` 65e5c31af7Sopenharmony_ci * Definitions that denote the presence of an extension follow the 66e5c31af7Sopenharmony_ci <<extensions-naming-conventions-name-strings,extension name string 67e5c31af7Sopenharmony_ci convention>>. 68e5c31af7Sopenharmony_ci ** Example: `VK_KHR_sampler_mirror_clamp_to_edge` 69e5c31af7Sopenharmony_ci * Three `VKAPI_*` definitions are defined by the platform header to alias 70e5c31af7Sopenharmony_ci certain platform-specific identifiers related to calling conventions. 71e5c31af7Sopenharmony_ci ** Examples: `VKAPI_ATTR`, `VKAPI_CALL` and `VKAPI_PTR` 72e5c31af7Sopenharmony_ci * Preprocessor defines are occasionally used to create aliases between 73e5c31af7Sopenharmony_ci other Vulkan identifiers, which usually happens when something was 74e5c31af7Sopenharmony_ci originally misnamed. 75e5c31af7Sopenharmony_ci In these cases, the fixed name is added to the API, and the old name is 76e5c31af7Sopenharmony_ci made into an alias of that. 77e5c31af7Sopenharmony_ci In these cases, the name will be whatever the original misnamed 78e5c31af7Sopenharmony_ci identifier was. 79e5c31af7Sopenharmony_ci 80e5c31af7Sopenharmony_ci[source, c] 81e5c31af7Sopenharmony_ci.Example 82e5c31af7Sopenharmony_ci---- 83e5c31af7Sopenharmony_ci// VK_VERSION_MAJOR (Macro) 84e5c31af7Sopenharmony_ci#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) 85e5c31af7Sopenharmony_ci 86e5c31af7Sopenharmony_ci// VK_HEADER_VERSION (Base type) 87e5c31af7Sopenharmony_ci#define VK_HEADER_VERSION 10 88e5c31af7Sopenharmony_ci---- 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ci== Type Names 92e5c31af7Sopenharmony_ci 93e5c31af7Sopenharmony_ciType names are declared with no separator between words. 94e5c31af7Sopenharmony_ciEach word starts with a capital letter, and every other character in each 95e5c31af7Sopenharmony_ciword is lower case. 96e5c31af7Sopenharmony_ci 97e5c31af7Sopenharmony_ciEach type name is prefixed with `Vk`. 98e5c31af7Sopenharmony_ci 99e5c31af7Sopenharmony_ciThis rule applies to all type definitions except <<naming-funcpointers, 100e5c31af7Sopenharmony_cifunction pointer types>>, including struct and union types, handles, base 101e5c31af7Sopenharmony_citypedefs, and enumerant types. 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_ci[source, c] 104e5c31af7Sopenharmony_ci.Example 105e5c31af7Sopenharmony_ci---- 106e5c31af7Sopenharmony_ci// VkImage (Handle) 107e5c31af7Sopenharmony_ciVK_NONDISP_HANDLE(VkImage) 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_ci// VkFlags (Base type) 110e5c31af7Sopenharmony_citypedef uint32_t VkFlags; 111e5c31af7Sopenharmony_ci 112e5c31af7Sopenharmony_ci// VkResult (Enum type) 113e5c31af7Sopenharmony_citypedef enum VkResult { 114e5c31af7Sopenharmony_ci ... 115e5c31af7Sopenharmony_ci}; 116e5c31af7Sopenharmony_ci 117e5c31af7Sopenharmony_ci// VkApplicationInfo (Struct) 118e5c31af7Sopenharmony_citypedef struct VkApplicationInfo { 119e5c31af7Sopenharmony_ci ... 120e5c31af7Sopenharmony_ci} VkApplicationInfo; 121e5c31af7Sopenharmony_ci 122e5c31af7Sopenharmony_ci// VkClearColorValue (Union) 123e5c31af7Sopenharmony_citypedef union VkClearColorValue { 124e5c31af7Sopenharmony_ci ... 125e5c31af7Sopenharmony_ci} VkClearColorValue; 126e5c31af7Sopenharmony_ci---- 127e5c31af7Sopenharmony_ci 128e5c31af7Sopenharmony_ci 129e5c31af7Sopenharmony_ci[[naming-extension-structures]] 130e5c31af7Sopenharmony_ci=== Extending Structure Names 131e5c31af7Sopenharmony_ci 132e5c31af7Sopenharmony_ciStructures which extend a base structures through its pname:pNext chain 133e5c31af7Sopenharmony_cishould reflect the name of the base structure. 134e5c31af7Sopenharmony_ciCurrently there are two examples of such naming schemes. 135e5c31af7Sopenharmony_ci 136e5c31af7Sopenharmony_ciNew structures which add extended object creation parameters to a base 137e5c31af7Sopenharmony_cistructure should use this naming scheme: 138e5c31af7Sopenharmony_ci 139e5c31af7Sopenharmony_ci.Extended Object Information Structures 140e5c31af7Sopenharmony_ci[width="60%",options="header"] 141e5c31af7Sopenharmony_ci|==== 142e5c31af7Sopenharmony_ci| Base Structure Name | Extending Structure Name 143e5c31af7Sopenharmony_ci| `Vk__Object__CreateInfo` 144e5c31af7Sopenharmony_ci | `Vk__ObjectName__CreateInfo__Author__` 145e5c31af7Sopenharmony_ci|==== 146e5c31af7Sopenharmony_ci 147e5c31af7Sopenharmony_ci`_Object_` is the name of the object being created. 148e5c31af7Sopenharmony_ci`_Name_` is a short name for the extension or the new information added by 149e5c31af7Sopenharmony_cithat extension. 150e5c31af7Sopenharmony_ci`_Author_` is the author ID of the extension. 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ciNew structures which extend API queries, such as the 153e5c31af7Sopenharmony_ci`vkGetPhysicalDeviceFeatures2KHR` and `vkGetPhysicalDeviceProperties2KHR` 154e5c31af7Sopenharmony_cicommands defined by the `VK_KHR_get_physical_device_properties2` extension, 155e5c31af7Sopenharmony_cishould use this naming scheme: 156e5c31af7Sopenharmony_ci 157e5c31af7Sopenharmony_ci.Extended Query Structures 158e5c31af7Sopenharmony_ci[width="60%",options="header"] 159e5c31af7Sopenharmony_ci|==== 160e5c31af7Sopenharmony_ci| Base Structure Name | Extending Structure Name 161e5c31af7Sopenharmony_ci| `vkGetPhysicalDeviceFeatures2KHR` 162e5c31af7Sopenharmony_ci | `VkPhysicalDevice__Name__Features__Author__` 163e5c31af7Sopenharmony_ci| `vkGetPhysicalDeviceProperties2KHR` 164e5c31af7Sopenharmony_ci | `VkPhysicalDevice__Name__Properties__Author__` 165e5c31af7Sopenharmony_ci|==== 166e5c31af7Sopenharmony_ci 167e5c31af7Sopenharmony_ci`_Name_` is a short name for the extension, or for the new feature or 168e5c31af7Sopenharmony_ciproperty being queried, such as `Multiview` or `DiscardRectangle`. 169e5c31af7Sopenharmony_ci`_Author_` is the author ID of the extension. 170e5c31af7Sopenharmony_ci 171e5c31af7Sopenharmony_ci 172e5c31af7Sopenharmony_ci== Enumerant Names 173e5c31af7Sopenharmony_ci 174e5c31af7Sopenharmony_ciEnumerants include an underscore `_` as a delimiter between words, with 175e5c31af7Sopenharmony_cievery character in upper case. 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ciEach enumerant name is prefixed with `VK_`. 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ciEnumerants are prefixed with the exact name of the type it belongs to, 180e5c31af7Sopenharmony_ciconverted to the correct case (e.g. `VkStructureType` -> 181e5c31af7Sopenharmony_ci`VK_STRUCTURE_TYPE_*`). 182e5c31af7Sopenharmony_ci 183e5c31af7Sopenharmony_ciThis rule applies to all enumerants, with one exception. 184e5c31af7Sopenharmony_ci 185e5c31af7Sopenharmony_ci * The `VkResult` enumerants are split into two sub types: error and 186e5c31af7Sopenharmony_ci success codes. 187e5c31af7Sopenharmony_ci ** Success codes are not prefixed with anything other than `VK_`. 188e5c31af7Sopenharmony_ci ** Error codes are prefixed with `VK_ERROR_`. 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ci[source, c] 191e5c31af7Sopenharmony_ci.Example 192e5c31af7Sopenharmony_ci---- 193e5c31af7Sopenharmony_ci// VK_FORMAT_UNDEFINED, VK_FORMAT_R4G4_UNORM_PACK8 (Enumerants) 194e5c31af7Sopenharmony_citypedef enum VkFormat { 195e5c31af7Sopenharmony_ci VK_FORMAT_UNDEFINED = 0, 196e5c31af7Sopenharmony_ci VK_FORMAT_R4G4_UNORM_PACK8 = 1, 197e5c31af7Sopenharmony_ci ... 198e5c31af7Sopenharmony_ci}; 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ci// VkResult codes (Exception) 201e5c31af7Sopenharmony_citypedef enum VkResult { 202e5c31af7Sopenharmony_ci VK_SUCCESS = 0, 203e5c31af7Sopenharmony_ci ... 204e5c31af7Sopenharmony_ci VK_ERROR_OUT_OF_HOST_MEMORY = -1, 205e5c31af7Sopenharmony_ci ... 206e5c31af7Sopenharmony_ci} VkResult; 207e5c31af7Sopenharmony_ci---- 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ci 210e5c31af7Sopenharmony_ci== Command Names 211e5c31af7Sopenharmony_ci 212e5c31af7Sopenharmony_ciCommand names are declared with no separator between words. 213e5c31af7Sopenharmony_ciEach word starts with a capital letter, and every other character in each 214e5c31af7Sopenharmony_ciword is lower case. 215e5c31af7Sopenharmony_ci 216e5c31af7Sopenharmony_ciThe structure of a command name should be as follows: 217e5c31af7Sopenharmony_ci 218e5c31af7Sopenharmony_ci`__prefix Verb Object Property__` 219e5c31af7Sopenharmony_ci 220e5c31af7Sopenharmony_ci`_prefix_`:: 221e5c31af7Sopenharmony_ci This is usually "vk", but will be "vkCmd" if it is a command used to 222e5c31af7Sopenharmony_ci record into a command buffer, or "vkQueue" if it directly affects a 223e5c31af7Sopenharmony_ci queue. 224e5c31af7Sopenharmony_ci 225e5c31af7Sopenharmony_ci`_Verb_`:: 226e5c31af7Sopenharmony_ci The verb describing the action being performed. 227e5c31af7Sopenharmony_ci A list of most verbs used in Vulkan is available <<command-names-verbs, 228e5c31af7Sopenharmony_ci here>>. 229e5c31af7Sopenharmony_ci 230e5c31af7Sopenharmony_ci`_Object_`:: 231e5c31af7Sopenharmony_ci The name of the object being acted upon by the command. 232e5c31af7Sopenharmony_ci 233e5c31af7Sopenharmony_ci`_Property_`:: 234e5c31af7Sopenharmony_ci The property of the object which is being acted upon by the command, and 235e5c31af7Sopenharmony_ci is omitted in cases where the whole object is being acted upon (e.g. 236e5c31af7Sopenharmony_ci creation commands). 237e5c31af7Sopenharmony_ci 238e5c31af7Sopenharmony_ciThese rules apply to all command declarations. 239e5c31af7Sopenharmony_ci 240e5c31af7Sopenharmony_ci[source, c] 241e5c31af7Sopenharmony_ci.Example 242e5c31af7Sopenharmony_ci---- 243e5c31af7Sopenharmony_ci// Creation command 244e5c31af7Sopenharmony_ciVKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( ... ); 245e5c31af7Sopenharmony_ci 246e5c31af7Sopenharmony_ci// Command buffer recording command 247e5c31af7Sopenharmony_ciVKAPI_ATTR VkResult VKAPI_CALL vkCmdBindPipeline( ... ); 248e5c31af7Sopenharmony_ci 249e5c31af7Sopenharmony_ci// Get command 250e5c31af7Sopenharmony_ciVKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( ... ); 251e5c31af7Sopenharmony_ci---- 252e5c31af7Sopenharmony_ci 253e5c31af7Sopenharmony_ci.Note 254e5c31af7Sopenharmony_ci[NOTE] 255e5c31af7Sopenharmony_ci==== 256e5c31af7Sopenharmony_ciThere are three exceptions to the above rule in the core Vulkan API: 257e5c31af7Sopenharmony_ci 258e5c31af7Sopenharmony_ci * vkDeviceWaitIdle 259e5c31af7Sopenharmony_ci * vkCmdNextSubpass 260e5c31af7Sopenharmony_ci * vkCmdPipelineBarrier 261e5c31af7Sopenharmony_ci 262e5c31af7Sopenharmony_ciThese names are left as-is to maintain compatibility. 263e5c31af7Sopenharmony_ci 264e5c31af7Sopenharmony_ciThere are additionally a number of exceptions in a few existing extensions. 265e5c31af7Sopenharmony_ci==== 266e5c31af7Sopenharmony_ci 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ci=== Query Commands 269e5c31af7Sopenharmony_ci 270e5c31af7Sopenharmony_ciA number of commands in the API are used to determine the properties of some 271e5c31af7Sopenharmony_ciobject in the implementation. 272e5c31af7Sopenharmony_ci 273e5c31af7Sopenharmony_ciThe queried properties may either be invariant, or they may: change based on 274e5c31af7Sopenharmony_ciapplication behavior. 275e5c31af7Sopenharmony_ciIf the results are not invariant, the lifetime of the results should be 276e5c31af7Sopenharmony_ciclearly described in the command description. 277e5c31af7Sopenharmony_ciSee 278e5c31af7Sopenharmony_cilink:html/vkspec.html#fundamentals-commandsyntax-results-lifetime[Lifetime 279e5c31af7Sopenharmony_ciof Retrieved Results] in the specification for more information. 280e5c31af7Sopenharmony_ci 281e5c31af7Sopenharmony_ciThese commands fall into two categories from a naming perspective: 282e5c31af7Sopenharmony_ci 283e5c31af7Sopenharmony_ciCapability Queries:: 284e5c31af7Sopenharmony_ci 285e5c31af7Sopenharmony_ciThese are commands which query capabilities of objects that an 286e5c31af7Sopenharmony_ciimplementation can provide. 287e5c31af7Sopenharmony_ciSuch commands use the verb "Enumerate" to identify themselves. 288e5c31af7Sopenharmony_ci+ 289e5c31af7Sopenharmony_cie.g. `vkEnumeratePhysicalDeviceProperties` 290e5c31af7Sopenharmony_ci+ 291e5c31af7Sopenharmony_ciWhilst these commands describe properties of the named object, they do not 292e5c31af7Sopenharmony_ciaccept a parameter of that object type - though they usually have a 293e5c31af7Sopenharmony_ciparameter for the parent type. 294e5c31af7Sopenharmony_ci 295e5c31af7Sopenharmony_ciObject State Queries:: 296e5c31af7Sopenharmony_ci 297e5c31af7Sopenharmony_ciThese commands are used to query the current properties of an object that 298e5c31af7Sopenharmony_cihas been created. 299e5c31af7Sopenharmony_ciSuch commands use the verb "Get" to identify themselves. 300e5c31af7Sopenharmony_ci+ 301e5c31af7Sopenharmony_cie.g. `vkGetPhysicalDeviceQueueFamilyProperties` 302e5c31af7Sopenharmony_ci+ 303e5c31af7Sopenharmony_ciThese commands always have a parameter of the object type. 304e5c31af7Sopenharmony_ci 305e5c31af7Sopenharmony_ci 306e5c31af7Sopenharmony_ci[[command-names-verbs]] 307e5c31af7Sopenharmony_ci=== Command Verbs 308e5c31af7Sopenharmony_ci 309e5c31af7Sopenharmony_ciBelow is a list of many of the verbs currently in use in core Vulkan and KHR 310e5c31af7Sopenharmony_ciextensions, along with their meanings. 311e5c31af7Sopenharmony_ciThe list is not guaranteed to be up to date, but covers all core and KHR 312e5c31af7Sopenharmony_civerbs at the time of writing. 313e5c31af7Sopenharmony_ci 314e5c31af7Sopenharmony_ci[%autowidth,options="header"] 315e5c31af7Sopenharmony_ci|=== 316e5c31af7Sopenharmony_ci| Verb | Meaning 317e5c31af7Sopenharmony_ci| Acquire | Acquire ownership of an object from an external source 318e5c31af7Sopenharmony_ci| Allocate | Allocates memory in a pool or memory heap and creates object - paired with "Free" 319e5c31af7Sopenharmony_ci| Begin | Start of a range of command buffer commands with different behavior than those outside the range - "End" marks the end of the range 320e5c31af7Sopenharmony_ci| Bind | Binds an object to another object 321e5c31af7Sopenharmony_ci| Blit | Performs a filtered and scaled copy of pixels from one image to another 322e5c31af7Sopenharmony_ci| Clear | Sets all pixels in an image to the same value 323e5c31af7Sopenharmony_ci| Copy | A raw copy of data from one object to another with no transformation of the data 324e5c31af7Sopenharmony_ci| Create | Creates an object - paired with "Destroy" 325e5c31af7Sopenharmony_ci| Destroy | Destroys an object - paired with "Create" 326e5c31af7Sopenharmony_ci| Dispatch | Kicks off a set of compute tasks 327e5c31af7Sopenharmony_ci| Draw | Kicks off a set of rasterization tasks 328e5c31af7Sopenharmony_ci| End | End of a range of command buffer commands with different behavior than those outside the range - "Begin" marks the start of the range 329e5c31af7Sopenharmony_ci| Enumerate | Queries the capabilities of objects that could be created, before creating them 330e5c31af7Sopenharmony_ci| Execute | Executes commands recorded in another command buffer 331e5c31af7Sopenharmony_ci| Fill | Sets all data units in a buffer to the same value 332e5c31af7Sopenharmony_ci| Flush | Flushes data from the host to the device 333e5c31af7Sopenharmony_ci| Free | Destroys an object and then frees memory back to a pool or memory heap - paired with "Allocate" 334e5c31af7Sopenharmony_ci| Get | Queries the state of an existing object 335e5c31af7Sopenharmony_ci| Import | Imports the payload from an external object into a Vulkan object 336e5c31af7Sopenharmony_ci| Invalidate | Invalidates data on the host, forcing newer data on the device to be read 337e5c31af7Sopenharmony_ci| Map | Maps an allocation into host memory - paired with "Unmap" 338e5c31af7Sopenharmony_ci| Merge | Merges two objects 339e5c31af7Sopenharmony_ci| Present | Presents an image to a surface 340e5c31af7Sopenharmony_ci| Push | Pushes data to the device as part of a command stream 341e5c31af7Sopenharmony_ci| Release | Releases ownership of an object to an external source 342e5c31af7Sopenharmony_ci| Reset | Resets the state of an object to an initial state 343e5c31af7Sopenharmony_ci| Resolve | Resolves multiple samples in a multisampled image to an image with one sample per pixel 344e5c31af7Sopenharmony_ci| Set | Sets the state of an object 345e5c31af7Sopenharmony_ci| Submit | Submits a set of commands to a queue 346e5c31af7Sopenharmony_ci| Unmap | Unmaps an allocation from host memory - paired with "Map" 347e5c31af7Sopenharmony_ci| Update | Updates entries in a descriptor set 348e5c31af7Sopenharmony_ci| Wait | Waits for some signal 349e5c31af7Sopenharmony_ci| Write | Writes values to an object 350e5c31af7Sopenharmony_ci|=== 351e5c31af7Sopenharmony_ci 352e5c31af7Sopenharmony_ci 353e5c31af7Sopenharmony_ci[[naming-funcpointers]] 354e5c31af7Sopenharmony_ci=== Function Pointer Type Names 355e5c31af7Sopenharmony_ci 356e5c31af7Sopenharmony_ciFunction pointer names are declared exactly as the equivalent statically 357e5c31af7Sopenharmony_cideclared command would be declared, but prefixed with `PFN_`, standing for 358e5c31af7Sopenharmony_ci"Pointer to FunctioN". 359e5c31af7Sopenharmony_ci 360e5c31af7Sopenharmony_ci[source, c] 361e5c31af7Sopenharmony_ci.Example 362e5c31af7Sopenharmony_ci---- 363e5c31af7Sopenharmony_ci// PFN_vkCreateInstance (Function Pointer) 364e5c31af7Sopenharmony_citypedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)( ... ); 365e5c31af7Sopenharmony_ci---- 366e5c31af7Sopenharmony_ci 367e5c31af7Sopenharmony_ci 368e5c31af7Sopenharmony_ci== Function Parameter and Struct/Union Member Names 369e5c31af7Sopenharmony_ci 370e5c31af7Sopenharmony_ciFunction parameter names are declared with no separator between words. 371e5c31af7Sopenharmony_ciEach new word, *except* for the first, starts with a capital letter. 372e5c31af7Sopenharmony_ciAll other characters in the parameter name are in lower case. 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ciMembers/parameters of a type that is not a base type should generally be 375e5c31af7Sopenharmony_cinamed in a similar way to the type itself, with additional context added for 376e5c31af7Sopenharmony_ciclarity when necessary. 377e5c31af7Sopenharmony_ci 378e5c31af7Sopenharmony_ciPointer members/parameters are prefixed with a number of `p` characters, 379e5c31af7Sopenharmony_ciwith one `p` for each level of indirection. 380e5c31af7Sopenharmony_ci 381e5c31af7Sopenharmony_ciFunction pointer members/parameters are prefixed with `pfn`. 382e5c31af7Sopenharmony_ci 383e5c31af7Sopenharmony_ciAny member describing the size of a memory allocation should be suffixed 384e5c31af7Sopenharmony_ciwith `Size`. 385e5c31af7Sopenharmony_ciIf the context is self-evident from the structure name, then it may simply 386e5c31af7Sopenharmony_cibe named `size`. 387e5c31af7Sopenharmony_ci 388e5c31af7Sopenharmony_ciAny member describing the number of something, such as an array length or 389e5c31af7Sopenharmony_cinumber of internal allocations, should be suffixed with `Count`. 390e5c31af7Sopenharmony_ciThe `size` rule overrides this rule, though it is possible to have multiple 391e5c31af7Sopenharmony_cisizes (e.g. `sizeCount`). 392e5c31af7Sopenharmony_ciIf the member is an array length, then the name of length should correspond 393e5c31af7Sopenharmony_cito the name of the array member, usually `XYZCount` for an array named 394e5c31af7Sopenharmony_ci`pXYZs`. 395e5c31af7Sopenharmony_ciIf a structure in a pname:pNext chain is an array whose length must match 396e5c31af7Sopenharmony_cithe length of an array of the base structure, then that extending structure 397e5c31af7Sopenharmony_cishould include an array length member with the same name as the length in 398e5c31af7Sopenharmony_cithe base structure. 399e5c31af7Sopenharmony_ci 400e5c31af7Sopenharmony_ciThese rules apply to all function parameters and struct/union members, with 401e5c31af7Sopenharmony_cia single exception: 402e5c31af7Sopenharmony_ci 403e5c31af7Sopenharmony_ci * The `sType` member of structures is abbreviated as it is used in almost 404e5c31af7Sopenharmony_ci every structure. 405e5c31af7Sopenharmony_ci ** The slightly odd naming prevents it clashing with any future variables. 406e5c31af7Sopenharmony_ci ** The `s` stands for "`structure`", referring to its enumerant type. 407e5c31af7Sopenharmony_ci 408e5c31af7Sopenharmony_ci[source, c] 409e5c31af7Sopenharmony_ci.Example 410e5c31af7Sopenharmony_ci---- 411e5c31af7Sopenharmony_ci// Function parameters, including a twice indirected pointer. 412e5c31af7Sopenharmony_ciVKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( 413e5c31af7Sopenharmony_ci VkDevice device, 414e5c31af7Sopenharmony_ci VkDeviceMemory memory, 415e5c31af7Sopenharmony_ci VkDeviceSize offset, 416e5c31af7Sopenharmony_ci VkDeviceSize size, 417e5c31af7Sopenharmony_ci VkMemoryMapFlags flags, 418e5c31af7Sopenharmony_ci void** ppData); 419e5c31af7Sopenharmony_ci 420e5c31af7Sopenharmony_ci// Structure members, including the sType exception and a single indirected 421e5c31af7Sopenharmony_ci// pointer. 422e5c31af7Sopenharmony_citypedef struct VkMemoryBarrier { 423e5c31af7Sopenharmony_ci VkStructureType sType; 424e5c31af7Sopenharmony_ci const void* pNext; 425e5c31af7Sopenharmony_ci VkAccessFlags srcAccessMask; 426e5c31af7Sopenharmony_ci VkAccessFlags dstAccessMask; 427e5c31af7Sopenharmony_ci} VkMemoryBarrier; 428e5c31af7Sopenharmony_ci 429e5c31af7Sopenharmony_ci// Function pointer members 430e5c31af7Sopenharmony_citypedef struct VkAllocationCallbacks { 431e5c31af7Sopenharmony_ci void* pUserData; 432e5c31af7Sopenharmony_ci PFN_vkAllocationFunction pfnAllocation; 433e5c31af7Sopenharmony_ci PFN_vkReallocationFunction pfnReallocation; 434e5c31af7Sopenharmony_ci PFN_vkFreeFunction pfnFree; 435e5c31af7Sopenharmony_ci PFN_vkInternalAllocationNotification pfnInternalAllocation; 436e5c31af7Sopenharmony_ci PFN_vkInternalFreeNotification pfnInternalFree; 437e5c31af7Sopenharmony_ci} VkAllocationCallbacks; 438e5c31af7Sopenharmony_ci 439e5c31af7Sopenharmony_ci// Size member (pCode is not a specific array of anything, it is just a 440e5c31af7Sopenharmony_ci// pointer to memory) 441e5c31af7Sopenharmony_citypedef struct VkShaderModuleCreateInfo { 442e5c31af7Sopenharmony_ci VkStructureType sType; 443e5c31af7Sopenharmony_ci const void* pNext; 444e5c31af7Sopenharmony_ci VkShaderModuleCreateFlags flags; 445e5c31af7Sopenharmony_ci size_t codeSize; 446e5c31af7Sopenharmony_ci const uint32_t* pCode; 447e5c31af7Sopenharmony_ci} VkShaderModuleCreateInfo; 448e5c31af7Sopenharmony_ci 449e5c31af7Sopenharmony_ci// Count member 450e5c31af7Sopenharmony_citypedef struct VkSparseImageMemoryBindInfo { 451e5c31af7Sopenharmony_ci VkImage image; 452e5c31af7Sopenharmony_ci uint32_t bindCount; 453e5c31af7Sopenharmony_ci const VkSparseImageMemoryBind* pBinds; 454e5c31af7Sopenharmony_ci} VkSparseImageMemoryBindInfo; 455e5c31af7Sopenharmony_ci---- 456e5c31af7Sopenharmony_ci 457e5c31af7Sopenharmony_ci 458e5c31af7Sopenharmony_ci[[naming-extension-identifiers]] 459e5c31af7Sopenharmony_ci== Extension Identifier Naming Conventions 460e5c31af7Sopenharmony_ci 461e5c31af7Sopenharmony_ciIdentifiers defined by an extension are modified by appending the 462e5c31af7Sopenharmony_ciextension's author ID to the end of the identifier, as described below. 463e5c31af7Sopenharmony_ciAuthor IDs are obtained as described in the 464e5c31af7Sopenharmony_ci<<extensions-naming-conventions,Extension and Layer Naming Conventions>> 465e5c31af7Sopenharmony_cisection. 466e5c31af7Sopenharmony_ci 467e5c31af7Sopenharmony_ciIf an extension becomes part of core, a new version of the extension's 468e5c31af7Sopenharmony_ciidentifiers should be created, that do not contain the author ID at the end 469e5c31af7Sopenharmony_ciof the identifier. 470e5c31af7Sopenharmony_ciThe original identifiers should be kept in order to maintain source-level 471e5c31af7Sopenharmony_cicompatibility with existing applications making use of the earlier 472e5c31af7Sopenharmony_ciextension's identifiers. 473e5c31af7Sopenharmony_ci 474e5c31af7Sopenharmony_ci 475e5c31af7Sopenharmony_ci=== Extension Type Names 476e5c31af7Sopenharmony_ci 477e5c31af7Sopenharmony_ciTypes defined by extensions have the author ID appended to the end of the 478e5c31af7Sopenharmony_citype name. 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ci[source, c] 481e5c31af7Sopenharmony_ci.Example 482e5c31af7Sopenharmony_ci---- 483e5c31af7Sopenharmony_ci// VkSurfaceFormatKHR (structure type with KHR appended) 484e5c31af7Sopenharmony_citypedef struct VkSurfaceFormatKHR { 485e5c31af7Sopenharmony_ci VkFormat format; 486e5c31af7Sopenharmony_ci VkColorSpaceKHR colorSpace; 487e5c31af7Sopenharmony_ci} VkSurfaceFormatKHR; 488e5c31af7Sopenharmony_ci---- 489e5c31af7Sopenharmony_ci 490e5c31af7Sopenharmony_ci 491e5c31af7Sopenharmony_ci[[naming-extension-enumerant-names]] 492e5c31af7Sopenharmony_ci=== Extension Enumerant Names 493e5c31af7Sopenharmony_ci 494e5c31af7Sopenharmony_ciEnumerants defined by extensions have the author ID appended to the end of 495e5c31af7Sopenharmony_cithe enumerant name, separated by an underscore. 496e5c31af7Sopenharmony_ciThis includes the begin, end, range and max values added to enumeranted type 497e5c31af7Sopenharmony_cidefinitions by the generator scripts. 498e5c31af7Sopenharmony_ci 499e5c31af7Sopenharmony_ci[NOTE] 500e5c31af7Sopenharmony_ci==== 501e5c31af7Sopenharmony_ciThere is one exception to this rule in the 502e5c31af7Sopenharmony_ci`VK_KHR_sampler_mirror_clamp_to_edge` extension. 503e5c31af7Sopenharmony_ciThis functionality was included in the original specification, but quickly 504e5c31af7Sopenharmony_ciseparated out at release. 505e5c31af7Sopenharmony_ciDue to this late change, the single enum exposed has retained its original 506e5c31af7Sopenharmony_ciidentifier to avoid compatibility issues: 507e5c31af7Sopenharmony_ciename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE 508e5c31af7Sopenharmony_ci==== 509e5c31af7Sopenharmony_ci 510e5c31af7Sopenharmony_ci[source, c] 511e5c31af7Sopenharmony_ci.Example 512e5c31af7Sopenharmony_ci---- 513e5c31af7Sopenharmony_ci// VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR (enumerant with _KHR appended) 514e5c31af7Sopenharmony_citypedef enum VkCompositeAlphaFlagBitsKHR { 515e5c31af7Sopenharmony_ci VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, 516e5c31af7Sopenharmony_ci ... 517e5c31af7Sopenharmony_ci} VkCompositeAlphaFlagBitsKHR; 518e5c31af7Sopenharmony_ci---- 519e5c31af7Sopenharmony_ci 520e5c31af7Sopenharmony_ci 521e5c31af7Sopenharmony_ci=== Extension Function Names 522e5c31af7Sopenharmony_ci 523e5c31af7Sopenharmony_ciFunction and function pointer type names defined by extensions have the 524e5c31af7Sopenharmony_ciauthor ID appended to the end of the name. 525e5c31af7Sopenharmony_ci 526e5c31af7Sopenharmony_ci[source, c] 527e5c31af7Sopenharmony_ci.Example 528e5c31af7Sopenharmony_ci---- 529e5c31af7Sopenharmony_ci// vkDestroySurfaceKHR (function with KHR appended) 530e5c31af7Sopenharmony_ciVKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( 531e5c31af7Sopenharmony_ci VkInstance instance, 532e5c31af7Sopenharmony_ci VkSurfaceKHR surface, 533e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator); 534e5c31af7Sopenharmony_ci 535e5c31af7Sopenharmony_citypedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)( 536e5c31af7Sopenharmony_ci VkInstance instance, 537e5c31af7Sopenharmony_ci VkSurfaceKHR surface, 538e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator); 539e5c31af7Sopenharmony_ci---- 540e5c31af7Sopenharmony_ci 541e5c31af7Sopenharmony_ci 542e5c31af7Sopenharmony_ci[[naming-abbreviations]] 543e5c31af7Sopenharmony_ci== Common Abbreviations 544e5c31af7Sopenharmony_ci 545e5c31af7Sopenharmony_ciAbbreviations and acronyms are sometimes used in the <<vulkan-spec,Vulkan 546e5c31af7Sopenharmony_ciAPI Specification>> and the Vulkan API where they are considered clear and 547e5c31af7Sopenharmony_cicommonplace. 548e5c31af7Sopenharmony_ciAll such abbreviations used in the core API are defined here. 549e5c31af7Sopenharmony_ciExtensions should also use these abbreviations where appropriate. 550e5c31af7Sopenharmony_ci 551e5c31af7Sopenharmony_ciSrc:: 552e5c31af7Sopenharmony_ci Source 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_ciDst:: 555e5c31af7Sopenharmony_ci Destination 556e5c31af7Sopenharmony_ci 557e5c31af7Sopenharmony_ciMin:: 558e5c31af7Sopenharmony_ci Minimum 559e5c31af7Sopenharmony_ci 560e5c31af7Sopenharmony_ciMax:: 561e5c31af7Sopenharmony_ci Maximum 562e5c31af7Sopenharmony_ci 563e5c31af7Sopenharmony_ciRect:: 564e5c31af7Sopenharmony_ci Rectangle 565e5c31af7Sopenharmony_ci 566e5c31af7Sopenharmony_ciInfo:: 567e5c31af7Sopenharmony_ci Information 568e5c31af7Sopenharmony_ci 569e5c31af7Sopenharmony_ciLod:: 570e5c31af7Sopenharmony_ci Level of Detail 571e5c31af7Sopenharmony_ci 572e5c31af7Sopenharmony_ciMip:: 573e5c31af7Sopenharmony_ci Related to a mipmap. 574e5c31af7Sopenharmony_ci Use "`mipmap`" in full only when it is a standalone term. 575e5c31af7Sopenharmony_ci If referred to some associating with a mipmap, such as levels, sampling 576e5c31af7Sopenharmony_ci mode, size, tail images, etc., use "`mip`" as a standalone prefix word, 577e5c31af7Sopenharmony_ci e.g. pname:maxMipLevels, ename:VK_MIP_MODE, etc. 578e5c31af7Sopenharmony_ci This is analogous to the <<writing-compound-words,spelling conventions 579e5c31af7Sopenharmony_ci for mip-related terms>> 580e5c31af7Sopenharmony_ci 581e5c31af7Sopenharmony_ci[NOTE] 582e5c31af7Sopenharmony_ci==== 583e5c31af7Sopenharmony_ciThe names pname:mipmapMode, pname:mipmapPrecisionBits, 584e5c31af7Sopenharmony_cisname:VkSamplerMipmapMode, and 585e5c31af7Sopenharmony_ciename:VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT are exceptions to this 586e5c31af7Sopenharmony_cigeneral usage guideline, for historical reasons. 587e5c31af7Sopenharmony_ci==== 588e5c31af7Sopenharmony_ci 589e5c31af7Sopenharmony_ciID:: 590e5c31af7Sopenharmony_ci Identifier 591e5c31af7Sopenharmony_ci 592e5c31af7Sopenharmony_ciUUID:: 593e5c31af7Sopenharmony_ci Universally Unique Identifier 594e5c31af7Sopenharmony_ci 595e5c31af7Sopenharmony_ciOp:: 596e5c31af7Sopenharmony_ci Operation 597e5c31af7Sopenharmony_ci 598e5c31af7Sopenharmony_ciR:: 599e5c31af7Sopenharmony_ci Red color component 600e5c31af7Sopenharmony_ci 601e5c31af7Sopenharmony_ciG:: 602e5c31af7Sopenharmony_ci Green color component 603e5c31af7Sopenharmony_ci 604e5c31af7Sopenharmony_ciB:: 605e5c31af7Sopenharmony_ci Blue color component 606e5c31af7Sopenharmony_ci 607e5c31af7Sopenharmony_ciA:: 608e5c31af7Sopenharmony_ci Alpha color component 609e5c31af7Sopenharmony_ci 610e5c31af7Sopenharmony_ci 611e5c31af7Sopenharmony_ci[[naming-prefixes]] 612e5c31af7Sopenharmony_ci== Standard Prefixes 613e5c31af7Sopenharmony_ci 614e5c31af7Sopenharmony_ciPrefixes are used in the API to denote specific semantic meaning of Vulkan 615e5c31af7Sopenharmony_cinames, or as a label to avoid name clashes, and are explained here: 616e5c31af7Sopenharmony_ci 617e5c31af7Sopenharmony_ciVK/Vk/vk:: 618e5c31af7Sopenharmony_ci Vulkan namespace + 619e5c31af7Sopenharmony_ci All types, commands, enumerants and C macro definitions in the Vulkan 620e5c31af7Sopenharmony_ci specification are prefixed with these two characters, according to the 621e5c31af7Sopenharmony_ci rules defined above. 622e5c31af7Sopenharmony_ci 623e5c31af7Sopenharmony_ciPFN/pfn:: 624e5c31af7Sopenharmony_ci Function Pointer + 625e5c31af7Sopenharmony_ci Denotes that a type is a function pointer, or that a variable is of a 626e5c31af7Sopenharmony_ci pointer type. 627e5c31af7Sopenharmony_ci 628e5c31af7Sopenharmony_cip:: 629e5c31af7Sopenharmony_ci Pointer + 630e5c31af7Sopenharmony_ci Variable is a pointer. 631e5c31af7Sopenharmony_ci 632e5c31af7Sopenharmony_civkCmd:: 633e5c31af7Sopenharmony_ci Commands that record commands in command buffers + 634e5c31af7Sopenharmony_ci These API commands do not result in immediate processing on the device. 635e5c31af7Sopenharmony_ci Instead, they record the requested action in a command buffer for 636e5c31af7Sopenharmony_ci execution when the command buffer is submitted to a queue. 637e5c31af7Sopenharmony_ci 638e5c31af7Sopenharmony_cis:: 639e5c31af7Sopenharmony_ci Structure + 640e5c31af7Sopenharmony_ci Used to denote the etext:VK_STRUCTURE_TYPE* member of each structure in 641e5c31af7Sopenharmony_ci pname:sType. 642e5c31af7Sopenharmony_ci 643e5c31af7Sopenharmony_ci 644e5c31af7Sopenharmony_ci[[format-types]] 645e5c31af7Sopenharmony_ci== Format Types 646e5c31af7Sopenharmony_ci 647e5c31af7Sopenharmony_ciFormats naming conventions 648e5c31af7Sopenharmony_ci 649e5c31af7Sopenharmony_ciNumeric Format:: 650e5c31af7Sopenharmony_ci Describes the suffix found on formats ex. 651e5c31af7Sopenharmony_ci SFLOAT, SINT, SNORM, SRGB, UINT, USCALED, etc 652e5c31af7Sopenharmony_ci 653e5c31af7Sopenharmony_ciNumeric Type:: 654e5c31af7Sopenharmony_ci describes float, signed int, or unsigned int 655e5c31af7Sopenharmony_ci 656e5c31af7Sopenharmony_ciSPIR-V Type:: 657e5c31af7Sopenharmony_ci The combination of the type (ex OpTypeInt), width, and signedness 658