• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015-2021 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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
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.txt[]
227--
228endif::VK_VERSION_1_2[]
229
230
231[[extendingvulkan-coreversions-queryingversionsupport]]
232=== Querying Version Support
233
234ifndef::VK_VERSION_1_1[]
235[NOTE]
236.Note
237====
238In Vulkan 1.0, there is no mechanism to detect the separate versions of
239<<extendingvulkan-instanceanddevicefunctionality,instance-level and
240device-level functionality>> supported.
241However, the fname:vkEnumerateInstanceVersion command was added in Vulkan
2421.1 to determine the supported version of instance-level functionality -
243querying for this function via flink:vkGetInstanceProcAddr will return
244`NULL` on implementations that only support Vulkan 1.0 functionality.
245For more information on this, please refer to the Vulkan 1.1 specification.
246====
247endif::VK_VERSION_1_1[]
248
249ifdef::VK_VERSION_1_1[]
250The version of instance-level functionality can be queried by calling
251flink:vkEnumerateInstanceVersion.
252endif::VK_VERSION_1_1[]
253
254The version of device-level functionality can be queried by calling
255flink:vkGetPhysicalDeviceProperties
256ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[]
257or flink:vkGetPhysicalDeviceProperties2,
258endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[]
259and is returned in slink:VkPhysicalDeviceProperties::pname:apiVersion,
260encoded as described in <<extendingvulkan-coreversions-versionnumbers>>.
261
262
263[[extendingvulkan-layers]]
264== Layers
265
266When a layer is enabled, it inserts itself into the call chain for Vulkan
267commands the layer is interested in.
268Layers can: be used for a variety of tasks that extend the base behavior of
269Vulkan beyond what is required by the specification - such as call logging,
270tracing, validation, or providing additional extensions.
271
272[NOTE]
273.Note
274====
275For example, an implementation is not expected to check that the value of
276enums used by the application fall within allowed ranges.
277Instead, a validation layer would do those checks and flag issues.
278This avoids a performance penalty during production use of the application
279because those layers would not be enabled in production.
280====
281
282[NOTE]
283.Note
284====
285Vulkan layers may: wrap object handles (i.e. return a different handle value
286to the application than that generated by the implementation).
287This is generally discouraged, as it increases the probability of
288incompatibilities with new extensions.
289The validation layers wrap handles in order to track the proper use and
290destruction of each object.
291See the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader
292Interfaces`">> document for additional information.
293====
294
295[open,refpage='vkEnumerateInstanceLayerProperties',desc='Returns up to requested number of global layer properties',type='protos']
296--
297To query the available layers, call:
298
299include::{generated}/api/protos/vkEnumerateInstanceLayerProperties.txt[]
300
301  * pname:pPropertyCount is a pointer to an integer related to the number of
302    layer properties available or queried, as described below.
303  * pname:pProperties is either `NULL` or a pointer to an array of
304    slink:VkLayerProperties structures.
305
306If pname:pProperties is `NULL`, then the number of layer properties
307available is returned in pname:pPropertyCount.
308Otherwise, pname:pPropertyCount must: point to a variable set by the user to
309the number of elements in the pname:pProperties array, and on return the
310variable is overwritten with the number of structures actually written to
311pname:pProperties.
312If pname:pPropertyCount is less than the number of layer properties
313available, at most pname:pPropertyCount structures will be written, and
314ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
315indicate that not all the available properties were returned.
316
317The list of available layers may change at any time due to actions outside
318of the Vulkan implementation, so two calls to
319fname:vkEnumerateInstanceLayerProperties with the same parameters may:
320return different results, or retrieve different pname:pPropertyCount values
321or pname:pProperties contents.
322Once an instance has been created, the layers enabled for that instance will
323continue to be enabled and valid for the lifetime of that instance, even if
324some of them become unavailable for future instances.
325
326include::{generated}/validity/protos/vkEnumerateInstanceLayerProperties.txt[]
327--
328
329[open,refpage='VkLayerProperties',desc='Structure specifying layer properties',type='structs']
330--
331The sname:VkLayerProperties structure is defined as:
332
333include::{generated}/api/structs/VkLayerProperties.txt[]
334
335  * pname:layerName is an array of ename:VK_MAX_EXTENSION_NAME_SIZE
336    code:char containing a null-terminated UTF-8 string which is the name of
337    the layer.
338    Use this name in the pname:ppEnabledLayerNames array passed in the
339    slink:VkInstanceCreateInfo structure to enable this layer for an
340    instance.
341  * pname:specVersion is the Vulkan version the layer was written to,
342    encoded as described in <<extendingvulkan-coreversions-versionnumbers>>.
343  * pname:implementationVersion is the version of this layer.
344    It is an integer, increasing with backward compatible changes.
345  * pname:description is an array of ename:VK_MAX_DESCRIPTION_SIZE code:char
346    containing a null-terminated UTF-8 string which provides additional
347    details that can: be used by the application to identify the layer.
348
349include::{generated}/validity/structs/VkLayerProperties.txt[]
350--
351
352[open,refpage='VK_MAX_EXTENSION_NAME_SIZE',desc='Maximum length of a layer of extension name string',type='consts']
353--
354ename:VK_MAX_EXTENSION_NAME_SIZE is the length in code:char values of an
355array containing a layer or extension name string, as returned in
356slink:VkLayerProperties::layerName,
357slink:VkExtensionProperties::extensionName, and other queries.
358
359include::{generated}/api/enums/VK_MAX_EXTENSION_NAME_SIZE.txt[]
360--
361
362[open,refpage='VK_MAX_DESCRIPTION_SIZE',desc='Length of a driver name string',type='consts']
363--
364ename:VK_MAX_DESCRIPTION_SIZE is the length in code:char values of an array
365containing a string with additional descriptive information about a query,
366as returned in slink:VkLayerProperties::description and other queries.
367
368include::{generated}/api/enums/VK_MAX_DESCRIPTION_SIZE.txt[]
369--
370
371To enable a layer, the name of the layer should: be added to the
372pname:ppEnabledLayerNames member of slink:VkInstanceCreateInfo when creating
373a sname:VkInstance.
374
375Loader implementations may: provide mechanisms outside the Vulkan API for
376enabling specific layers.
377Layers enabled through such a mechanism are _implicitly enabled_, while
378layers enabled by including the layer name in the pname:ppEnabledLayerNames
379member of slink:VkInstanceCreateInfo are _explicitly enabled_.
380Implicitly enabled layers are loaded before explicitly enabled layers, such
381that implicitly enabled layers are closer to the application, and explicitly
382enabled layers are closer to the driver.
383Except where otherwise specified, implicitly enabled and explicitly enabled
384layers differ only in the way they are enabled, and the order in which they
385are loaded.
386Explicitly enabling a layer that is implicitly enabled results in this layer
387being loaded as an implicitly enabled layer; it has no additional effect.
388
389
390[[extendingvulkan-layers-devicelayerdeprecation]]
391=== Device Layer Deprecation
392
393Previous versions of this specification distinguished between instance and
394device layers.
395Instance layers were only able to intercept commands that operate on
396sname:VkInstance and sname:VkPhysicalDevice, except they were not able to
397intercept flink:vkCreateDevice.
398Device layers were enabled for individual devices when they were created,
399and could only intercept commands operating on that device or its child
400objects.
401
402Device-only layers are now deprecated, and this specification no longer
403distinguishes between instance and device layers.
404Layers are enabled during instance creation, and are able to intercept all
405commands operating on that instance or any of its child objects.
406At the time of deprecation there were no known device-only layers and no
407compelling reason to create one.
408
409In order to maintain compatibility with implementations released prior to
410device-layer deprecation, applications should: still enumerate and enable
411device layers.
412The behavior of fname:vkEnumerateDeviceLayerProperties and valid usage of
413the pname:ppEnabledLayerNames member of slink:VkDeviceCreateInfo maximizes
414compatibility with applications written to work with the previous
415requirements.
416
417[open,refpage='vkEnumerateDeviceLayerProperties',desc='Returns properties of available physical device layers',type='protos']
418--
419To enumerate device layers, call:
420
421include::{generated}/api/protos/vkEnumerateDeviceLayerProperties.txt[]
422
423  * pname:pPropertyCount is a pointer to an integer related to the number of
424    layer properties available or queried.
425  * pname:pProperties is either `NULL` or a pointer to an array of
426    slink:VkLayerProperties structures.
427
428If pname:pProperties is `NULL`, then the number of layer properties
429available is returned in pname:pPropertyCount.
430Otherwise, pname:pPropertyCount must: point to a variable set by the user to
431the number of elements in the pname:pProperties array, and on return the
432variable is overwritten with the number of structures actually written to
433pname:pProperties.
434If pname:pPropertyCount is less than the number of layer properties
435available, at most pname:pPropertyCount structures will be written, and
436ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
437indicate that not all the available properties were returned.
438
439The list of layers enumerated by fname:vkEnumerateDeviceLayerProperties
440must: be exactly the sequence of layers enabled for the instance.
441The members of sname:VkLayerProperties for each enumerated layer must: be
442the same as the properties when the layer was enumerated by
443fname:vkEnumerateInstanceLayerProperties.
444
445include::{generated}/validity/protos/vkEnumerateDeviceLayerProperties.txt[]
446--
447
448The pname:ppEnabledLayerNames and pname:enabledLayerCount members of
449slink:VkDeviceCreateInfo are deprecated and their values must: be ignored by
450implementations.
451However, for compatibility, only an empty list of layers or a list that
452exactly matches the sequence enabled at instance creation time are valid,
453and validation layers should: issue diagnostics for other cases.
454
455Regardless of the enabled layer list provided in slink:VkDeviceCreateInfo,
456the sequence of layers active for a device will be exactly the sequence of
457layers enabled when the parent instance was created.
458
459
460[[extendingvulkan-extensions]]
461== Extensions
462
463Extensions may: define new Vulkan commands, structures, and enumerants.
464For compilation purposes, the interfaces defined by registered extensions,
465including new structures and enumerants as well as function pointer types
466for new commands, are defined in the Khronos-supplied `{core_header}`
467together with the core API.
468However, commands defined by extensions may: not be available for static
469linking - in which case function pointers to these commands should: be
470queried at runtime as described in <<initialization-functionpointers>>.
471Extensions may: be provided by layers as well as by a Vulkan implementation.
472
473Because extensions may: extend or change the behavior of the Vulkan API,
474extension authors should: add support for their extensions to the Khronos
475validation layers.
476This is especially important for new commands whose parameters have been
477wrapped by the validation layers.
478See the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader
479Interfaces`">> document for additional information.
480
481[NOTE]
482.Note
483====
484To enable an instance extension, the name of the extension can: be added to
485the pname:ppEnabledExtensionNames member of slink:VkInstanceCreateInfo when
486creating a sname:VkInstance.
487
488To enable a device extension, the name of the extension can: be added to the
489pname:ppEnabledExtensionNames member of slink:VkDeviceCreateInfo when
490creating a sname:VkDevice.
491
492ifdef::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[]
493Physical-Device-Level functionality does not have any enabling mechanism and
494can: be used as long as the slink:VkPhysicalDevice supports the device
495extension as determined by flink:vkEnumerateDeviceExtensionProperties.
496endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[]
497
498Enabling an extension (with no further use of that extension) does not
499change the behavior of functionality exposed by the core Vulkan API or any
500other extension, other than making valid the use of the commands, enums and
501structures defined by that extension.
502
503Valid Usage sections for individual commands and structures do not currently
504contain which extensions have to be enabled in order to make their use
505valid, although they might do so in the future.
506It is defined only in the <<fundamentals-validusage-extensions>> section.
507====
508
509
510=== Instance Extensions
511
512Instance extensions add new
513<<extendingvulkan-instanceanddevicefunctionality,instance-level
514functionality>> to the API, outside of the core specification.
515
516[open,refpage='vkEnumerateInstanceExtensionProperties',desc='Returns up to requested number of global extension properties',type='protos']
517--
518To query the available instance extensions, call:
519
520include::{generated}/api/protos/vkEnumerateInstanceExtensionProperties.txt[]
521
522  * pname:pLayerName is either `NULL` or a pointer to a null-terminated
523    UTF-8 string naming the layer to retrieve extensions from.
524  * pname:pPropertyCount is a pointer to an integer related to the number of
525    extension properties available or queried, as described below.
526  * pname:pProperties is either `NULL` or a pointer to an array of
527    slink:VkExtensionProperties structures.
528
529When pname:pLayerName parameter is `NULL`, only extensions provided by the
530Vulkan implementation or by implicitly enabled layers are returned.
531When pname:pLayerName is the name of a layer, the instance extensions
532provided by that layer are returned.
533
534If pname:pProperties is `NULL`, then the number of extensions properties
535available is returned in pname:pPropertyCount.
536Otherwise, pname:pPropertyCount must: point to a variable set by the user to
537the number of elements in the pname:pProperties array, and on return the
538variable is overwritten with the number of structures actually written to
539pname:pProperties.
540If pname:pPropertyCount is less than the number of extension properties
541available, at most pname:pPropertyCount structures will be written, and
542ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
543indicate that not all the available properties were returned.
544
545Because the list of available layers may change externally between calls to
546flink:vkEnumerateInstanceExtensionProperties, two calls may retrieve
547different results if a pname:pLayerName is available in one call but not in
548another.
549The extensions supported by a layer may also change between two calls, e.g.
550if the layer implementation is replaced by a different version between those
551calls.
552
553Implementations must: not advertise any pair of extensions that cannot be
554enabled together due to behavioral differences, or any extension that cannot
555be enabled against the advertised version.
556
557include::{generated}/validity/protos/vkEnumerateInstanceExtensionProperties.txt[]
558--
559
560
561=== Device Extensions
562
563Device extensions add new
564<<extendingvulkan-instanceanddevicefunctionality,device-level
565functionality>> to the API, outside of the core specification.
566
567[open,refpage='vkEnumerateDeviceExtensionProperties',desc='Returns properties of available physical device extensions',type='protos']
568--
569To query the extensions available to a given physical device, call:
570
571include::{generated}/api/protos/vkEnumerateDeviceExtensionProperties.txt[]
572
573  * pname:physicalDevice is the physical device that will be queried.
574  * pname:pLayerName is either `NULL` or a pointer to a null-terminated
575    UTF-8 string naming the layer to retrieve extensions from.
576  * pname:pPropertyCount is a pointer to an integer related to the number of
577    extension properties available or queried, and is treated in the same
578    fashion as the
579    flink:vkEnumerateInstanceExtensionProperties::pname:pPropertyCount
580    parameter.
581  * pname:pProperties is either `NULL` or a pointer to an array of
582    slink:VkExtensionProperties structures.
583
584When pname:pLayerName parameter is `NULL`, only extensions provided by the
585Vulkan implementation or by implicitly enabled layers are returned.
586When pname:pLayerName is the name of a layer, the device extensions provided
587by that layer are returned.
588
589Implementations must: not advertise any pair of extensions that cannot be
590enabled together due to behavioral differences, or any extension that cannot
591be enabled against the advertised version.
592
593include::{generated}/validity/protos/vkEnumerateDeviceExtensionProperties.txt[]
594--
595
596[open,refpage='VkExtensionProperties',desc='Structure specifying an extension properties',type='structs']
597--
598The sname:VkExtensionProperties structure is defined as:
599
600include::{generated}/api/structs/VkExtensionProperties.txt[]
601
602  * pname:extensionName is an array of ename:VK_MAX_EXTENSION_NAME_SIZE
603    code:char containing a null-terminated UTF-8 string which is the name of
604    the extension.
605  * pname:specVersion is the version of this extension.
606    It is an integer, incremented with backward compatible changes.
607
608include::{generated}/validity/structs/VkExtensionProperties.txt[]
609--
610
611
612[[extendingvulkan-extensions-extensiondependencies]]
613== Extension Dependencies
614
615Some extensions are dependent on other extensions, or on specific core API
616versions, to function.
617To enable extensions with dependencies, any _required extensions_ must: also
618be enabled through the same API mechanisms when creating an instance with
619flink:vkCreateInstance or a device with flink:vkCreateDevice.
620Each extension which has such dependencies documents them in the
621<<extensions, appendix summarizing that extension>>.
622
623If an extension is supported (as queried by
624flink:vkEnumerateInstanceExtensionProperties or
625flink:vkEnumerateDeviceExtensionProperties), then _required extensions_ of
626that extension must: also be supported for the same instance or physical
627device.
628
629Any device extension that has an instance extension dependency that is not
630enabled by flink:vkCreateInstance is considered to be unsupported, hence it
631must: not be returned by flink:vkEnumerateDeviceExtensionProperties for any
632slink:VkPhysicalDevice child of the instance.
633Instance extensions do not have dependencies on device extensions.
634
635If a required extension has been <<extendingvulkan-compatibility-promotion,
636promoted>> to another extension or to a core API version, then as a
637_general_ rule, the dependency is also satisfied by the promoted extension
638or core version.
639This will be true so long as any features required by the original extension
640are also required or enabled by the promoted extension or core version.
641However, in some cases an extension is promoted while making some of its
642features optional in the promoted extension or core version.
643In this case, the dependency may: not be satisfied.
644The only way to be certain is to look at the descriptions of the original
645dependency and the promoted version in the <<extensions, Layers &
646Extensions>> and <<versions, Core Revisions>> appendices.
647
648[NOTE]
649.Note
650====
651There is metadata in `vk.xml` describing some aspects of promotion,
652especially `requires`, `promotedto` and `deprecatedby` attributes of
653`<extension>` tags.
654However, the metadata does not yet fully describe this scenario.
655In the future, we may extend the XML schema to describe the full set of
656extensions and versions satisfying a dependency.
657====
658
659
660== Compatibility Guarantees (Informative)
661
662This section is marked as informal as there is no binding responsibility on
663implementations of the Vulkan API - these guarantees are however a contract
664between the Vulkan Working Group and developers using this Specification.
665
666
667[[extendingvulkan-compatibility-coreversions]]
668=== Core Versions
669
670Each of the <<extendingvulkan-coreversions,major, minor, and patch
671versions>> of the Vulkan specification provide different compatibility
672guarantees.
673
674
675==== Patch Versions
676
677A difference in the patch version indicates that a set of bug fixes or
678clarifications have been made to the Specification.
679Informative enums returned by Vulkan commands that will not affect the
680runtime behavior of a valid application may be added in a patch version
681(e.g. elink:VkVendorId).
682
683The specification's patch version is strictly increasing for a given major
684version of the specification; any change to a specification as described
685above will result in the patch version being increased by 1.
686Patch versions are applied to all minor versions, even if a given minor
687version is not affected by the provoking change.
688
689Specifications with different patch versions but the same major and minor
690version are _fully compatible_ with each other - such that a valid
691application written against one will work with an implementation of another.
692
693[NOTE]
694.Note
695====
696If a patch version includes a bug fix or clarification that could have a
697significant impact on developer expectations, these will be highlighted in
698the change log.
699Generally the Vulkan Working Group tries to avoid these kinds of changes,
700instead fixing them in either an extension or core version.
701====
702
703
704==== Minor Versions
705
706Changes in the minor version of the specification indicate that new
707functionality has been added to the core specification.
708This will usually include new interfaces in the header, and may: also
709include behavior changes and bug fixes.
710Core functionality may: be deprecated in a minor version, but will not be
711obsoleted or removed.
712
713The specification's minor version is strictly increasing for a given major
714version of the specification; any change to a specification as described
715above will result in the minor version being increased by 1.
716Changes that can be accommodated in a patch version will not increase the
717minor version.
718
719Specifications with a lower minor version are _backwards compatible_ with an
720implementation of a specification with a higher minor version for core
721functionality and extensions issued with the KHR vendor tag.
722Vendor and multi-vendor extensions are not guaranteed to remain functional
723across minor versions, though in general they are with few exceptions - see
724<<extendingvulkan-compatibility-obsoletion>> for more information.
725
726
727==== Major Versions
728
729A difference in the major version of specifications indicates a large set of
730changes which will likely include interface changes, behavioral changes,
731removal of <<extendingvulkan-compatibility-deprecation,deprecated
732functionality>>, and the modification, addition, or replacement of other
733functionality.
734
735The specification's major version is monotonically increasing; any change to
736the specification as described above will result in the major version being
737increased.
738Changes that can be accommodated in a patch or minor version will not
739increase the major version.
740
741The Vulkan Working Group intends to only issue a new major version of the
742Specification in order to realise significant improvements to the Vulkan API
743that will necessarily require breaking compatibility.
744
745A new major version will likely include a wholly new version of the
746specification to be issued - which could include an overhaul of the
747versioning semantics for the minor and patch versions.
748The patch and minor versions of a specification are therefore not meaningful
749across major versions.
750If a major version of the specification includes similar versioning
751semantics, it is expected that the patch and the minor version will be reset
752to 0 for that major version.
753
754
755[[extendingvulkan-compatibility-extensions]]
756=== Extensions
757
758A KHR extension must: be able to be enabled alongside any other KHR
759extension, and for any minor or patch version of the core Specification
760beyond the minimum version it requires.
761A multi-vendor extension should: be able to be enabled alongside any KHR
762extension or other multi-vendor extension, and for any minor or patch
763version of the core Specification beyond the minimum version it requires.
764A vendor extension should: be able to be enabled alongside any KHR
765extension, multi-vendor extension, or other vendor extension from the same
766vendor, and for any minor or patch version of the core Specification beyond
767the minimum version it requires.
768A vendor extension may: be able to be enabled alongside vendor extensions
769from another vendor.
770
771The one other exception to this is if a vendor or multi-vendor extension is
772<<extendingvulkan-compatibility-obsoletion, made obsolete>> by either a core
773version or another extension, which will be highlighted in the
774<<extensions,extension appendix>>.
775
776
777[[extendingvulkan-compatibility-promotion]]
778==== Promotion
779
780Extensions, or features of an extension, may: be promoted to a new
781<<versions,core version of the API>>, or a newer extension which an equal or
782greater number of implementors are in favour of.
783
784When extension functionality is promoted, minor changes may: be introduced,
785limited to the following:
786
787  * Naming
788  * Non-intrusive parameters changes
789  * <<features,Feature advertisement/enablement>>
790  * Combining structure parameters into larger structures
791  * Author ID suffixes changed or removed
792
793[NOTE]
794.Note
795====
796If extension functionality is promoted, there is no guarantee of direct
797compatibility, however it should require little effort to port code from the
798original feature to the promoted one.
799
800The Vulkan Working Group endeavours to ensure that larger changes are marked
801as either <<extendingvulkan-compatibility-deprecation, deprecated>> or
802<<extendingvulkan-compatibility-obsoletion, obsoleted>> as appropriate, and
803can do so retroactively if necessary.
804====
805
806Extensions that are promoted are listed as being promoted in their extension
807appendices, with reference to where they were promoted to.
808
809When an extension is promoted, any backwards compatibility aliases which
810exist in the extension will *not* be promoted.
811
812[NOTE]
813.Note
814====
815As a hypothetical example, if the `apiext:VK_KHR_surface` extension were
816promoted to part of a future core version, the
817ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR token defined by that extension
818would be promoted to etext:VK_COLOR_SPACE_SRGB_NONLINEAR.
819However, the ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR token aliases
820ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR.
821The ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR would not be promoted, because it
822is a backwards compatibility alias that exists only due to a naming mistake
823when the extension was initially published.
824====
825
826
827[[extendingvulkan-compatibility-deprecation]]
828==== Deprecation
829
830Extensions may: be marked as deprecated when the intended use cases either
831become irrelevant or can be solved in other ways.
832Generally, a new feature will become available to solve the use case in
833another extension or core version of the API, but it is not guaranteed.
834
835[NOTE]
836.Note
837====
838Features that are intended to replace deprecated functionality have no
839guarantees of compatibility, and applications may require drastic
840modification in order to make use of the new features.
841====
842
843Extensions that are deprecated are listed as being deprecated in their
844extension appendices, with an explanation of the deprecation and any
845features that are relevant.
846
847
848[[extendingvulkan-compatibility-obsoletion]]
849==== Obsoletion
850
851Occasionally, an extension will be marked as obsolete if a new version of
852the core API or a new extension is fundamentally incompatible with it.
853An obsoleted extension must: not be used with the extension or core version
854that obsoleted it.
855
856Extensions that are obsoleted are listed as being obsoleted in their
857extension appendices, with reference to what they were obsoleted by.
858
859
860[[extendingvulkan-compatibility-aliases]]
861==== Aliases
862
863When an extension is promoted or deprecated by a newer feature, some or all
864of its functionality may: be replicated into the newer feature.
865Rather than duplication of all the documentation and definitions, the
866specification instead identifies the identical commands and types as
867_aliases_ of one another.
868Each alias is mentioned together with the definition it aliases, with the
869older aliases marked as "`equivalents`".
870Each alias of the same command has identical behavior, and each alias of the
871same type has identical meaning - they can be used interchangeably in an
872application with no compatibility issues.
873
874[NOTE]
875.Note
876====
877For promoted types, the aliased extension type is semantically identical to
878the new core type.
879The C99 headers simply `typedef` the older aliases to the promoted types.
880
881For promoted command aliases, however, there are two separate entry point
882definitions, due to the fact that the C99 ABI has no way to alias command
883definitions without resorting to macros.
884Calling via either entry point definition will produce identical behavior
885within the bounds of the specification, and should still invoke the same
886entry point in the implementation.
887Debug tools may use separate entry points with different debug behavior; to
888write the appropriate command name to an output log, for instance.
889====
890
891
892[[extendingvulkan-compatibility-specialuse]]
893==== Special Use Extensions
894
895Some extensions exist only to support a specific purpose or specific class
896of application.
897These are referred to as "`special use extensions`".
898Use of these extensions in applications not meeting the special use criteria
899is not recommended.
900
901Special use cases are restricted, and only those defined below are used to
902describe extensions:
903
904// The attributes in the "Special Use" column are defined in
905// config/attribs.txt, and used in reference pages as well as here.
906// They define human-readable names for corresponding XML attribute values,
907// so specialuse="cadsupport" -> "CAD Support". They are used in the table
908// here and in the ExtensionMetaDocGenerator script that produces metadata
909// includes for extension appendices. When introducing a new special use,
910// the attribute and the table must both be extended.
911
912[[extendingvulkan-specialuse-table]]
913.Extension Special Use Cases
914[width="100%",options="header",cols="25%,15%,60%"]
915|====
916| Special Use    | XML Tag      | Full Description
917| {cadsupport}   | cadsupport
918    | Extension is intended to support specialized functionality used by
919      CAD/CAM applications.
920| {d3demulation} | d3demulation
921    | Extension is intended to support D3D emulation layers, and
922      applications ported from D3D, by adding functionality specific to D3D.
923| {devtools}     | devtools
924    | Extension is intended to support developer tools such as
925      capture-replay libraries.
926| {debugging}    | debugging
927    | Extension is intended for use by applications when debugging.
928| {glemulation}  | glemulation
929    | Extension is intended to support OpenGL and/or OpenGL ES emulation
930      layers, and applications ported from those APIs, by adding
931      functionality specific to those APIs.
932|====
933
934Special use extensions are identified in the metadata for each such
935extension in the <<extensions, Layers & Extensions>> appendix, using the
936name in the "`Special Use`" column above.
937
938Special use extensions are also identified in `vk.xml` with the short name
939in "`XML Tag`" column above, as described in the "`API Extensions
940(`extension` tag)`" section of the <<vulkan-registry, registry schema
941documentation>>.
942
943