1// Copyright 2015-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[extendingvulkan]] 6= Extending Vulkan 7 8New functionality may: be added to Vulkan via either new extensions or new 9versions of the core, or new versions of an extension in some cases. 10 11This chapter describes how Vulkan is versioned, how compatibility is 12affected between different versions, and compatibility rules that are 13followed by the Vulkan Working Group. 14 15 16[[extendingvulkan-instanceanddevicefunctionality]] 17== Instance and Device Functionality 18 19Commands that enumerate instance properties, or that accept a 20slink:VkInstance object as a parameter, are considered instance-level 21functionality. 22Commands 23ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 24that enumerate physical device properties, or 25endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 26that accept a slink:VkDevice object or any of a device's child objects as a 27parameter, are considered device-level functionality. 28 29ifdef::VK_VERSION_1_1[] 30[NOTE] 31.Note 32==== 33Applications usually interface to Vulkan using a loader that implements only 34instance-level functionality, passing device-level functionality to 35implementations of the full Vulkan API on the system. 36In some circumstances, as these may be implemented independently, it is 37possible that the loader and device implementations on a given installation 38will support different versions. 39To allow for this and call out when it happens, the Vulkan specification 40enumerates device and instance level functionality separately - they have 41<<extendingvulkan-coreversions-queryingversionsupport,independent version 42queries>>. 43==== 44endif::VK_VERSION_1_1[] 45 46ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 47[NOTE] 48.Note 49==== 50Vulkan 1.0 initially specified new physical device enumeration functionality 51as instance-level, requiring it to be included in an instance extension. 52As the capabilities of device-level functionality require discovery via 53physical device enumeration, this led to the situation where many device 54extensions required an instance extension as well. 55To alleviate this extra work, 56`apiext:VK_KHR_get_physical_device_properties2` (and subsequently Vulkan 571.1) redefined device-level functionality to include physical device 58enumeration. 59==== 60endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 61 62 63[[extendingvulkan-coreversions]] 64== Core Versions 65 66The Vulkan Specification is regularly updated with bug fixes and 67clarifications. 68Occasionally new functionality is added to the core and at some point it is 69expected that there will be a desire to perform a large, breaking change to 70the API. 71In order to indicate to developers how and when these changes are made to 72the specification, and to provide a way to identify each set of changes, the 73Vulkan API maintains a version number. 74 75 76[[extendingvulkan-coreversions-versionnumbers]] 77=== Version Numbers 78 79The Vulkan version number comprises four parts indicating the variant, 80major, minor and patch version of the Vulkan API Specification. 81 82The _variant_ indicates the variant of the Vulkan API supported by the 83implementation. 84This is always 0 for the Vulkan API. 85 86[NOTE] 87.Note 88==== 89A non-zero variant indicates the API is a variant of the Vulkan API and 90applications will typically need to be modified to run against it. 91The variant field was a later addition to the version number, added in 92version 1.2.175 of the Specification. 93As Vulkan uses variant 0, this change is fully backwards compatible with the 94previous version number format for Vulkan implementations. 95New version number macros have been added for this change and the old macros 96deprecated. 97For existing applications using the older format and macros, an 98implementation with non-zero variant will decode as a very high Vulkan 99version. 100The high version number should be detectable by applications performing 101suitable version checking. 102==== 103 104The _major version_ indicates a significant change in the API, which will 105encompass a wholly new version of the specification. 106 107The _minor version_ indicates the incorporation of new functionality into 108the core specification. 109 110The _patch version_ indicates bug fixes, clarifications, and language 111improvements have been incorporated into the specification. 112 113Compatibility guarantees made about versions of the API sharing any of the 114same version numbers are documented in 115<<extendingvulkan-compatibility-coreversions>> 116 117The version number is used in several places in the API. 118In each such use, the version numbers are packed into a 32-bit integer as 119follows: 120 121 * The variant is a 3-bit integer packed into bits 31-29. 122 * The major version is a 7-bit integer packed into bits 28-22. 123 * The minor version number is a 10-bit integer packed into bits 21-12. 124 * The patch version number is a 12-bit integer packed into bits 11-0. 125 126[open,refpage='VK_API_VERSION_VARIANT',desc='Extract API variant number',type='defines'] 127-- 128dname:VK_API_VERSION_VARIANT extracts the API variant number from a packed 129version number: 130 131include::{generated}/api/defines/VK_API_VERSION_VARIANT.adoc[] 132-- 133 134[open,refpage='VK_API_VERSION_MAJOR',desc='Extract API major version number',type='defines'] 135-- 136dname:VK_API_VERSION_MAJOR extracts the API major version number from a 137packed version number: 138 139include::{generated}/api/defines/VK_API_VERSION_MAJOR.adoc[] 140-- 141 142[open,refpage='VK_VERSION_MAJOR',desc='Extract API major version number',type='defines'] 143-- 144dname:VK_VERSION_MAJOR extracts the API major version number from a packed 145version number: 146 147include::{generated}/api/defines/VK_VERSION_MAJOR.adoc[] 148-- 149 150[open,refpage='VK_API_VERSION_MINOR',desc='Extract API minor version number',type='defines'] 151-- 152dname:VK_API_VERSION_MINOR extracts the API minor version number from a 153packed version number: 154 155include::{generated}/api/defines/VK_API_VERSION_MINOR.adoc[] 156-- 157 158[open,refpage='VK_VERSION_MINOR',desc='Extract API minor version number',type='defines'] 159-- 160dname:VK_VERSION_MINOR extracts the API minor version number from a packed 161version number: 162 163include::{generated}/api/defines/VK_VERSION_MINOR.adoc[] 164-- 165 166[open,refpage='VK_API_VERSION_PATCH',desc='Extract API patch version number',type='defines'] 167-- 168dname:VK_API_VERSION_PATCH extracts the API patch version number from a 169packed version number: 170 171include::{generated}/api/defines/VK_API_VERSION_PATCH.adoc[] 172-- 173 174[open,refpage='VK_VERSION_PATCH',desc='Extract API patch version number',type='defines'] 175-- 176dname:VK_VERSION_PATCH extracts the API patch version number from a packed 177version number: 178 179include::{generated}/api/defines/VK_VERSION_PATCH.adoc[] 180-- 181 182[open,refpage='VK_MAKE_API_VERSION',desc='Construct an API version number',type='defines',xrefs='VkApplicationInfo vkCreateInstance'] 183-- 184dname:VK_MAKE_API_VERSION constructs an API version number. 185 186include::{generated}/api/defines/VK_MAKE_API_VERSION.adoc[] 187 188 * pname:variant is the variant number. 189 * pname:major is the major version number. 190 * pname:minor is the minor version number. 191 * pname:patch is the patch version number. 192-- 193 194[open,refpage='VK_MAKE_VERSION',desc='Construct an API version number',type='defines',xrefs='VkApplicationInfo vkCreateInstance'] 195-- 196dname:VK_MAKE_VERSION constructs an API version number. 197 198include::{generated}/api/defines/VK_MAKE_VERSION.adoc[] 199 200 * pname:major is the major version number. 201 * pname:minor is the minor version number. 202 * pname:patch is the patch version number. 203-- 204 205[open,refpage='VK_API_VERSION_1_0',desc='Return API version number for Vulkan 1.0',type='defines',xrefs='vkCreateInstance vkGetPhysicalDeviceProperties'] 206-- 207dname:VK_API_VERSION_1_0 returns the API version number for Vulkan 1.0.0. 208 209include::{generated}/api/defines/VK_API_VERSION_1_0.adoc[] 210-- 211 212ifdef::VK_VERSION_1_1[] 213[open,refpage='VK_API_VERSION_1_1',desc='Return API version number for Vulkan 1.1',type='defines',xrefs='vkCreateInstance vkGetPhysicalDeviceProperties'] 214-- 215dname:VK_API_VERSION_1_1 returns the API version number for Vulkan 1.1.0. 216 217include::{generated}/api/defines/VK_API_VERSION_1_1.adoc[] 218-- 219endif::VK_VERSION_1_1[] 220 221ifdef::VK_VERSION_1_2[] 222[open,refpage='VK_API_VERSION_1_2',desc='Return API version number for Vulkan 1.2',type='defines',xrefs='vkCreateInstance vkGetPhysicalDeviceProperties'] 223-- 224dname:VK_API_VERSION_1_2 returns the API version number for Vulkan 1.2.0. 225 226include::{generated}/api/defines/VK_API_VERSION_1_2.adoc[] 227-- 228endif::VK_VERSION_1_2[] 229 230ifdef::VK_VERSION_1_3[] 231[open,refpage='VK_API_VERSION_1_3',desc='Return API version number for Vulkan 1.3',type='defines',xrefs='vkCreateInstance vkGetPhysicalDeviceProperties'] 232-- 233dname:VK_API_VERSION_1_3 returns the API version number for Vulkan 1.3.0. 234 235include::{generated}/api/defines/VK_API_VERSION_1_3.adoc[] 236-- 237endif::VK_VERSION_1_3[] 238 239 240[[extendingvulkan-coreversions-queryingversionsupport]] 241=== Querying Version Support 242 243ifndef::VK_VERSION_1_1[] 244[NOTE] 245.Note 246==== 247In Vulkan 1.0, there is no mechanism to detect the separate versions of 248<<extendingvulkan-instanceanddevicefunctionality,instance-level and 249device-level functionality>> supported. 250However, the fname:vkEnumerateInstanceVersion command was added in Vulkan 2511.1 to determine the supported version of instance-level functionality - 252querying for this function via flink:vkGetInstanceProcAddr will return 253`NULL` on implementations that only support Vulkan 1.0 functionality. 254For more information on this, please refer to the Vulkan 1.1 specification. 255==== 256endif::VK_VERSION_1_1[] 257 258ifdef::VK_VERSION_1_1[] 259The version of instance-level functionality can be queried by calling 260flink:vkEnumerateInstanceVersion. 261endif::VK_VERSION_1_1[] 262 263The version of device-level functionality can be queried by calling 264flink:vkGetPhysicalDeviceProperties 265ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 266or flink:vkGetPhysicalDeviceProperties2, 267endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 268and is returned in slink:VkPhysicalDeviceProperties::pname:apiVersion, 269encoded as described in <<extendingvulkan-coreversions-versionnumbers>>. 270 271 272[[extendingvulkan-layers]] 273== Layers 274 275When a layer is enabled, it inserts itself into the call chain for Vulkan 276commands the layer is interested in. 277Layers can: be used for a variety of tasks that extend the base behavior of 278Vulkan beyond what is required by the specification - such as call logging, 279tracing, validation, or providing additional extensions. 280 281[NOTE] 282.Note 283==== 284For example, an implementation is not expected to check that the value of 285enums used by the application fall within allowed ranges. 286Instead, a validation layer would do those checks and flag issues. 287This avoids a performance penalty during production use of the application 288because those layers would not be enabled in production. 289==== 290 291[NOTE] 292.Note 293==== 294Vulkan layers may: wrap object handles (i.e. return a different handle value 295to the application than that generated by the implementation). 296This is generally discouraged, as it increases the probability of 297incompatibilities with new extensions. 298The validation layers wrap handles in order to track the proper use and 299destruction of each object. 300See the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader 301Interfaces`">> document for additional information. 302==== 303 304[open,refpage='vkEnumerateInstanceLayerProperties',desc='Returns up to requested number of global layer properties',type='protos'] 305-- 306To query the available layers, call: 307 308include::{generated}/api/protos/vkEnumerateInstanceLayerProperties.adoc[] 309 310 * pname:pPropertyCount is a pointer to an integer related to the number of 311 layer properties available or queried, as described below. 312 * pname:pProperties is either `NULL` or a pointer to an array of 313 slink:VkLayerProperties structures. 314 315If pname:pProperties is `NULL`, then the number of layer properties 316available is returned in pname:pPropertyCount. 317Otherwise, pname:pPropertyCount must: point to a variable set by the user to 318the number of elements in the pname:pProperties array, and on return the 319variable is overwritten with the number of structures actually written to 320pname:pProperties. 321If pname:pPropertyCount is less than the number of layer properties 322available, at most pname:pPropertyCount structures will be written, and 323ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 324indicate that not all the available properties were returned. 325 326The list of available layers may change at any time due to actions outside 327of the Vulkan implementation, so two calls to 328fname:vkEnumerateInstanceLayerProperties with the same parameters may: 329return different results, or retrieve different pname:pPropertyCount values 330or pname:pProperties contents. 331Once an instance has been created, the layers enabled for that instance will 332continue to be enabled and valid for the lifetime of that instance, even if 333some of them become unavailable for future instances. 334 335include::{generated}/validity/protos/vkEnumerateInstanceLayerProperties.adoc[] 336-- 337 338[open,refpage='VkLayerProperties',desc='Structure specifying layer properties',type='structs'] 339-- 340The sname:VkLayerProperties structure is defined as: 341 342include::{generated}/api/structs/VkLayerProperties.adoc[] 343 344 * pname:layerName is an array of ename:VK_MAX_EXTENSION_NAME_SIZE 345 code:char containing a null-terminated UTF-8 string which is the name of 346 the layer. 347 Use this name in the pname:ppEnabledLayerNames array passed in the 348 slink:VkInstanceCreateInfo structure to enable this layer for an 349 instance. 350 * pname:specVersion is the Vulkan version the layer was written to, 351 encoded as described in <<extendingvulkan-coreversions-versionnumbers>>. 352 * pname:implementationVersion is the version of this layer. 353 It is an integer, increasing with backward compatible changes. 354 * pname:description is an array of ename:VK_MAX_DESCRIPTION_SIZE code:char 355 containing a null-terminated UTF-8 string which provides additional 356 details that can: be used by the application to identify the layer. 357 358include::{generated}/validity/structs/VkLayerProperties.adoc[] 359-- 360 361[open,refpage='VK_MAX_EXTENSION_NAME_SIZE',desc='Maximum length of a layer of extension name string',type='consts'] 362-- 363ename:VK_MAX_EXTENSION_NAME_SIZE is the length in code:char values of an 364array containing a layer or extension name string, as returned in 365slink:VkLayerProperties::pname:layerName, 366slink:VkExtensionProperties::pname:extensionName, and other queries. 367 368include::{generated}/api/enums/VK_MAX_EXTENSION_NAME_SIZE.adoc[] 369-- 370 371[open,refpage='VK_MAX_DESCRIPTION_SIZE',desc='Length of a driver name string',type='consts'] 372-- 373ename:VK_MAX_DESCRIPTION_SIZE is the length in code:char values of an array 374containing a string with additional descriptive information about a query, 375as returned in slink:VkLayerProperties::pname:description and other queries. 376 377include::{generated}/api/enums/VK_MAX_DESCRIPTION_SIZE.adoc[] 378-- 379 380To enable a layer, the name of the layer should: be added to the 381pname:ppEnabledLayerNames member of slink:VkInstanceCreateInfo when creating 382a sname:VkInstance. 383 384Loader implementations may: provide mechanisms outside the Vulkan API for 385enabling specific layers. 386Layers enabled through such a mechanism are _implicitly enabled_, while 387layers enabled by including the layer name in the pname:ppEnabledLayerNames 388member of slink:VkInstanceCreateInfo are _explicitly enabled_. 389Implicitly enabled layers are loaded before explicitly enabled layers, such 390that implicitly enabled layers are closer to the application, and explicitly 391enabled layers are closer to the driver. 392Except where otherwise specified, implicitly enabled and explicitly enabled 393layers differ only in the way they are enabled, and the order in which they 394are loaded. 395Explicitly enabling a layer that is implicitly enabled results in this layer 396being loaded as an implicitly enabled layer; it has no additional effect. 397 398 399[[extendingvulkan-layers-devicelayerdeprecation]] 400=== Device Layer Deprecation 401 402Previous versions of this specification distinguished between instance and 403device layers. 404Instance layers were only able to intercept commands that operate on 405sname:VkInstance and sname:VkPhysicalDevice, except they were not able to 406intercept flink:vkCreateDevice. 407Device layers were enabled for individual devices when they were created, 408and could only intercept commands operating on that device or its child 409objects. 410 411Device-only layers are now deprecated, and this specification no longer 412distinguishes between instance and device layers. 413Layers are enabled during instance creation, and are able to intercept all 414commands operating on that instance or any of its child objects. 415At the time of deprecation there were no known device-only layers and no 416compelling reason to create one. 417 418In order to maintain compatibility with implementations released prior to 419device-layer deprecation, applications should: still enumerate and enable 420device layers. 421The behavior of fname:vkEnumerateDeviceLayerProperties and valid usage of 422the pname:ppEnabledLayerNames member of slink:VkDeviceCreateInfo maximizes 423compatibility with applications written to work with the previous 424requirements. 425 426[open,refpage='vkEnumerateDeviceLayerProperties',desc='Returns properties of available physical device layers',type='protos'] 427-- 428To enumerate device layers, call: 429 430include::{generated}/api/protos/vkEnumerateDeviceLayerProperties.adoc[] 431 432 * pname:physicalDevice is the physical device that will be queried. 433 * pname:pPropertyCount is a pointer to an integer related to the number of 434 layer properties available or queried. 435 * pname:pProperties is either `NULL` or a pointer to an array of 436 slink:VkLayerProperties structures. 437 438If pname:pProperties is `NULL`, then the number of layer properties 439available is returned in pname:pPropertyCount. 440Otherwise, pname:pPropertyCount must: point to a variable set by the user to 441the number of elements in the pname:pProperties array, and on return the 442variable is overwritten with the number of structures actually written to 443pname:pProperties. 444If pname:pPropertyCount is less than the number of layer properties 445available, at most pname:pPropertyCount structures will be written, and 446ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 447indicate that not all the available properties were returned. 448 449The list of layers enumerated by fname:vkEnumerateDeviceLayerProperties 450must: be exactly the sequence of layers enabled for the instance. 451The members of sname:VkLayerProperties for each enumerated layer must: be 452the same as the properties when the layer was enumerated by 453fname:vkEnumerateInstanceLayerProperties. 454 455[NOTE] 456.Note 457==== 458Due to platform details on Android, fname:vkEnumerateDeviceLayerProperties 459may be called with pname:physicalDevice equal to `NULL` during layer 460discovery. 461This behaviour will only be observed by layer implementations, and not the 462underlying Vulkan driver. 463==== 464 465include::{generated}/validity/protos/vkEnumerateDeviceLayerProperties.adoc[] 466-- 467 468The pname:ppEnabledLayerNames and pname:enabledLayerCount members of 469slink:VkDeviceCreateInfo are deprecated and their values must: be ignored by 470implementations. 471However, for compatibility, only an empty list of layers or a list that 472exactly matches the sequence enabled at instance creation time are valid, 473and validation layers should: issue diagnostics for other cases. 474 475Regardless of the enabled layer list provided in slink:VkDeviceCreateInfo, 476the sequence of layers active for a device will be exactly the sequence of 477layers enabled when the parent instance was created. 478 479 480[[extendingvulkan-extensions]] 481== Extensions 482 483Extensions may: define new Vulkan commands, structures, and enumerants. 484For compilation purposes, the interfaces defined by registered extensions, 485including new structures and enumerants as well as function pointer types 486for new commands, are defined in the Khronos-supplied `{core_header}` 487together with the core API. 488However, commands defined by extensions may: not be available for static 489linking - in which case function pointers to these commands should: be 490queried at runtime as described in <<initialization-functionpointers>>. 491Extensions may: be provided by layers as well as by a Vulkan implementation. 492 493Because extensions may: extend or change the behavior of the Vulkan API, 494extension authors should: add support for their extensions to the Khronos 495validation layers. 496This is especially important for new commands whose parameters have been 497wrapped by the validation layers. 498See the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader 499Interfaces`">> document for additional information. 500 501[NOTE] 502.Note 503==== 504To enable an instance extension, the name of the extension can: be added to 505the pname:ppEnabledExtensionNames member of slink:VkInstanceCreateInfo when 506creating a sname:VkInstance. 507 508To enable a device extension, the name of the extension can: be added to the 509pname:ppEnabledExtensionNames member of slink:VkDeviceCreateInfo when 510creating a sname:VkDevice. 511 512ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 513Physical-Device-Level functionality does not have any enabling mechanism and 514can: be used as long as the slink:VkPhysicalDevice supports the device 515extension as determined by flink:vkEnumerateDeviceExtensionProperties. 516endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] 517 518Enabling an extension (with no further use of that extension) does not 519change the behavior of functionality exposed by the core Vulkan API or any 520other extension, other than making valid the use of the commands, enums and 521structures defined by that extension. 522 523Valid Usage sections for individual commands and structures do not currently 524contain which extensions have to be enabled in order to make their use 525valid, although they might do so in the future. 526It is defined only in the <<fundamentals-validusage-extensions>> section. 527==== 528 529 530=== Instance Extensions 531 532Instance extensions add new 533<<extendingvulkan-instanceanddevicefunctionality,instance-level 534functionality>> to the API, outside of the core specification. 535 536[open,refpage='vkEnumerateInstanceExtensionProperties',desc='Returns up to requested number of global extension properties',type='protos'] 537-- 538To query the available instance extensions, call: 539 540include::{generated}/api/protos/vkEnumerateInstanceExtensionProperties.adoc[] 541 542 * pname:pLayerName is either `NULL` or a pointer to a null-terminated 543 UTF-8 string naming the layer to retrieve extensions from. 544 * pname:pPropertyCount is a pointer to an integer related to the number of 545 extension properties available or queried, as described below. 546 * pname:pProperties is either `NULL` or a pointer to an array of 547 slink:VkExtensionProperties structures. 548 549When pname:pLayerName parameter is `NULL`, only extensions provided by the 550Vulkan implementation or by implicitly enabled layers are returned. 551When pname:pLayerName is the name of a layer, the instance extensions 552provided by that layer are returned. 553 554If pname:pProperties is `NULL`, then the number of extensions properties 555available is returned in pname:pPropertyCount. 556Otherwise, pname:pPropertyCount must: point to a variable set by the user to 557the number of elements in the pname:pProperties array, and on return the 558variable is overwritten with the number of structures actually written to 559pname:pProperties. 560If pname:pPropertyCount is less than the number of extension properties 561available, at most pname:pPropertyCount structures will be written, and 562ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 563indicate that not all the available properties were returned. 564 565Because the list of available layers may change externally between calls to 566flink:vkEnumerateInstanceExtensionProperties, two calls may retrieve 567different results if a pname:pLayerName is available in one call but not in 568another. 569The extensions supported by a layer may also change between two calls, e.g. 570if the layer implementation is replaced by a different version between those 571calls. 572 573Implementations must: not advertise any pair of extensions that cannot be 574enabled together due to behavioral differences, or any extension that cannot 575be enabled against the advertised version. 576 577include::{generated}/validity/protos/vkEnumerateInstanceExtensionProperties.adoc[] 578-- 579 580 581=== Device Extensions 582 583Device extensions add new 584<<extendingvulkan-instanceanddevicefunctionality,device-level 585functionality>> to the API, outside of the core specification. 586 587[open,refpage='vkEnumerateDeviceExtensionProperties',desc='Returns properties of available physical device extensions',type='protos'] 588-- 589To query the extensions available to a given physical device, call: 590 591include::{generated}/api/protos/vkEnumerateDeviceExtensionProperties.adoc[] 592 593 * pname:physicalDevice is the physical device that will be queried. 594 * pname:pLayerName is either `NULL` or a pointer to a null-terminated 595 UTF-8 string naming the layer to retrieve extensions from. 596 * pname:pPropertyCount is a pointer to an integer related to the number of 597 extension properties available or queried, and is treated in the same 598 fashion as the 599 flink:vkEnumerateInstanceExtensionProperties::pname:pPropertyCount 600 parameter. 601 * pname:pProperties is either `NULL` or a pointer to an array of 602 slink:VkExtensionProperties structures. 603 604When pname:pLayerName parameter is `NULL`, only extensions provided by the 605Vulkan implementation or by implicitly enabled layers are returned. 606When pname:pLayerName is the name of a layer, the device extensions provided 607by that layer are returned. 608 609Implementations must: not advertise any pair of extensions that cannot be 610enabled together due to behavioral differences, or any extension that cannot 611be enabled against the advertised version. 612 613ifdef::VK_VERSION_1_3[] 614Implementations claiming support for the <<roadmap-2022, Roadmap 2022>> 615profile must: advertise the `apiext:VK_KHR_global_priority` extension in 616pname:pProperties. 617endif::VK_VERSION_1_3[] 618 619[NOTE] 620.Note 621==== 622Due to platform details on Android, 623fname:vkEnumerateDeviceExtensionProperties may be called with 624pname:physicalDevice equal to `NULL` during layer discovery. 625This behaviour will only be observed by layer implementations, and not the 626underlying Vulkan driver. 627==== 628 629include::{generated}/validity/protos/vkEnumerateDeviceExtensionProperties.adoc[] 630-- 631 632[open,refpage='VkExtensionProperties',desc='Structure specifying an extension properties',type='structs'] 633-- 634The sname:VkExtensionProperties structure is defined as: 635 636include::{generated}/api/structs/VkExtensionProperties.adoc[] 637 638 * pname:extensionName is an array of ename:VK_MAX_EXTENSION_NAME_SIZE 639 code:char containing a null-terminated UTF-8 string which is the name of 640 the extension. 641 * pname:specVersion is the version of this extension. 642 It is an integer, incremented with backward compatible changes. 643 644include::{generated}/validity/structs/VkExtensionProperties.adoc[] 645-- 646 647 648[[extendingvulkan-extensions-extensiondependencies]] 649== Extension Dependencies 650 651Some extensions are dependent on other extensions, or on specific core API 652versions, to function. 653To enable extensions with dependencies, any _required extensions_ must: also 654be enabled through the same API mechanisms when creating an instance with 655flink:vkCreateInstance or a device with flink:vkCreateDevice. 656Each extension which has such dependencies documents them in the 657<<extensions, appendix summarizing that extension>>. 658 659If an extension is supported (as queried by 660flink:vkEnumerateInstanceExtensionProperties or 661flink:vkEnumerateDeviceExtensionProperties), then _required extensions_ of 662that extension must: also be supported for the same instance or physical 663device. 664 665Any device extension that has an instance extension dependency that is not 666enabled by flink:vkCreateInstance is considered to be unsupported, hence it 667must: not be returned by flink:vkEnumerateDeviceExtensionProperties for any 668slink:VkPhysicalDevice child of the instance. 669Instance extensions do not have dependencies on device extensions. 670 671If a required extension has been <<extendingvulkan-compatibility-promotion, 672promoted>> to another extension or to a core API version, then as a 673_general_ rule, the dependency is also satisfied by the promoted extension 674or core version. 675This will be true so long as any features required by the original extension 676are also required or enabled by the promoted extension or core version. 677However, in some cases an extension is promoted while making some of its 678features optional in the promoted extension or core version. 679In this case, the dependency may: not be satisfied. 680The only way to be certain is to look at the descriptions of the original 681dependency and the promoted version in the <<extensions, Layers & 682Extensions>> and <<versions, Core Revisions>> appendices. 683 684[NOTE] 685.Note 686==== 687There is metadata in `vk.xml` describing some aspects of promotion, 688especially `requires`, `promotedto` and `deprecatedby` attributes of 689`<extension>` tags. 690However, the metadata does not yet fully describe this scenario. 691In the future, we may extend the XML schema to describe the full set of 692extensions and versions satisfying a dependency. 693==== 694 695 696== Compatibility Guarantees (Informative) 697 698This section is marked as informal as there is no binding responsibility on 699implementations of the Vulkan API - these guarantees are however a contract 700between the Vulkan Working Group and developers using this Specification. 701 702 703[[extendingvulkan-compatibility-coreversions]] 704=== Core Versions 705 706Each of the <<extendingvulkan-coreversions,major, minor, and patch 707versions>> of the Vulkan specification provide different compatibility 708guarantees. 709 710 711==== Patch Versions 712 713A difference in the patch version indicates that a set of bug fixes or 714clarifications have been made to the Specification. 715Informative enums returned by Vulkan commands that will not affect the 716runtime behavior of a valid application may be added in a patch version 717(e.g. elink:VkVendorId). 718 719The specification's patch version is strictly increasing for a given major 720version of the specification; any change to a specification as described 721above will result in the patch version being increased by 1. 722Patch versions are applied to all minor versions, even if a given minor 723version is not affected by the provoking change. 724 725Specifications with different patch versions but the same major and minor 726version are _fully compatible_ with each other - such that a valid 727application written against one will work with an implementation of another. 728 729[NOTE] 730.Note 731==== 732If a patch version includes a bug fix or clarification that could have a 733significant impact on developer expectations, these will be highlighted in 734the change log. 735Generally the Vulkan Working Group tries to avoid these kinds of changes, 736instead fixing them in either an extension or core version. 737==== 738 739 740==== Minor Versions 741 742Changes in the minor version of the specification indicate that new 743functionality has been added to the core specification. 744This will usually include new interfaces in the header, and may: also 745include behavior changes and bug fixes. 746Core functionality may: be deprecated in a minor version, but will not be 747obsoleted or removed. 748 749The specification's minor version is strictly increasing for a given major 750version of the specification; any change to a specification as described 751above will result in the minor version being increased by 1. 752Changes that can be accommodated in a patch version will not increase the 753minor version. 754 755Specifications with a lower minor version are _backwards compatible_ with an 756implementation of a specification with a higher minor version for core 757functionality and extensions issued with the KHR vendor tag. 758Vendor and multi-vendor extensions are not guaranteed to remain functional 759across minor versions, though in general they are with few exceptions - see 760<<extendingvulkan-compatibility-obsoletion>> for more information. 761 762 763==== Major Versions 764 765A difference in the major version of specifications indicates a large set of 766changes which will likely include interface changes, behavioral changes, 767removal of <<extendingvulkan-compatibility-deprecation,deprecated 768functionality>>, and the modification, addition, or replacement of other 769functionality. 770 771The specification's major version is monotonically increasing; any change to 772the specification as described above will result in the major version being 773increased. 774Changes that can be accommodated in a patch or minor version will not 775increase the major version. 776 777The Vulkan Working Group intends to only issue a new major version of the 778Specification in order to realise significant improvements to the Vulkan API 779that will necessarily require breaking compatibility. 780 781A new major version will likely include a wholly new version of the 782specification to be issued - which could include an overhaul of the 783versioning semantics for the minor and patch versions. 784The patch and minor versions of a specification are therefore not meaningful 785across major versions. 786If a major version of the specification includes similar versioning 787semantics, it is expected that the patch and the minor version will be reset 788to 0 for that major version. 789 790 791[[extendingvulkan-compatibility-extensions]] 792=== Extensions 793 794A KHR extension must: be able to be enabled alongside any other KHR 795extension, and for any minor or patch version of the core Specification 796beyond the minimum version it requires. 797A multi-vendor extension should: be able to be enabled alongside any KHR 798extension or other multi-vendor extension, and for any minor or patch 799version of the core Specification beyond the minimum version it requires. 800A vendor extension should: be able to be enabled alongside any KHR 801extension, multi-vendor extension, or other vendor extension from the same 802vendor, and for any minor or patch version of the core Specification beyond 803the minimum version it requires. 804A vendor extension may: be able to be enabled alongside vendor extensions 805from another vendor. 806 807The one other exception to this is if a vendor or multi-vendor extension is 808<<extendingvulkan-compatibility-obsoletion, made obsolete>> by either a core 809version or another extension, which will be highlighted in the 810<<extensions,extension appendix>>. 811 812 813[[extendingvulkan-compatibility-promotion]] 814==== Promotion 815 816Extensions, or features of an extension, may: be promoted to a new 817<<versions,core version of the API>>, or a newer extension which an equal or 818greater number of implementors are in favour of. 819 820When extension functionality is promoted, minor changes may: be introduced, 821limited to the following: 822 823 * Naming 824 * Non-intrusive parameters changes 825 * <<features, Feature advertisement/enablement>> 826 * Combining structure parameters into larger structures 827 * Author ID suffixes changed or removed 828 829[NOTE] 830.Note 831==== 832If extension functionality is promoted, there is no guarantee of direct 833compatibility, however it should require little effort to port code from the 834original feature to the promoted one. 835 836The Vulkan Working Group endeavours to ensure that larger changes are marked 837as either <<extendingvulkan-compatibility-deprecation, deprecated>> or 838<<extendingvulkan-compatibility-obsoletion, obsoleted>> as appropriate, and 839can do so retroactively if necessary. 840==== 841 842Extensions that are promoted are listed as being promoted in their extension 843appendices, with reference to where they were promoted to. 844 845When an extension is promoted, any backwards compatibility aliases which 846exist in the extension will *not* be promoted. 847 848[NOTE] 849.Note 850==== 851As a hypothetical example, if the `apiext:VK_KHR_surface` extension were 852promoted to part of a future core version, the 853ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR token defined by that extension 854would be promoted to etext:VK_COLOR_SPACE_SRGB_NONLINEAR. 855However, the ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR token aliases 856ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR. 857The ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR would not be promoted, because it 858is a backwards compatibility alias that exists only due to a naming mistake 859when the extension was initially published. 860==== 861 862 863[[extendingvulkan-compatibility-deprecation]] 864==== Deprecation 865 866Extensions may: be marked as deprecated when the intended use cases either 867become irrelevant or can be solved in other ways. 868Generally, a new feature will become available to solve the use case in 869another extension or core version of the API, but it is not guaranteed. 870 871[NOTE] 872.Note 873==== 874Features that are intended to replace deprecated functionality have no 875guarantees of compatibility, and applications may require drastic 876modification in order to make use of the new features. 877==== 878 879Extensions that are deprecated are listed as being deprecated in their 880extension appendices, with an explanation of the deprecation and any 881features that are relevant. 882 883 884[[extendingvulkan-compatibility-obsoletion]] 885==== Obsoletion 886 887Occasionally, an extension will be marked as obsolete if a new version of 888the core API or a new extension is fundamentally incompatible with it. 889An obsoleted extension must: not be used with the extension or core version 890that obsoleted it. 891 892Extensions that are obsoleted are listed as being obsoleted in their 893extension appendices, with reference to what they were obsoleted by. 894 895 896[[extendingvulkan-compatibility-aliases]] 897==== Aliases 898 899When an extension is promoted or deprecated by a newer feature, some or all 900of its functionality may: be replicated into the newer feature. 901Rather than duplication of all the documentation and definitions, the 902specification instead identifies the identical commands and types as 903_aliases_ of one another. 904Each alias is mentioned together with the definition it aliases, with the 905older aliases marked as "`equivalents`". 906Each alias of the same command has identical behavior, and each alias of the 907same type has identical meaning - they can be used interchangeably in an 908application with no compatibility issues. 909 910[NOTE] 911.Note 912==== 913For promoted types, the aliased extension type is semantically identical to 914the new core type. 915The C99 headers simply `typedef` the older aliases to the promoted types. 916 917For promoted command aliases, however, there are two separate entry point 918definitions, due to the fact that the C99 ABI has no way to alias command 919definitions without resorting to macros. 920Calling via either entry point definition will produce identical behavior 921within the bounds of the specification, and should still invoke the same 922entry point in the implementation. 923Debug tools may use separate entry points with different debug behavior; to 924write the appropriate command name to an output log, for instance. 925==== 926 927 928[[extendingvulkan-compatibility-specialuse]] 929==== Special Use Extensions 930 931Some extensions exist only to support a specific purpose or specific class 932of application. 933These are referred to as "`special use extensions`". 934Use of these extensions in applications not meeting the special use criteria 935is not recommended. 936 937Special use cases are restricted, and only those defined below are used to 938describe extensions: 939 940// The attributes in the "Special Use" column are defined in 941// config/attribs.adoc, and used in reference pages as well as here. 942// They define human-readable names for corresponding XML attribute values, 943// so specialuse="cadsupport" -> "CAD Support". They are used in the table 944// here and in the ExtensionMetaDocGenerator script that produces metadata 945// includes for extension appendices. When introducing a new special use, 946// the attribute and the table must both be extended. 947 948[[extendingvulkan-specialuse-table]] 949.Extension Special Use Cases 950[width="100%",options="header",cols="25%,15%,60%"] 951|==== 952| Special Use | XML Tag | Full Description 953| {cadsupport} | cadsupport 954 | Extension is intended to support specialized functionality used by 955 CAD/CAM applications. 956| {d3demulation} | d3demulation 957 | Extension is intended to support D3D emulation layers, and 958 applications ported from D3D, by adding functionality specific to D3D. 959| {devtools} | devtools 960 | Extension is intended to support developer tools such as 961 capture-replay libraries. 962| {debugging} | debugging 963 | Extension is intended for use by applications when debugging. 964| {glemulation} | glemulation 965 | Extension is intended to support OpenGL and/or OpenGL ES emulation 966 layers, and applications ported from those APIs, by adding 967 functionality specific to those APIs. 968|==== 969 970Special use extensions are identified in the metadata for each such 971extension in the <<extensions, Layers & Extensions>> appendix, using the 972name in the "`Special Use`" column above. 973 974Special use extensions are also identified in `vk.xml` with the short name 975in "`XML Tag`" column above, as described in the "`API Extensions 976(`extension` tag)`" section of the <<vulkan-registry, registry schema 977documentation>>. 978 979