blob: 611b68b62398a6e25bffc51c456d112c1d4f5590 [file] [log] [blame]
Jon Ashburn6121daf2015-07-24 09:20:11 -06001This is a specification for how the Vulkan loader should identify Vulkan
2installable client drivers (ICDs) and layers on Linux systems. This is
3designed for production installation of Vulkan ICDs and layers. The design is
4shown first for ICDs, and then the variation for layers will be discussed.
Jon Ashburn4a511f12015-07-16 10:54:55 -06005
6
71. Installable Client Drivers:
8
9
101.1. Properly-Installed ICDs
11
12In order to find properly-installed ICDs, the Vulkan loader will scan the files
13in the following Linux directories:
14
15/usr/share/vulkan/icd.d
16/etc/vulkan/icd.d
17
18These directories will contain text information files (a.k.a. "manifest
Jon Ashburn6121daf2015-07-24 09:20:11 -060019files"), that use a JSON format (NOTE: The JSON in this version of the
Jon Ashburnf2a944f2015-11-18 16:46:48 -070020specification is for illustration purposes, and isn't completely valid yet).
Jon Ashburn6121daf2015-07-24 09:20:11 -060021The Vulkan loader will open each info file to obtain the name or pathname of an
jon5b1e34d2015-10-29 15:51:28 -060022ICD shared library (".so") file. For example:
Jon Ashburn4a511f12015-07-16 10:54:55 -060023
24{
25 "file_format_version": "1.0.0",
26 "ICD": {
27 "library_path": "path to ICD library",
Tony Barbourfd2f7882016-01-14 10:40:40 -070028 "api_version": "1.0.1"
Jon Ashburn4a511f12015-07-16 10:54:55 -060029 }
30}
31
Jon Ashburnf2a944f2015-11-18 16:46:48 -070032The "library_path" specifies either a filename, a relative pathname, or a full
33pathname to an ICD shared library file. If the ICD is specified via a
34filename, the loader will attempt to open that file as a shared object using
35dlopen(), and the file must be in a directory that dlopen is configured to look
36in (Note: various distributions are configured differently). A distribution is
37free to create Vulkan-specific system directories (e.g. ".../vulkan/icd"), but
38is not required to do so. If the ICD is specified via a relative pathname, it
39is relative to the path of the info file. Relative pathnames are those that do
40not start with, but do contain at least one directory separator (i.e. the '/'
41character). For example, "lib/vendora.so" and "./vendora.so" are examples of
42relative pathnames.
Jon Ashburn4a511f12015-07-16 10:54:55 -060043
jon5b1e34d2015-10-29 15:51:28 -060044The "file_format_version" provides a major.minor.patch version number in case
Jon Ashburn4a511f12015-07-16 10:54:55 -060045the format of the text information file changes in the future. If the same ICD
46shared library supports multiple, incompatible versions of text info file
47format versions, it must have multiple text info files (all of which may point
48to the same shared library).
49
Jon Ashburnf2a944f2015-11-18 16:46:48 -070050The “api_version” specifies the major.minor.patch version number of the Vulkan
51API that the shared library (referenced by "library_path") was built with.
Jon Ashburn4a511f12015-07-16 10:54:55 -060052
jon5b1e34d2015-10-29 15:51:28 -060053The "/usr/share/vulkan/icd.d" directory is for ICDs that are installed from
54Linux-distribution-provided packages. The "/etc/vulkan/icd.d" directory is for
Jon Ashburn4a511f12015-07-16 10:54:55 -060055ICDs that are installed from non-Linux-distribution-provided packages.
56
57There are no rules about the name of the text files (except the .json suffix).
58There are no rules about the name of the ICD shared library files. For
jon5b1e34d2015-10-29 15:51:28 -060059example, if the "/usr/share/vulkan/icd.d" directory contain the following
Jon Ashburn4a511f12015-07-16 10:54:55 -060060files, with the specified contents:
61
62 Text File Name Text File Contents
63 --------------------------------------------------------------------------
64 vk_vendora.json { "ICD": { "library_path": "vendora.so" }}
65 vendorb_vk.json { "ICD": { "library_path": "vendorb_vulkan_icd.so" }}
66 vendorc_icd.json { "ICD": { "library_path": "/usr/lib/VENDORC/icd.so" }}
67
jon5b1e34d2015-10-29 15:51:28 -060068then the loader will open the three files mentioned in the "Text File Contents"
Jon Ashburn6121daf2015-07-24 09:20:11 -060069column, and then try to load and use the three shared libraries mentioned
Jon Ashburn4a511f12015-07-16 10:54:55 -060070indicated by the ICD.library_path value.
71
72
731.2. Using Pre-Production ICDs
74
75IHV developers (and sometimes other developers) need to use special,
76pre-production ICDs. In some cases, a pre-production ICD may be in an
77installable package. In other cases, a pre-production ICD may simply be a
Jon Ashburnf2a944f2015-11-18 16:46:48 -070078shared library in the developer's build tree. In this latter case, we want to
Jon Ashburn4a511f12015-07-16 10:54:55 -060079allow developers to point to such an ICD without modifying the
80properly-installed ICD(s) on their system.
81
jon5b1e34d2015-10-29 15:51:28 -060082This need is met with the use of the "VK_ICD_FILENAMES" environment variable,
Jon Ashburn4a511f12015-07-16 10:54:55 -060083which will override the mechanism used for finding properly-installed ICDs. In
jon5b1e34d2015-10-29 15:51:28 -060084other words, only the ICDs listed in "VK_ICD_FILENAMES" will be used.
Jon Ashburn4a511f12015-07-16 10:54:55 -060085
jon5b1e34d2015-10-29 15:51:28 -060086The "VK_ICD_FILENAMES" environment variable is a colon-separated list of ICD
Jon Ashburn4a511f12015-07-16 10:54:55 -060087text information files, containing the following:
88
jon5b1e34d2015-10-29 15:51:28 -060089- A filename (e.g. "libvkicd.json") in the "/usr/share/vulkan/icd.d" or
90 "/etc/vulkan/icd.d" system directories
91- A full pathname (e.g. "/my_build/my_icd.json")
Jon Ashburn4a511f12015-07-16 10:54:55 -060092
jon5b1e34d2015-10-29 15:51:28 -060093Typically, "VK_ICD_FILENAMES" will only contain a full pathname to one info
Jon Ashburn4a511f12015-07-16 10:54:55 -060094file for a developer-built ICD. A colon is only used if more than one ICD is
95listed.
96
97For example, if a developer wants to refer to one ICD that they built, they
jon5b1e34d2015-10-29 15:51:28 -060098could set the "VK_ICD_FILENAMES" environment variable to:
Jon Ashburn4a511f12015-07-16 10:54:55 -060099
100 /my_build/my_icd.json
101
102If a developer wants to refer to two ICDs, one of which is a properly-installed
103ICD, they can use the name of the text file in the system directory:
104
105 vendorc_vulkan.json:/my_build/my_icd.json
106
jon5b1e34d2015-10-29 15:51:28 -0600107Notice the colon between "vendorc_vulkan.json" and "/my_build/my_icd.json".
Jon Ashburn4a511f12015-07-16 10:54:55 -0600108
109NOTE: this environment variable will be ignored for suid programs.
110
111
1122. Layers:
113
114
1152.1. Properly-Installed Layers
116
117In order to find properly-installed layers, the Vulkan loader will use a
118similar mechanism as used for ICDs. Text information files, that use a JSON
119format, are read in order to identify the names and attributes of layers and
120their extensions. The use of text info files allows the loader to avoid
121loading any shared library files when the application does not query nor
122request any extensions. Layers and extensions have additional complexity, and
123so their info files contain more information than ICD info files. For example,
124a layer shared library file may contain multiple layers/extensions (perhaps
125even an ICD).
126
127The Vulkan loader will scan the files in the following Linux directories:
128
129/usr/share/vulkan/explicit_layer.d
130/usr/share/vulkan/implicit_layer.d
131/etc/vulkan/explicit_layer.d
132/etc/vulkan/implicit_layer.d
133
134Explicit layers are those which are enabled by an application (e.g. with the
135vkCreateInstance function), or by an environment variable (see below).
136Implicit layers are those which are enabled by their existence. For example,
137certain application environments (e.g. Steam or an automotive infotainment
138system) may have layers which they always want enabled for all applications
139that they start. Other implicit layers may be for all applications started
140on a given system (e.g. layers that overlay frames-per-second). Implicit
141layers are enabled automatically, whereas explicit
142layers must be enabled explicitly. What distinguishes a layer as implicit or
143explicit is by which directory its layer information file exists in.
144
jon5b1e34d2015-10-29 15:51:28 -0600145The "/usr/share/vulkan/*_layer.d" directories are for ICDs that are installed
146from Linux-distribution-provided packages. The "/etc/vulkan/*_layer.d"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600147directories are for ICDs that are installed from
148non-Linux-distribution-provided packages.
149
150The information file is in the JSON format and contains the following
151information:
152
jon5b1e34d2015-10-29 15:51:28 -0600153- (required) "file_format_version" – same as for ICDs, except that the format
Jon Ashburn4a511f12015-07-16 10:54:55 -0600154 version can vary independently for ICDs and layers.
155- (required) "name" - layer name
156- (required) "type" - which layer chains should the layer be activated on.
157 Allowable values are "INSTANCE", "DEVICE", "GLOBAL". Global means activate
158 on both device and instance chains.
jon5b1e34d2015-10-29 15:51:28 -0600159- (required) "library_path" - filename / full path / relative path to the text
Jon Ashburn4a511f12015-07-16 10:54:55 -0600160 file
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700161- (required) "api_version" – same as for ICDs.
162- (required) "implementation_version" – layer version, a single number increasing with backward compatible changes.
jon5b1e34d2015-10-29 15:51:28 -0600163- (required) "description" – informative decription of the layer.
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700164- (optional) "device_extensions" or "instance_extensions" - array of extension information as follows
165- (optional) extension "name" - Vulkan registered name
166- (optional) extension "spec_version" - extension specification version, a single number, increasing with backward compatible changes.
167- (optional) extension "entrypoints" - array of device extension entrypoints; not used for instance extensions
jon5b1e34d2015-10-29 15:51:28 -0600168- (sometimes required) "functions" - mapping list of function entry points. If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600169 multiple layers exist within the same shared library (or if a layer is in the
170 same shared library as an ICD), this must be specified to allow each layer to
171 have its own vkGet*ProcAddr entrypoints that can be found by the loader. At
172 this time, only the following two functions are required:
jon5b1e34d2015-10-29 15:51:28 -0600173 - "vkGetInstanceProcAddr" name
174 - "vkGetDeviceProcAddr" name
175- (optional for implicit layers) "enable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600176 environment variable and value required to enable an implicit layer. This
177 environment variable (which should vary with each "version" of the layer, as
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700178 in "ENABLE_LAYER_FOO_1") must be set to the given value or else the
Jon Ashburn4a511f12015-07-16 10:54:55 -0600179 implicit layer is not loaded. This is for application environments
180 (e.g. Steam) which want to enable a layer(s) only for applications that they
181 launch, and allows for applications run outside of an application environment
182 to not get that implicit layer(s).
jon5b1e34d2015-10-29 15:51:28 -0600183- (required for implicit layers) "disable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600184 environment variable and value required to disable an implicit layer. Note:
185 in rare cases of an application not working with an implicit layer, the
186 application can set this environment variable (before calling Vulkan
187 functions) in order to "blacklist" the layer. This environment variable
188 (which should vary with each "version" of the layer, as in
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700189 "DISABLE_LAYER_FOO_1") must be set (not particularly to any value). If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600190 both the "enable_environment" and "disable_environment" variables are set,
191 the implicit layer is disabled.
192
Jon Ashburn6121daf2015-07-24 09:20:11 -0600193For example:
Jon Ashburn4a511f12015-07-16 10:54:55 -0600194
195{
jon5b1e34d2015-10-29 15:51:28 -0600196 "file_format_version" : "1.0.0",
197 "layer": {
Jon Ashburn4a511f12015-07-16 10:54:55 -0600198 "name": "OverlayLayer",
199 "type": "DEVICE",
200 "library_path": "libvkOverlayLayer.so",
Tony Barbourfd2f7882016-01-14 10:40:40 -0700201 "api_version" : "1.0.1",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700202 "implementation_version" : "2",
jon5b1e34d2015-10-29 15:51:28 -0600203 "description" : "LunarG HUD layer",
204 "functions": {
205 "vkGetInstanceProcAddr": "Overlaylayer_GetInstanceProcAddr",
206 "vkGetDeviceProcAddr": "OverlayLayer_GetDeviceProcAddr"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600207 },
jon5b1e34d2015-10-29 15:51:28 -0600208 "instance_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600209 {
David Pinedoabd07722015-11-24 09:00:24 -0700210 "name": "VK_LUNARG_DEBUG_REPORT",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700211 "spec_version": "1"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600212 },
213 {
David Pinedoabd07722015-11-24 09:00:24 -0700214 "name": "VK_VENDOR_DEBUG_X",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700215 "spec_version": "3"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600216 }
217 ],
jon5b1e34d2015-10-29 15:51:28 -0600218 "device_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600219 {
David Pinedoabd07722015-11-24 09:00:24 -0700220 "name": "VK_LUNARG_DEBUG_MARKER",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700221 "spec_version": "1",
222 "entrypoints": ["vkCmdDbgMarkerBegin", "vkCmdDbgMarkerEnd"]
Jon Ashburn4a511f12015-07-16 10:54:55 -0600223 }
224 ],
jon5b1e34d2015-10-29 15:51:28 -0600225 "disable_environment": {
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700226 "DISABLE_LAYER_OVERLAY_1": ""
Jon Ashburn4a511f12015-07-16 10:54:55 -0600227 }
228 }
229}
230
jon5b1e34d2015-10-29 15:51:28 -0600231The "library_path" specifies either a filename, a relative pathname, or a full
232pathname to a layer shared library (".so") file, which the loader will attempt
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700233to load using dlopen(). If the layer is specified via a filename, the loader
234will attempt to open that file as a shared object using dlopen(), and the file
235must be in a directory that dlopen is configured to look in (Note: various
236distributions are configured differently). A distribution is free to create
237Vulkan-specific system directories (e.g. ".../vulkan/layers"), but is not
238required to do so. If the layer is specified via a relative pathname, it is
239relative to the path of the info file (e.g. for cases when an application
Jon Ashburn4a511f12015-07-16 10:54:55 -0600240provides a layer that is in the same directory hierarchy as the rest of the
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700241application files).
Jon Ashburn4a511f12015-07-16 10:54:55 -0600242
243There are no rules about the name of the text files (except the .json suffix).
244There are no rules about the name of the layer shared library files.
245
246
2472.2. Using Pre-Production Layers
248
249As with ICDs, developers may need to use special, pre-production layers,
250without modifying the properly-installed layers.
251
jon5b1e34d2015-10-29 15:51:28 -0600252This need is met with the use of the "VK_LAYER_PATH" environment variable,
Jon Ashburn4a511f12015-07-16 10:54:55 -0600253which will override the mechanism using for finding properly-installed layers.
254Because many layers may exist on a system, this environment variable is a
255colon-separated list of directories that contain layer info files. Only the
jon5b1e34d2015-10-29 15:51:28 -0600256directories listed in "VK_LAYER_PATH" will be scanned for info files. Each
Jon Ashburn4a511f12015-07-16 10:54:55 -0600257colon-separated entry is:
258
259- The full pathname of a directory containing layer info files
260
261In addition to overriding the mechanism for finding layers, the following
262environment variables are used to select one or more layers/extensions
263(respectively) to explicitly enable:
264
jon5b1e34d2015-10-29 15:51:28 -0600265- "VK_INSTANCE_LAYERS" for instance/global layers/extensions, enabled at
Jon Ashburn4a511f12015-07-16 10:54:55 -0600266 vkCreateInstance time
267
jon5b1e34d2015-10-29 15:51:28 -0600268- "VK_DEVICE_LAYERS" for device layers/extensions, enabled at vkCreateDevice
Jon Ashburn4a511f12015-07-16 10:54:55 -0600269 time
270
jon5b1e34d2015-10-29 15:51:28 -0600271These are colon-separated lists of extension names, as listed in the "name"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600272field of the info file. The loader will load all layers/extensions that match
jon5b1e34d2015-10-29 15:51:28 -0600273the given extension name(s), ignoring the "version" fields.
Jon Ashburn4a511f12015-07-16 10:54:55 -0600274
275NOTE: these environment variables will be ignored for suid programs.