77Additional functionality may: be provided by layers or extensions. A layer
88cannot: add or modify Vulkan commands, while an extension may: do so.
99
10- There are two kinds of layers and extensions, instance and device. Instance
11- layers and extensions are general purpose and do not depend on a specific
12- device. Device layers and extensions operate on specific devices, and
13- require a valid sname:VkDevice to be used. Instance extensions usually
14- affect the operation of the API as a whole, whereas device layers and
15- extensions tend to be hardware-specific. Examples of these might be:
16-
17- * Whole API validation is an example of a good instance layer.
10+ The set of layers to enable is specified when creating an instance, and those
11+ layers are able to intercept any Vulkan command dispatched to that instance
12+ or any of its child objects.
13+
14+ Extensions can operate at either the instance or device scope. Enabled instance
15+ extensions are able to affect the operation of the instance and any of its
16+ child objects, while device extensions may: only be available on a subset of
17+ physical devices, must be individually enabled per-device, and only affect the
18+ operation of the devices where they are enabled.
19+
20+ Examples of these might be:
21+
22+ * Whole API validation is an example of a layer.
1823 * Debug capabilities might make a good instance extension.
1924 * A layer that provides hardware-specific performance telemetry and
20- analysis could be a device layer.
25+ analysis could be a layer that is only active for devices created from
26+ compatible physical devices.
2127 * Functions to allow an application to use additional hardware features
2228 beyond the core would be a good candidate for a device extension.
2329
@@ -32,7 +38,7 @@ allowed ranges. Instead, a validation layer would do those checks and flag
3238issues. This avoids a performance penalty during production use of the
3339application because those layers would not be enabled in production.
3440
35- To query the available instance layers, call:
41+ To query the available layers, call:
3642
3743include::../protos/vkEnumerateInstanceLayerProperties.txt[]
3844
@@ -43,48 +49,25 @@ include::../protos/vkEnumerateInstanceLayerProperties.txt[]
4349
4450include::../validity/protos/vkEnumerateInstanceLayerProperties.txt[]
4551
46- To enable a instance layer, the name of the layer should be added to the
47- pname:ppEnabledLayerNames member of slink:VkInstanceCreateInfo when creating
48- a sname:VkInstance.
49-
50- To query the layers available to a given physical device, call:
51-
52- include::../protos/vkEnumerateDeviceLayerProperties.txt[]
53-
54- * pname:physicalDevice is the physical device that will be queried.
55- * pname:pPropertyCount is a pointer to an integer related to the number of
56- layer properties available or queried, as described below.
57- * pname:pProperties is either `NULL` or a pointer to an array of
58- slink:VkLayerProperties structures.
59-
60- include::../validity/protos/vkEnumerateDeviceLayerProperties.txt[]
61-
62- To enable a device layer, the name of the layer should be added to the
63- pname:ppEnabledLayerNames member of slink:VkDeviceCreateInfo when creating
64- a sname:VkDevice.
65-
66- For both flink:vkEnumerateInstanceLayerProperties and
67- flink:vkEnumerateDeviceLayerProperties, if pname:pProperties is `NULL`, then
68- the number of layer properties available is returned in pname:pPropertyCount.
69- Otherwise, pname:pPropertyCount must: point to a variable set by the user to
70- the number of elements in the pname:pProperties array, and on return the
71- variable is overwritten with the number of structures actually written to
72- pname:pProperties. If pname:pPropertyCount is less than the
73- number of layer properties available, at most pname:pPropertyCount
74- structures will be written. If pname:pPropertyCount is smaller than the
75- number of layers available, ename:VK_INCOMPLETE will be returned instead of
76- ename:VK_SUCCESS, to indicate that not all the available layer properties
77- were returned.
52+ If pname:pProperties is `NULL`, then the number of layer properties available
53+ is returned in pname:pPropertyCount. Otherwise, pname:pPropertyCount must:
54+ point to a variable set by the user to the number of elements in the
55+ pname:pProperties array, and on return the variable is overwritten with the
56+ number of structures actually written to pname:pProperties. If
57+ pname:pPropertyCount is less than the number of layer properties available, at
58+ most pname:pPropertyCount structures will be written. If pname:pPropertyCount
59+ is smaller than the number of layers available, ename:VK_INCOMPLETE will be
60+ returned instead of ename:VK_SUCCESS, to indicate that not all the available
61+ layer properties were returned.
7862
7963The sname:VkLayerProperties structure is defined as:
8064
8165include::../structs/VkLayerProperties.txt[]
8266
8367 * pname:layerName is a null-terminated UTF-8 string specifying the name of
8468 the layer. Use this name in the pname:ppEnabledLayerNames array passed
85- in the slink:VkInstanceCreateInfo and slink:VkDeviceCreateInfo
86- structures passed to flink:vkCreateInstance and flink:vkCreateDevice,
87- respectively, to enable this layer for an instance or device.
69+ in the slink:VkInstanceCreateInfo structure to enable this layer for an
70+ instance.
8871 * pname:specVersion is the Vulkan version the layer was written to,
8972 encoded as described in the <<fundamentals-versionnum,API Version
9073 Numbers and Semantics>> section.
@@ -95,16 +78,82 @@ include::../structs/VkLayerProperties.txt[]
9578
9679include::../validity/structs/VkLayerProperties.txt[]
9780
81+ To enable a layer, the name of the layer should be added to the
82+ pname:ppEnabledLayerNames member of slink:VkInstanceCreateInfo when creating
83+ a sname:VkInstance.
84+
9885Loader implementations may: provide mechanisms outside the Vulkan API for
9986enabling specific layers. Layers enabled through such a mechanism are
10087_implicitly enabled_, while layers enabled by including the layer name in
101- the pname:ppEnabledLayerNames member of slink:VkDeviceCreateInfo are
88+ the pname:ppEnabledLayerNames member of slink:VkInstanceCreateInfo are
10289_explicitly enabled_. Except where otherwise specified, implicitly enabled
10390and explicitly enabled layers differ only in the way they are enabled.
10491Explicitly enabling a layer that is implicitly enabled has no additional
10592effect.
10693
10794
95+ [[extended-functionality-device-layer-deprecation]]
96+ === Device Layer Deprecation
97+
98+ Previous versions of this specification distinguished between instance and
99+ device layers. Instance layers were only able to intercept commands that
100+ operate on sname:VkInstance and sname:VkPhysicalDevice, except they were not
101+ able to intercept flink:vkCreateDevice. Device layers were enabled for
102+ individual devices when they were created, and could only intercept commands
103+ operating on that device or its child objects.
104+
105+ Device-only layers are now deprecated, and this specification no longer
106+ distinguishes between instance and device layers. Layers are enabled during
107+ instance creation, and are able to intercept all commands operating on that
108+ instance or any of its child objects. At the time of deprecation there were no
109+ known device-only layers and no compelling reason to create one.
110+
111+ In order to maintain compatibility with implementations released prior to
112+ device-layer deprecation, applications should: still enumerate and enable
113+ device layers. The behavior of fname:vkEnumerateDeviceLayerProperties and
114+ valid usage of the pname:ppEnabledLayerNames member of sname:VkDeviceCreateInfo
115+ maximizes compatibility with applications written to work with the previous
116+ requirements.
117+
118+ Device layers can: be enumerated by calling:
119+
120+ include::../protos/vkEnumerateDeviceLayerProperties.txt[]
121+
122+ * pname:pPropertyCount is a pointer to an integer related to the number of
123+ layer properties available or queried.
124+ * pname:pProperties is either `NULL` or a pointer to an array of
125+ slink:VkLayerProperties structures.
126+
127+ include::../validity/protos/vkEnumerateDeviceLayerProperties.txt[]
128+
129+ If pname:pProperties is `NULL`, then the number of layer properties available
130+ is returned in pname:pPropertyCount. Otherwise, pname:pPropertyCount must:
131+ point to a variable set by the user to the number of elements in the
132+ pname:pProperties array, and on return the variable is overwritten with the
133+ number of structures actually written to pname:pProperties. If
134+ pname:pPropertyCount is less than the number of layer properties available, at
135+ most pname:pPropertyCount structures will be written. If pname:pPropertyCount
136+ is smaller than the number of layers available, ename:VK_INCOMPLETE will be
137+ returned instead of ename:VK_SUCCESS, to indicate that not all the available
138+ layer properties were returned.
139+
140+ The list of layers enumerated by fname:vkEnumerateDeviceLayerProperties must:
141+ be exactly the sequence of layers enabled for the instance. The members of
142+ sname:VkLayerProperties for each enumerated layer must: be the same as the
143+ properties when the layer was enumerated by
144+ fname:vkEnumerateInstanceLayerProperties.
145+
146+ The pname:ppEnabledLayerNames and pname:enabledLayerCount members of
147+ sname:VkDeviceCreateInfo are deprecated and their values must: be ignored by
148+ implementations. However, for compatibility, only an empty list of layers or a
149+ list that exactly matches the sequence enabled at instance creation time are
150+ valid, and validation layers should: issue diagnostics for other cases.
151+
152+ Regardless of the enabled layer list provided in sname:VkDeviceCreateInfo, the
153+ sequence of layers active for a device will be exactly the sequence of layers
154+ enabled when the parent instance was created.
155+
156+
108157[[extended-functionality-extensions]]
109158== Extensions
110159
@@ -123,7 +172,7 @@ To query the available instance extensions, call:
123172include::../protos/vkEnumerateInstanceExtensionProperties.txt[]
124173
125174 * pname:pLayerName is either `NULL` or a pointer to a null-terminated
126- UTF-8 string naming the instance layer to retrieve extensions from.
175+ UTF-8 string naming the layer to retrieve extensions from.
127176 * pname:pPropertyCount is a pointer to an integer related to the number of
128177 extension properties available or queried, as described below.
129178 * pname:pProperties is either `NULL` or a pointer to an array of
@@ -136,7 +185,7 @@ implementation or by implicitly enabled layers are returned.
136185When pname:pLayerName is the name of a layer, the instance extensions
137186provided by that layer are returned.
138187
139- To enable a instance extension, the name of the extension should be added to
188+ To enable an instance extension, the name of the extension should be added to
140189the pname:ppEnabledExtensionNames member of slink:VkInstanceCreateInfo when
141190creating a sname:VkInstance.
142191
@@ -146,7 +195,7 @@ include::../protos/vkEnumerateDeviceExtensionProperties.txt[]
146195
147196 * pname:physicalDevice is the physical device that will be queried.
148197 * pname:pLayerName is either `NULL` or a pointer to a null-terminated
149- UTF-8 string naming the device layer to retrieve extensions from.
198+ UTF-8 string naming the layer to retrieve extensions from.
150199 * pname:pPropertyCount is a pointer to an integer related to the number of
151200 extension properties available or queried, as described below.
152201 * pname:pProperties is either `NULL` or a pointer to an array of
@@ -159,10 +208,6 @@ implementation or by implicitly enabled layers are returned.
159208When pname:pLayerName is the name of a layer, the device extensions
160209provided by that layer are returned.
161210
162- To enable a device layer, the name of the layer should be added to the
163- pname:ppEnabledExtensionNames member of slink:VkDeviceCreateInfo when
164- creating a sname:VkDevice.
165-
166211For both flink:vkEnumerateInstanceExtensionProperties and
167212flink:vkEnumerateDeviceExtensionProperties, if pname:pProperties is `NULL`,
168213then the number of extensions properties available is returned in
0 commit comments