blob: bfc828716e00c18f3fda2407a87173cbbbb39f87 [file] [log] [blame]
Jon Ashburnf2a944f2015-11-18 16:46:48 -07001This is a specification for how the Vulkan loader should identify Vulkan
Jon Ashburn6121daf2015-07-24 09:20:11 -06002installable client drivers (ICDs) on MS Windows. This is designed for
3production installation of Vulkan ICDs and layers. The design is shown first
4for 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
13values in the following Windows registry key:
14
15HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers
16
17For each value in this key which has DWORD data set to 0, the loader opens the
David Pinedo8a154192015-12-07 17:49:43 -070018JSON format text information file (a.k.a. "manifest file") specified by the
19name of the value. Each name must be a full pathname to the text info file.
20The Vulkan loader will open each info file to obtain the name or pathname of
21an ICD shared library (".dll") file. For example:
Jon Ashburn4a511f12015-07-16 10:54:55 -060022
23{
Jon Ashburnf2a944f2015-11-18 16:46:48 -070024 "file_format_version": "1.0.0",
Jon Ashburn4a511f12015-07-16 10:54:55 -060025 "ICD": {
26 "library_path": "path to ICD library",
David Pinedo380e1eb2015-12-01 17:25:01 -070027 "api_version": "0.210.0"
Jon Ashburn4a511f12015-07-16 10:54:55 -060028 }
29}
30
jon5b1e34d2015-10-29 15:51:28 -060031The "library_path" specifies either a filename, a relative pathname, or a full
Jon Ashburn4a511f12015-07-16 10:54:55 -060032pathname to an ICD shared library file, which the loader will attempt to load
Jon Ashburn6121daf2015-07-24 09:20:11 -060033using LoadLibrary(). If the ICD is specified via a filename, the shared
Jon Ashburnf2a944f2015-11-18 16:46:48 -070034library lives in the system's DLL search path (e.g. in the
jon5b1e34d2015-10-29 15:51:28 -060035"C:\\Windows\\System32" folder). If the ICD is specified via a relative
Jon Ashburnf2a944f2015-11-18 16:46:48 -070036pathname, it is relative to the path of the info file. Relative pathnames are
37those that do not start with a drive specifier (e.g. "C:"), nor with a
38directory separator (i.e. the '\' character), but do contain at least one
39directory separator.
Jon Ashburn4a511f12015-07-16 10:54:55 -060040
jon5b1e34d2015-10-29 15:51:28 -060041The "file_format_version" specifies a major.minor.patch version number in case
Jon Ashburn4a511f12015-07-16 10:54:55 -060042the format of the text information file changes in the future. If the same ICD
43shared library supports multiple, incompatible versions of text info file
44format versions, it must have multiple text info files (all of which may point
45to the same shared library).
46
Jon Ashburnf2a944f2015-11-18 16:46:48 -070047The “api_version” specifies the major.minor.patch version number of the Vulkan
48API that the shared library (referenced by "library_path") was built with.
Jon Ashburn4a511f12015-07-16 10:54:55 -060049
50There are no rules about the name of the text information files (except the
51.json suffix). There are no rules about the name of the ICD shared library
52files. For example, if the registry contains the following values:
53
54 [HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers]
55 "c:\\vendor a\\vk_vendora.json"=dword:00000000
56 "c:\\windows\\system32\\vendorb_vk.json"=dword:00000000
57 "c:\\windows\\system32\\vendorc_icd.json"=dword:00000000
58
59then the loader will open the following text information files, with the
60specified contents:
61
62 Text File Name Text File Contents
63 --------------------------------------------------------------------------
64 vk_vendora.json { "ICD": { "library_path": "C:\\VENDORA\\vk_vendora.dll" }}
jon5b1e34d2015-10-29 15:51:28 -060065 vendorb_vk.json { "ICD": { "library_path": "vendorb_vk.dll" }}
Jon Ashburn4a511f12015-07-16 10:54:55 -060066 vendorc_icd.json { "ICD": { "library_path": "vedorc_icd.dll" }}
67
jon5b1e34d2015-10-29 15:51:28 -060068then the loader will open the three files mentioned in the "Text File Contents"
Jon Ashburn4a511f12015-07-16 10:54:55 -060069column, and then try to load and use the three shared libraries mentioned
70indicated 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 semi-colon-separated list of
Jon Ashburn4a511f12015-07-16 10:54:55 -060087ICD text information files, containing the following:
88
jon5b1e34d2015-10-29 15:51:28 -060089- A full pathname (e.g. "C:\\my_build\\my_icd.json")
Jon Ashburn4a511f12015-07-16 10:54:55 -060090
jon5b1e34d2015-10-29 15:51:28 -060091Typically, "VK_ICD_FILENAMES" will only contain a full pathname to one info
Jon Ashburn4a511f12015-07-16 10:54:55 -060092file for a developer-built ICD. A semi-colon is only used if more than one ICD
93is listed.
94
95For example, if a developer wants to refer to one ICD that they built, they
jon5b1e34d2015-10-29 15:51:28 -060096could set the "VK_ICD_FILENAMES" environment variable to:
Jon Ashburn4a511f12015-07-16 10:54:55 -060097
98 C:\\my_build\\my_icd.json
99
100If a developer wants to refer to two ICDs, one of which is a properly-installed
101ICD, they can use the full pathname of the text file:
102
103 C:\\Windows\\System32\\vendorc_icd.json;C:\\my_build\\my_icd.json
104
jon5b1e34d2015-10-29 15:51:28 -0600105Notice the semi-colon between "C:\\Windows\\System32\\vendorc_icd.json" and
106"C:\\my_build\\my_icd.json".
Jon Ashburn4a511f12015-07-16 10:54:55 -0600107
108
1092. Layers:
110
111
1122.1. Properly-Installed Layers
113
114In order to find properly-installed layers, the Vulkan loader will use a
115similar mechanism as used for ICDs. Text information files, that use a JSON
116format, are read in order to identify the names and attributes of layers and
117their extensions. The use of text info files allows the loader to avoid
118loading any shared library files when the application does not query nor
119request any extensions. Layers and extensions have additional complexity, and
120so their info files contain more information than ICD info files. For example,
121a layer shared library file may contain multiple layers/extensions (perhaps
122even an ICD).
123
David Pinedo8a154192015-12-07 17:49:43 -0700124In order to find properly-installed layers, the Vulkan loader will scan the
Jon Ashburn4a511f12015-07-16 10:54:55 -0600125values in the following Windows registry keys:
126
127HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ExplicitLayers
128HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers
129
130Explicit layers are those which are enabled by an application (e.g. with the
131vkCreateInstance function), or by an environment variable (see below).
132Implicit layers are those which are enabled by their existence. For example,
133certain application environments (e.g. Steam or an automotive infotainment
134system) may have layers which they always want enabled for all applications
135that they start. Other implicit layers may be for all applications started
136on a given system (e.g. layers that overlay frames-per-second). Implicit
137layers are enabled automatically, whereas explicit
138layers must be enabled explicitly. What distinguishes a layer as implicit or
139explicit is by which registry key its layer information file is referenced by.
140
141The information file is in the JSON format and contains the following
142information:
143
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700144- (required) "file_format_version" - same as for ICDs, except that the format
Jon Ashburn4a511f12015-07-16 10:54:55 -0600145 version can vary independently for ICDs and layers.
146- (required) "name" - layer name
147- (required) "type" - which layer chains should the layer be activated on.
148 Allowable values are "INSTANCE", "DEVICE", "GLOBAL". Global means activate
149 on both device and instance chains.
jon5b1e34d2015-10-29 15:51:28 -0600150- (required) "library_path" - filename / full path / relative path to the text
Jon Ashburn4a511f12015-07-16 10:54:55 -0600151 file
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700152- (required) "api_version" - same as for ICDs.
153- (required) "implementation_version" - layer version, a single number increasing with backward compatible changes.
154- (required) "description" - informative decription of the layer.
155- (optional) "device_extensions" or "instance_extensions" - array of extension information as follows
156- (optional) extension "name" - Vulkan registered name
157- (optional) extension "spec_version" - extension specification version, a single number, increasing with backward compatible changes.
158- (optional) extension "entrypoints" - array of device extension entrypoints; not used for instance extensions
jon5b1e34d2015-10-29 15:51:28 -0600159- (sometimes required) "functions" - mapping list of function entry points. If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600160 multiple layers exist within the same shared library (or if a layer is in the
161 same shared library as an ICD), this must be specified to allow each layer to
162 have its own vkGet*ProcAddr entrypoints that can be found by the loader. At
163 this time, only the following two functions are required:
jon5b1e34d2015-10-29 15:51:28 -0600164 - "vkGetInstanceProcAddr" name
165 - "vkGetDeviceProcAddr" name
166- (optional for implicit layers) "enable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600167 environment variable and value required to enable an implicit layer. This
168 environment variable (which should vary with each "version" of the layer, as
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700169 in "ENABLE_LAYER_FOO_1") must be set to the given value or else the
Jon Ashburn4a511f12015-07-16 10:54:55 -0600170 implicit layer is not loaded. This is for application environments
171 (e.g. Steam) which want to enable a layer(s) only for applications that they
172 launch, and allows for applications run outside of an application environment
173 to not get that implicit layer(s).
jon5b1e34d2015-10-29 15:51:28 -0600174- (required for implicit layers) "disable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600175 environment variable and value required to disable an implicit layer. Note:
176 in rare cases of an application not working with an implicit layer, the
177 application can set this environment variable (before calling Vulkan
178 functions) in order to "blacklist" the layer. This environment variable
179 (which should vary with each "version" of the layer, as in
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700180 "DISABLE_LAYER_FOO_1") must be set (not particularly to any value). If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600181 both the "enable_environment" and "disable_environment" variables are set,
182 the implicit layer is disabled.
183
Jon Ashburn6121daf2015-07-24 09:20:11 -0600184For example:
185
Jon Ashburn4a511f12015-07-16 10:54:55 -0600186{
jon5b1e34d2015-10-29 15:51:28 -0600187 "file_format_version" : "1.0.0",
188 "layer": {
Jon Ashburn4a511f12015-07-16 10:54:55 -0600189 "name": "OverlayLayer",
190 "type": "DEVICE",
191 "library_path": "vkOverlayLayer.dll",
David Pinedo380e1eb2015-12-01 17:25:01 -0700192 "api_version" : "0.210.0",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700193 "implementation_version" : "2",
jon5b1e34d2015-10-29 15:51:28 -0600194 "description" : "LunarG HUD layer",
195 "functions": {
196 "vkGetInstanceProcAddr": "OverlayLayer_GetInstanceProcAddr",
197 "vkGetDeviceProcAddr": "OverlayLayer_GetDeviceProcAddr"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600198 },
jon5b1e34d2015-10-29 15:51:28 -0600199 instance_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600200 {
David Pinedoabd07722015-11-24 09:00:24 -0700201 "name": "VK_LUNARG_DEBUG_REPORT",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700202 "spec_version": "1"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600203 },
204 {
David Pinedoabd07722015-11-24 09:00:24 -0700205 "name": "VK_VENDOR_DEBUG_X",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700206 "spec_version": "3"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600207 }
208 ],
jon5b1e34d2015-10-29 15:51:28 -0600209 device_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600210 {
David Pinedoabd07722015-11-24 09:00:24 -0700211 "name": "VK_LUNARG_DEBUG_MARKER",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700212 "spec_version": "1",
213 "entrypoints": ["vkCmdDbgMarkerBegin", "vkCmdDbgMarkerEnd"]
Jon Ashburn4a511f12015-07-16 10:54:55 -0600214 }
215 ],
jon5b1e34d2015-10-29 15:51:28 -0600216 "disable_environment": {
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700217 "DISABLE_LAYER_OVERLAY_1": ""
Jon Ashburn4a511f12015-07-16 10:54:55 -0600218 }
219 }
220}
221
jon5b1e34d2015-10-29 15:51:28 -0600222The "library_path" specifies either a filename, a relative pathname, or a full
223pathname to a layer shared library (".dll") file, which the loader will attempt
Jon Ashburn4a511f12015-07-16 10:54:55 -0600224to load using LoadLibrary(). If the layer is specified via a relative
225pathname, it is relative to the path of the info file (e.g. for cases when an
226application provides a layer that is in the same folder hierarchy as the rest
227of the application files). If the layer is specified via a filename, the
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700228shared library lives in the system's DLL search path (e.g. in the
jon5b1e34d2015-10-29 15:51:28 -0600229"C:\\Windows\\System32" folder).
Jon Ashburn4a511f12015-07-16 10:54:55 -0600230
231There are no rules about the name of the text files (except the .json suffix).
232There are no rules about the name of the layer shared library files.
233
234
2352.2. Using Pre-Production Layers
236
237As with ICDs, developers may need to use special, pre-production layers,
238without modifying the properly-installed layers.
239
jon5b1e34d2015-10-29 15:51:28 -0600240This need is met with the use of the "VK_LAYER_PATH" environment variable,
Jon Ashburn4a511f12015-07-16 10:54:55 -0600241which will override the mechanism using for finding properly-installed layers.
242Because many layers may exist on a system, this environment variable is a
243semi-colon-separated list of folders that contain layer info files. Only the
jon5b1e34d2015-10-29 15:51:28 -0600244folder listed in "VK_LAYER_PATH" will be scanned for info files. Each
Jon Ashburn4a511f12015-07-16 10:54:55 -0600245semi-colon-separated entry is:
246
247- The full pathname of a folder containing layer info files
248
249In addition to overriding the mechanism for finding layers, the following
250environment variables are used to select one or more layers/extensions
251(respectively) to explicitly enable:
252
jon5b1e34d2015-10-29 15:51:28 -0600253- "VK_INSTANCE_LAYERS" for instance/global layers/extensions, enabled at
Jon Ashburn4a511f12015-07-16 10:54:55 -0600254 vkCreateInstance time
255
jon5b1e34d2015-10-29 15:51:28 -0600256- "VK_DEVICE_LAYERS" for device layers/extensions, enabled at vkCreateDevice
Jon Ashburn4a511f12015-07-16 10:54:55 -0600257 time
258
259These are semi-colon-separated lists of extension names, as listed in the
jon5b1e34d2015-10-29 15:51:28 -0600260"name" field of the info file. The loader will load all layers/extensions that
261match the given extension name(s), ignoring the "version" fields.