1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[initialization]] 6e5c31af7Sopenharmony_ci= Initialization 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciBefore using Vulkan, an application must: initialize it by loading the 9e5c31af7Sopenharmony_ciVulkan commands, and creating a sname:VkInstance object. 10e5c31af7Sopenharmony_ci 11e5c31af7Sopenharmony_ci 12e5c31af7Sopenharmony_ci[[initialization-functionpointers]] 13e5c31af7Sopenharmony_ci== Command Function Pointers 14e5c31af7Sopenharmony_ci 15e5c31af7Sopenharmony_ciVulkan commands are not necessarily exposed by static linking on a platform. 16e5c31af7Sopenharmony_ciCommands to query function pointers for Vulkan commands are described below. 17e5c31af7Sopenharmony_ci 18e5c31af7Sopenharmony_ci[NOTE] 19e5c31af7Sopenharmony_ci.Note 20e5c31af7Sopenharmony_ci==== 21e5c31af7Sopenharmony_ciWhen extensions are <<extendingvulkan-compatibility-promotion,promoted>> or 22e5c31af7Sopenharmony_ciotherwise incorporated into another extension or Vulkan core version, 23e5c31af7Sopenharmony_cicommand <<extendingvulkan-compatibility-aliases,aliases>> may be included. 24e5c31af7Sopenharmony_ciWhilst the behavior of each command alias is identical, the behavior of 25e5c31af7Sopenharmony_ciretrieving each alias's function pointer is not. 26e5c31af7Sopenharmony_ciA function pointer for a given alias can only be retrieved if the extension 27e5c31af7Sopenharmony_cior version that introduced that alias is supported and enabled, irrespective 28e5c31af7Sopenharmony_ciof whether any other alias is available. 29e5c31af7Sopenharmony_ci==== 30e5c31af7Sopenharmony_ci 31e5c31af7Sopenharmony_ci[open,refpage='vkGetInstanceProcAddr',desc='Return a function pointer for a command',type='protos',xrefs='PFN_vkVoidFunction'] 32e5c31af7Sopenharmony_ci-- 33e5c31af7Sopenharmony_ciFunction pointers for all Vulkan commands can: be obtained with the command: 34e5c31af7Sopenharmony_ci 35e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetInstanceProcAddr.txt[] 36e5c31af7Sopenharmony_ci 37e5c31af7Sopenharmony_ci * pname:instance is the instance that the function pointer will be 38e5c31af7Sopenharmony_ci compatible with, or `NULL` for commands not dependent on any instance. 39e5c31af7Sopenharmony_ci * pname:pName is the name of the command to obtain. 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_cifname:vkGetInstanceProcAddr itself is obtained in a platform- and loader- 42e5c31af7Sopenharmony_cispecific manner. 43e5c31af7Sopenharmony_ciTypically, the loader library will export this command as a function symbol, 44e5c31af7Sopenharmony_ciso applications can: link against the loader library, or load it dynamically 45e5c31af7Sopenharmony_ciand look up the symbol using platform-specific APIs. 46e5c31af7Sopenharmony_ci 47e5c31af7Sopenharmony_ciThe table below defines the various use cases for 48e5c31af7Sopenharmony_cifname:vkGetInstanceProcAddr and expected return value ("`fp`" is "`function 49e5c31af7Sopenharmony_cipointer`") for each case. 50e5c31af7Sopenharmony_ciA valid returned function pointer ("`fp`") must: not be `NULL`. 51e5c31af7Sopenharmony_ci 52e5c31af7Sopenharmony_ciThe returned function pointer is of type tlink:PFN_vkVoidFunction, and must: 53e5c31af7Sopenharmony_cibe cast to the type of the command being queried before use. 54e5c31af7Sopenharmony_ci 55e5c31af7Sopenharmony_ci.fname:vkGetInstanceProcAddr behavior 56e5c31af7Sopenharmony_ci[width="80%",options="header"] 57e5c31af7Sopenharmony_ci|==== 58e5c31af7Sopenharmony_ci| pname:instance | pname:pName | return value 59e5c31af7Sopenharmony_ci| *^1^ | `NULL` | undefined: 60e5c31af7Sopenharmony_ci| invalid non-`NULL` instance | *^1^ | undefined: 61e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 62e5c31af7Sopenharmony_ci| `NULL` | flink:vkGetInstanceProcAddr | fp^5^ 63e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 64e5c31af7Sopenharmony_ci| `NULL` | _global command_^2^ | fp 65e5c31af7Sopenharmony_ci| instance | core _dispatchable command_ | fp^3^ 66e5c31af7Sopenharmony_ci| instance | enabled instance extension dispatchable command for pname:instance | fp^3^ 67e5c31af7Sopenharmony_ci| instance | available device extension^4^ dispatchable command for pname:instance | fp^3^ 68e5c31af7Sopenharmony_ci2+| any other case, not covered above | `NULL` 69e5c31af7Sopenharmony_ci|==== 70e5c31af7Sopenharmony_ci 71e5c31af7Sopenharmony_ci1:: 72e5c31af7Sopenharmony_ci "*" means any representable value for the parameter (including valid 73e5c31af7Sopenharmony_ci values, invalid values, and `NULL`). 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ci2:: 76e5c31af7Sopenharmony_ci The global commands are: 77e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[flink:vkEnumerateInstanceVersion,] 78e5c31af7Sopenharmony_ci flink:vkEnumerateInstanceExtensionProperties, 79e5c31af7Sopenharmony_ci flink:vkEnumerateInstanceLayerProperties, and flink:vkCreateInstance. 80e5c31af7Sopenharmony_ci Dispatchable commands are all other commands which are not global. 81e5c31af7Sopenharmony_ci 82e5c31af7Sopenharmony_ci3:: 83e5c31af7Sopenharmony_ci The returned function pointer must: only be called with a dispatchable 84e5c31af7Sopenharmony_ci object (the first parameter) that is pname:instance or a child of 85e5c31af7Sopenharmony_ci pname:instance, e.g. slink:VkInstance, slink:VkPhysicalDevice, 86e5c31af7Sopenharmony_ci slink:VkDevice, slink:VkQueue, or slink:VkCommandBuffer. 87e5c31af7Sopenharmony_ci 88e5c31af7Sopenharmony_ci4:: 89e5c31af7Sopenharmony_ci An "`available device extension`" is a device extension supported by any 90e5c31af7Sopenharmony_ci physical device enumerated by pname:instance. 91e5c31af7Sopenharmony_ci 92e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 93e5c31af7Sopenharmony_ci5:: 94e5c31af7Sopenharmony_ci Starting with Vulkan 1.2, fname:vkGetInstanceProcAddr can resolve itself 95e5c31af7Sopenharmony_ci with a `NULL` instance pointer. 96e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 97e5c31af7Sopenharmony_ci 98e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetInstanceProcAddr.txt[] 99e5c31af7Sopenharmony_ci-- 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_ci[open,refpage='vkGetDeviceProcAddr',desc='Return a function pointer for a command',type='protos',xrefs='PFN_vkVoidFunction'] 102e5c31af7Sopenharmony_ci-- 103e5c31af7Sopenharmony_ciIn order to support systems with multiple Vulkan implementations, the 104e5c31af7Sopenharmony_cifunction pointers returned by fname:vkGetInstanceProcAddr may: point to 105e5c31af7Sopenharmony_cidispatch code that calls a different real implementation for different 106e5c31af7Sopenharmony_cislink:VkDevice objects or their child objects. 107e5c31af7Sopenharmony_ciThe overhead of the internal dispatch for slink:VkDevice objects can be 108e5c31af7Sopenharmony_ciavoided by obtaining device-specific function pointers for any commands that 109e5c31af7Sopenharmony_ciuse a device or device-child object as their dispatchable object. 110e5c31af7Sopenharmony_ciSuch function pointers can: be obtained with the command: 111e5c31af7Sopenharmony_ci 112e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetDeviceProcAddr.txt[] 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_ciThe table below defines the various use cases for fname:vkGetDeviceProcAddr 115e5c31af7Sopenharmony_ciand expected return value ("`fp`" is "`function pointer`") for each case. 116e5c31af7Sopenharmony_ciA valid returned function pointer ("`fp`") must: not be `NULL`. 117e5c31af7Sopenharmony_ci 118e5c31af7Sopenharmony_ciThe returned function pointer is of type tlink:PFN_vkVoidFunction, and must: 119e5c31af7Sopenharmony_cibe cast to the type of the command being queried before use. 120e5c31af7Sopenharmony_ciThe function pointer must: only be called with a dispatchable object (the 121e5c31af7Sopenharmony_cifirst parameter) that is pname:device or a child of pname:device. 122e5c31af7Sopenharmony_ci 123e5c31af7Sopenharmony_ci.fname:vkGetDeviceProcAddr behavior 124e5c31af7Sopenharmony_ci[width="80%",options="header"] 125e5c31af7Sopenharmony_ci|==== 126e5c31af7Sopenharmony_ci| pname:device | pname:pName | return value 127e5c31af7Sopenharmony_ci| `NULL` | *^1^ | undefined: 128e5c31af7Sopenharmony_ci| invalid device | *^1^ | undefined: 129e5c31af7Sopenharmony_ci| device | `NULL` | undefined: 130e5c31af7Sopenharmony_ci| device | core device-level dispatchable command^2^ | fp^3^ 131e5c31af7Sopenharmony_ci| device | enabled extension device-level dispatchable command^2^ | fp^3^ 132e5c31af7Sopenharmony_ci2+| any other case, not covered above | `NULL` 133e5c31af7Sopenharmony_ci|==== 134e5c31af7Sopenharmony_ci 135e5c31af7Sopenharmony_ci1:: 136e5c31af7Sopenharmony_ci "*" means any representable value for the parameter (including valid 137e5c31af7Sopenharmony_ci values, invalid values, and `NULL`). 138e5c31af7Sopenharmony_ci 139e5c31af7Sopenharmony_ci2:: 140e5c31af7Sopenharmony_ci In this function, device-level excludes all physical-device-level 141e5c31af7Sopenharmony_ci commands. 142e5c31af7Sopenharmony_ci 143e5c31af7Sopenharmony_ci3:: 144e5c31af7Sopenharmony_ci The returned function pointer must: only be called with a dispatchable 145e5c31af7Sopenharmony_ci object (the first parameter) that is pname:device or a child of 146e5c31af7Sopenharmony_ci pname:device e.g. slink:VkDevice, slink:VkQueue, or 147e5c31af7Sopenharmony_ci slink:VkCommandBuffer. 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetDeviceProcAddr.txt[] 150e5c31af7Sopenharmony_ci-- 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ci[open,refpage='PFN_vkVoidFunction',desc='Placeholder function pointer type returned by queries',type='funcpointers',xrefs='vkGetDeviceProcAddr vkGetInstanceProcAddr'] 153e5c31af7Sopenharmony_ci-- 154e5c31af7Sopenharmony_ciThe definition of tlink:PFN_vkVoidFunction is: 155e5c31af7Sopenharmony_ci 156e5c31af7Sopenharmony_ciinclude::{generated}/api/funcpointers/PFN_vkVoidFunction.txt[] 157e5c31af7Sopenharmony_ci-- 158e5c31af7Sopenharmony_ci 159e5c31af7Sopenharmony_ci 160e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 161e5c31af7Sopenharmony_ci=== Extending Physical Device Core Functionality 162e5c31af7Sopenharmony_ci 163e5c31af7Sopenharmony_ciNew core physical-device-level functionality can: be used when the 164e5c31af7Sopenharmony_ciphysical-device version is greater than or equal to the version of Vulkan 165e5c31af7Sopenharmony_cithat added the new functionality. 166e5c31af7Sopenharmony_ciThe Vulkan version supported by a physical device can: be obtained by 167e5c31af7Sopenharmony_cicalling flink:vkGetPhysicalDeviceProperties. 168e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_ci 171e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 172e5c31af7Sopenharmony_ci[[initialization-phys-dev-extensions]] 173e5c31af7Sopenharmony_ci=== Extending Physical Device From Device Extensions 174e5c31af7Sopenharmony_ci 175e5c31af7Sopenharmony_ciWhen the `apiext:VK_KHR_get_physical_device_properties2` extension is 176e5c31af7Sopenharmony_cienabled, 177e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 178e5c31af7Sopenharmony_cior when both the instance and the physical-device versions are at least 1.1, 179e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 180e5c31af7Sopenharmony_ciphysical-device-level functionality of a device extension can: be used with 181e5c31af7Sopenharmony_cia physical device if the corresponding extension is enumerated by 182e5c31af7Sopenharmony_ciflink:vkEnumerateDeviceExtensionProperties for that physical device, even 183e5c31af7Sopenharmony_cibefore a logical device has been created. 184e5c31af7Sopenharmony_ci 185e5c31af7Sopenharmony_ciTo obtain a function pointer for a physical-device-level command from a 186e5c31af7Sopenharmony_cidevice extension, an application can: use flink:vkGetInstanceProcAddr. 187e5c31af7Sopenharmony_ciThis function pointer may: point to dispatch code, which calls a different 188e5c31af7Sopenharmony_cireal implementation for different sname:VkPhysicalDevice objects. 189e5c31af7Sopenharmony_ciApplications must: not use a slink:VkPhysicalDevice in any command added by 190e5c31af7Sopenharmony_cian extension or core version that is not supported by that physical device. 191e5c31af7Sopenharmony_ci 192e5c31af7Sopenharmony_ciDevice extensions may: define structures that can: be added to the 193e5c31af7Sopenharmony_ciptext:pNext chain of physical-device-level commands. 194e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 195e5c31af7Sopenharmony_ci 196e5c31af7Sopenharmony_ci 197e5c31af7Sopenharmony_ci[[initialization-instances]] 198e5c31af7Sopenharmony_ci== Instances 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ci[open,refpage='VkInstance',desc='Opaque handle to an instance object',type='handles'] 201e5c31af7Sopenharmony_ci-- 202e5c31af7Sopenharmony_ciThere is no global state in Vulkan and all per-application state is stored 203e5c31af7Sopenharmony_ciin a sname:VkInstance object. 204e5c31af7Sopenharmony_ciCreating a sname:VkInstance object initializes the Vulkan library and allows 205e5c31af7Sopenharmony_cithe application to pass information about itself to the implementation. 206e5c31af7Sopenharmony_ci 207e5c31af7Sopenharmony_ciInstances are represented by sname:VkInstance handles: 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkInstance.txt[] 210e5c31af7Sopenharmony_ci-- 211e5c31af7Sopenharmony_ci 212e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 213e5c31af7Sopenharmony_ci[open,refpage='vkEnumerateInstanceVersion',desc='Query instance-level version before instance creation',type='protos'] 214e5c31af7Sopenharmony_ci-- 215e5c31af7Sopenharmony_ciTo query the version of instance-level functionality supported by the 216e5c31af7Sopenharmony_ciimplementation, call: 217e5c31af7Sopenharmony_ci 218e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkEnumerateInstanceVersion.txt[] 219e5c31af7Sopenharmony_ci 220e5c31af7Sopenharmony_ci * pname:pApiVersion is a pointer to a code:uint32_t, which is the version 221e5c31af7Sopenharmony_ci of Vulkan supported by instance-level functionality, encoded as 222e5c31af7Sopenharmony_ci described in <<extendingvulkan-coreversions-versionnumbers>>. 223e5c31af7Sopenharmony_ci 224e5c31af7Sopenharmony_ci[NOTE] 225e5c31af7Sopenharmony_ci.Note 226e5c31af7Sopenharmony_ci==== 227e5c31af7Sopenharmony_ciThe intended behaviour of flink:vkEnumerateInstanceVersion is that an 228e5c31af7Sopenharmony_ciimplementation should: not need to perform memory allocations and should: 229e5c31af7Sopenharmony_ciunconditionally return ename:VK_SUCCESS. 230e5c31af7Sopenharmony_ciThe loader, and any enabled layers, may: return 231e5c31af7Sopenharmony_ciename:VK_ERROR_OUT_OF_HOST_MEMORY in the case of a failed memory allocation. 232e5c31af7Sopenharmony_ci==== 233e5c31af7Sopenharmony_ci 234e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkEnumerateInstanceVersion.txt[] 235e5c31af7Sopenharmony_ci-- 236e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 237e5c31af7Sopenharmony_ci 238e5c31af7Sopenharmony_ci[open,refpage='vkCreateInstance',desc='Create a new Vulkan instance',type='protos'] 239e5c31af7Sopenharmony_ci-- 240e5c31af7Sopenharmony_ciTo create an instance object, call: 241e5c31af7Sopenharmony_ci 242e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateInstance.txt[] 243e5c31af7Sopenharmony_ci 244e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkInstanceCreateInfo structure 245e5c31af7Sopenharmony_ci controlling creation of the instance. 246e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 247e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 248e5c31af7Sopenharmony_ci * pname:pInstance points a slink:VkInstance handle in which the resulting 249e5c31af7Sopenharmony_ci instance is returned. 250e5c31af7Sopenharmony_ci 251e5c31af7Sopenharmony_cifname:vkCreateInstance verifies that the requested layers exist. 252e5c31af7Sopenharmony_ciIf not, fname:vkCreateInstance will return ename:VK_ERROR_LAYER_NOT_PRESENT. 253e5c31af7Sopenharmony_ciNext fname:vkCreateInstance verifies that the requested extensions are 254e5c31af7Sopenharmony_cisupported (e.g. in the implementation or in any enabled instance layer) and 255e5c31af7Sopenharmony_ciif any requested extension is not supported, fname:vkCreateInstance must: 256e5c31af7Sopenharmony_cireturn ename:VK_ERROR_EXTENSION_NOT_PRESENT. 257e5c31af7Sopenharmony_ciAfter verifying and enabling the instance layers and extensions the 258e5c31af7Sopenharmony_cisname:VkInstance object is created and returned to the application. 259e5c31af7Sopenharmony_ciIf a requested extension is only supported by a layer, both the layer and 260e5c31af7Sopenharmony_cithe extension need to be specified at fname:vkCreateInstance time for the 261e5c31af7Sopenharmony_cicreation to succeed. 262e5c31af7Sopenharmony_ci 263e5c31af7Sopenharmony_ci.Valid Usage 264e5c31af7Sopenharmony_ci**** 265e5c31af7Sopenharmony_ci * [[VUID-vkCreateInstance-ppEnabledExtensionNames-01388]] 266e5c31af7Sopenharmony_ci All <<extendingvulkan-extensions-extensiondependencies, required 267e5c31af7Sopenharmony_ci extensions>> for each extension in the 268e5c31af7Sopenharmony_ci slink:VkInstanceCreateInfo::pname:ppEnabledExtensionNames list must: 269e5c31af7Sopenharmony_ci also be present in that list 270e5c31af7Sopenharmony_ci**** 271e5c31af7Sopenharmony_ci 272e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateInstance.txt[] 273e5c31af7Sopenharmony_ci-- 274e5c31af7Sopenharmony_ci 275e5c31af7Sopenharmony_ci[open,refpage='VkInstanceCreateInfo',desc='Structure specifying parameters of a newly created instance',type='structs'] 276e5c31af7Sopenharmony_ci-- 277e5c31af7Sopenharmony_ciThe sname:VkInstanceCreateInfo structure is defined as: 278e5c31af7Sopenharmony_ci 279e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkInstanceCreateInfo.txt[] 280e5c31af7Sopenharmony_ci 281e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 282e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 283e5c31af7Sopenharmony_ci structure. 284e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 285e5c31af7Sopenharmony_ci * pname:pApplicationInfo is `NULL` or a pointer to a 286e5c31af7Sopenharmony_ci sname:VkApplicationInfo structure. 287e5c31af7Sopenharmony_ci If not `NULL`, this information helps implementations recognize behavior 288e5c31af7Sopenharmony_ci inherent to classes of applications. 289e5c31af7Sopenharmony_ci slink:VkApplicationInfo is defined in detail below. 290e5c31af7Sopenharmony_ci * pname:enabledLayerCount is the number of global layers to enable. 291e5c31af7Sopenharmony_ci * pname:ppEnabledLayerNames is a pointer to an array of 292e5c31af7Sopenharmony_ci pname:enabledLayerCount null-terminated UTF-8 strings containing the 293e5c31af7Sopenharmony_ci names of layers to enable for the created instance. 294e5c31af7Sopenharmony_ci The layers are loaded in the order they are listed in this array, with 295e5c31af7Sopenharmony_ci the first array element being the closest to the application, and the 296e5c31af7Sopenharmony_ci last array element being the closest to the driver. 297e5c31af7Sopenharmony_ci See the <<extendingvulkan-layers>> section for further details. 298e5c31af7Sopenharmony_ci * pname:enabledExtensionCount is the number of global extensions to 299e5c31af7Sopenharmony_ci enable. 300e5c31af7Sopenharmony_ci * pname:ppEnabledExtensionNames is a pointer to an array of 301e5c31af7Sopenharmony_ci pname:enabledExtensionCount null-terminated UTF-8 strings containing the 302e5c31af7Sopenharmony_ci names of extensions to enable. 303e5c31af7Sopenharmony_ci 304e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_report,VK_EXT_debug_utils[] 305e5c31af7Sopenharmony_ciTo capture events that occur while creating or destroying an instance, an 306e5c31af7Sopenharmony_ciapplication can link a 307e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_report[] 308e5c31af7Sopenharmony_cislink:VkDebugReportCallbackCreateInfoEXT structure 309e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_utils[] 310e5c31af7Sopenharmony_cior a 311e5c31af7Sopenharmony_ciendif::VK_EXT_debug_utils[] 312e5c31af7Sopenharmony_ciendif::VK_EXT_debug_report[] 313e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_utils[] 314e5c31af7Sopenharmony_cislink:VkDebugUtilsMessengerCreateInfoEXT structure 315e5c31af7Sopenharmony_ciendif::VK_EXT_debug_utils[] 316e5c31af7Sopenharmony_cito the pname:pNext element of the sname:VkInstanceCreateInfo structure given 317e5c31af7Sopenharmony_cito fname:vkCreateInstance. 318e5c31af7Sopenharmony_ciThis callback is only valid for the duration of the flink:vkCreateInstance 319e5c31af7Sopenharmony_ciand the flink:vkDestroyInstance call. 320e5c31af7Sopenharmony_ciUse 321e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_report[] 322e5c31af7Sopenharmony_ciflink:vkCreateDebugReportCallbackEXT 323e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_utils[] 324e5c31af7Sopenharmony_cior 325e5c31af7Sopenharmony_ciendif::VK_EXT_debug_utils[] 326e5c31af7Sopenharmony_ciendif::VK_EXT_debug_report[] 327e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_utils[] 328e5c31af7Sopenharmony_ciflink:vkCreateDebugUtilsMessengerEXT 329e5c31af7Sopenharmony_ciendif::VK_EXT_debug_utils[] 330e5c31af7Sopenharmony_cito create persistent callback objects. 331e5c31af7Sopenharmony_ci 332e5c31af7Sopenharmony_ci.Valid Usage 333e5c31af7Sopenharmony_ci**** 334e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_report[] 335e5c31af7Sopenharmony_ci * [[VUID-VkInstanceCreateInfo-pNext-04925]] 336e5c31af7Sopenharmony_ci If the pname:pNext chain of sname:VkInstanceCreateInfo includes a 337e5c31af7Sopenharmony_ci sname:VkDebugReportCallbackCreateInfoEXT structure, the list of enabled 338e5c31af7Sopenharmony_ci extensions in pname:ppEnabledExtensionNames must: contain 339e5c31af7Sopenharmony_ci apiext:VK_EXT_debug_report 340e5c31af7Sopenharmony_ciendif::VK_EXT_debug_report[] 341e5c31af7Sopenharmony_ciifdef::VK_EXT_debug_utils[] 342e5c31af7Sopenharmony_ci * [[VUID-VkInstanceCreateInfo-pNext-04926]] 343e5c31af7Sopenharmony_ci If the pname:pNext chain of sname:VkInstanceCreateInfo includes a 344e5c31af7Sopenharmony_ci sname:VkDebugUtilsMessengerCreateInfoEXT structure, the list of enabled 345e5c31af7Sopenharmony_ci extensions in pname:ppEnabledExtensionNames must: contain 346e5c31af7Sopenharmony_ci apiext:VK_EXT_debug_utils 347e5c31af7Sopenharmony_ciendif::VK_EXT_debug_utils[] 348e5c31af7Sopenharmony_ci**** 349e5c31af7Sopenharmony_ciendif::VK_EXT_debug_report,VK_EXT_debug_utils[] 350e5c31af7Sopenharmony_ci 351e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkInstanceCreateInfo.txt[] 352e5c31af7Sopenharmony_ci-- 353e5c31af7Sopenharmony_ci 354e5c31af7Sopenharmony_ci[open,refpage='VkInstanceCreateFlags',desc='Reserved for future use',type='flags'] 355e5c31af7Sopenharmony_ci-- 356e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkInstanceCreateFlags.txt[] 357e5c31af7Sopenharmony_ci 358e5c31af7Sopenharmony_citname:VkInstanceCreateFlags is a bitmask type for setting a mask, but is 359e5c31af7Sopenharmony_cicurrently reserved for future use. 360e5c31af7Sopenharmony_ci-- 361e5c31af7Sopenharmony_ci 362e5c31af7Sopenharmony_ciifdef::VK_EXT_validation_flags[] 363e5c31af7Sopenharmony_ciinclude::{chapters}/VK_EXT_validation_flags.txt[] 364e5c31af7Sopenharmony_ciendif::VK_EXT_validation_flags[] 365e5c31af7Sopenharmony_ci 366e5c31af7Sopenharmony_ciifdef::VK_EXT_validation_features[] 367e5c31af7Sopenharmony_ciinclude::{chapters}/VK_EXT_validation_features.txt[] 368e5c31af7Sopenharmony_ciendif::VK_EXT_validation_features[] 369e5c31af7Sopenharmony_ci 370e5c31af7Sopenharmony_ci[open,refpage='VkApplicationInfo',desc='Structure specifying application information',type='structs'] 371e5c31af7Sopenharmony_ci-- 372e5c31af7Sopenharmony_ciThe sname:VkApplicationInfo structure is defined as: 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkApplicationInfo.txt[] 375e5c31af7Sopenharmony_ci 376e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 377e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 378e5c31af7Sopenharmony_ci structure. 379e5c31af7Sopenharmony_ci * pname:pApplicationName is `NULL` or is a pointer to a null-terminated 380e5c31af7Sopenharmony_ci UTF-8 string containing the name of the application. 381e5c31af7Sopenharmony_ci * pname:applicationVersion is an unsigned integer variable containing the 382e5c31af7Sopenharmony_ci developer-supplied version number of the application. 383e5c31af7Sopenharmony_ci * pname:pEngineName is `NULL` or is a pointer to a null-terminated UTF-8 384e5c31af7Sopenharmony_ci string containing the name of the engine (if any) used to create the 385e5c31af7Sopenharmony_ci application. 386e5c31af7Sopenharmony_ci * pname:engineVersion is an unsigned integer variable containing the 387e5c31af7Sopenharmony_ci developer-supplied version number of the engine used to create the 388e5c31af7Sopenharmony_ci application. 389e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1[] 390e5c31af7Sopenharmony_ci * pname:apiVersion is the version of the Vulkan API against which the 391e5c31af7Sopenharmony_ci application expects to run, encoded as described in 392e5c31af7Sopenharmony_ci <<extendingvulkan-coreversions-versionnumbers>>. 393e5c31af7Sopenharmony_ci If pname:apiVersion is 0 the implementation must: ignore it, otherwise 394e5c31af7Sopenharmony_ci if the implementation does not support the requested pname:apiVersion, 395e5c31af7Sopenharmony_ci or an effective substitute for pname:apiVersion, it must: return 396e5c31af7Sopenharmony_ci ename:VK_ERROR_INCOMPATIBLE_DRIVER. 397e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 398e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 399e5c31af7Sopenharmony_ci * pname:apiVersion must: be the highest version of Vulkan that the 400e5c31af7Sopenharmony_ci application is designed to use, encoded as described in 401e5c31af7Sopenharmony_ci <<extendingvulkan-coreversions-versionnumbers>>. 402e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 403e5c31af7Sopenharmony_ci The patch version number specified in pname:apiVersion is ignored when 404e5c31af7Sopenharmony_ci creating an instance object. 405e5c31af7Sopenharmony_ci Only the major and minor versions of the instance must: match those 406e5c31af7Sopenharmony_ci requested in pname:apiVersion. 407e5c31af7Sopenharmony_ci 408e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 409e5c31af7Sopenharmony_ciVulkan 1.0 implementations were required to return 410e5c31af7Sopenharmony_ciename:VK_ERROR_INCOMPATIBLE_DRIVER if pname:apiVersion was larger than 1.0. 411e5c31af7Sopenharmony_ciImplementations that support Vulkan 1.1 or later must: not return 412e5c31af7Sopenharmony_ciename:VK_ERROR_INCOMPATIBLE_DRIVER for any value of pname:apiVersion. 413e5c31af7Sopenharmony_ci 414e5c31af7Sopenharmony_ci[NOTE] 415e5c31af7Sopenharmony_ci.Note 416e5c31af7Sopenharmony_ci==== 417e5c31af7Sopenharmony_ciBecause Vulkan 1.0 implementations may: fail with 418e5c31af7Sopenharmony_ciename:VK_ERROR_INCOMPATIBLE_DRIVER, applications should: determine the 419e5c31af7Sopenharmony_civersion of Vulkan available before calling flink:vkCreateInstance. 420e5c31af7Sopenharmony_ciIf the flink:vkGetInstanceProcAddr returns `NULL` for 421e5c31af7Sopenharmony_ciflink:vkEnumerateInstanceVersion, it is a Vulkan 1.0 implementation. 422e5c31af7Sopenharmony_ciOtherwise, the application can: call flink:vkEnumerateInstanceVersion to 423e5c31af7Sopenharmony_cidetermine the version of Vulkan. 424e5c31af7Sopenharmony_ci==== 425e5c31af7Sopenharmony_ci 426e5c31af7Sopenharmony_ciAs long as the instance supports at least Vulkan 1.1, an application can: 427e5c31af7Sopenharmony_ciuse different versions of Vulkan with an instance than it does with a device 428e5c31af7Sopenharmony_cior physical device. 429e5c31af7Sopenharmony_ci 430e5c31af7Sopenharmony_ci[NOTE] 431e5c31af7Sopenharmony_ci.Note 432e5c31af7Sopenharmony_ci==== 433e5c31af7Sopenharmony_ciThe Khronos validation layers will treat pname:apiVersion as the highest API 434e5c31af7Sopenharmony_civersion the application targets, and will validate API usage against the 435e5c31af7Sopenharmony_ciminimum of that version and the implementation version (instance or device, 436e5c31af7Sopenharmony_cidepending on context). 437e5c31af7Sopenharmony_ciIf an application tries to use functionality from a greater version than 438e5c31af7Sopenharmony_cithis, a validation error will be triggered. 439e5c31af7Sopenharmony_ci 440e5c31af7Sopenharmony_ciFor example, if the instance supports Vulkan 1.1 and three physical devices 441e5c31af7Sopenharmony_cisupport Vulkan 1.0, Vulkan 1.1, and Vulkan 1.2, respectively, and if the 442e5c31af7Sopenharmony_ciapplication sets pname:apiVersion to 1.2, the application can: use the 443e5c31af7Sopenharmony_cifollowing versions of Vulkan: 444e5c31af7Sopenharmony_ci 445e5c31af7Sopenharmony_ci * Vulkan 1.0 can: be used with the instance and with all physical devices. 446e5c31af7Sopenharmony_ci * Vulkan 1.1 can: be used with the instance and with the physical devices 447e5c31af7Sopenharmony_ci that support Vulkan 1.1 and Vulkan 1.2. 448e5c31af7Sopenharmony_ci * Vulkan 1.2 can: be used with the physical device that supports Vulkan 449e5c31af7Sopenharmony_ci 1.2. 450e5c31af7Sopenharmony_ci 451e5c31af7Sopenharmony_ciIf we modify the above example so that the application sets pname:apiVersion 452e5c31af7Sopenharmony_cito 1.1, then the application must: not use Vulkan 1.2 functionality on the 453e5c31af7Sopenharmony_ciphysical device that supports Vulkan 1.2. 454e5c31af7Sopenharmony_ci==== 455e5c31af7Sopenharmony_ci 456e5c31af7Sopenharmony_ciImplicit layers must: be disabled if they do not support a version at least 457e5c31af7Sopenharmony_cias high as pname:apiVersion. 458e5c31af7Sopenharmony_ciSee the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader 459e5c31af7Sopenharmony_ciInterfaces`">> document for additional information. 460e5c31af7Sopenharmony_ci 461e5c31af7Sopenharmony_ci[NOTE] 462e5c31af7Sopenharmony_ci.Note 463e5c31af7Sopenharmony_ci==== 464e5c31af7Sopenharmony_ciProviding a `NULL` slink:VkInstanceCreateInfo::pname:pApplicationInfo or 465e5c31af7Sopenharmony_ciproviding an pname:apiVersion of 0 is equivalent to providing an 466e5c31af7Sopenharmony_cipname:apiVersion of `VK_MAKE_API_VERSION(0,1,0,0)`. 467e5c31af7Sopenharmony_ci==== 468e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 469e5c31af7Sopenharmony_ci 470e5c31af7Sopenharmony_ci.Valid Usage 471e5c31af7Sopenharmony_ci**** 472e5c31af7Sopenharmony_ci * [[VUID-VkApplicationInfo-apiVersion-04010]] 473e5c31af7Sopenharmony_ci If pname:apiVersion is not `0`, then it must: be greater than or equal 474e5c31af7Sopenharmony_ci to dlink:VK_API_VERSION_1_0 475e5c31af7Sopenharmony_ci**** 476e5c31af7Sopenharmony_ci 477e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkApplicationInfo.txt[] 478e5c31af7Sopenharmony_ci-- 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ci[open,refpage='vkDestroyInstance',desc='Destroy an instance of Vulkan',type='protos'] 481e5c31af7Sopenharmony_ci-- 482e5c31af7Sopenharmony_ciTo destroy an instance, call: 483e5c31af7Sopenharmony_ci 484e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroyInstance.txt[] 485e5c31af7Sopenharmony_ci 486e5c31af7Sopenharmony_ci * pname:instance is the handle of the instance to destroy. 487e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 488e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 489e5c31af7Sopenharmony_ci 490e5c31af7Sopenharmony_ci.Valid Usage 491e5c31af7Sopenharmony_ci**** 492e5c31af7Sopenharmony_ci * [[VUID-vkDestroyInstance-instance-00629]] 493e5c31af7Sopenharmony_ci All child objects created using pname:instance must: have been destroyed 494e5c31af7Sopenharmony_ci prior to destroying pname:instance 495e5c31af7Sopenharmony_ci * [[VUID-vkDestroyInstance-instance-00630]] 496e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:instance was 497e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 498e5c31af7Sopenharmony_ci * [[VUID-vkDestroyInstance-instance-00631]] 499e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:instance was 500e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 501e5c31af7Sopenharmony_ci**** 502e5c31af7Sopenharmony_ci 503e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroyInstance.txt[] 504e5c31af7Sopenharmony_ci-- 505