blob: 4a2676a73e89f4b40e3de96f5e1f9a03df115a5f [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",
Tony Barbourfd2f7882016-01-14 10:40:40 -070027 "api_version": "1.0.1"
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
Ian Elliottb901a052015-12-17 10:22:33 -0700141For each value in these keys which has DWORD data set to 0, the loader opens
142the JSON format text information file (a.k.a. "manifest file") specified by the
143name of the value. Each name must be a full pathname to the text info file.
144The Vulkan loader will open each info file to obtain information about the
145layer, including the name or pathname of a shared library (".dll") file.
Jon Ashburn4a511f12015-07-16 10:54:55 -0600146The information file is in the JSON format and contains the following
147information:
148
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700149- (required) "file_format_version" - same as for ICDs, except that the format
Jon Ashburn4a511f12015-07-16 10:54:55 -0600150 version can vary independently for ICDs and layers.
151- (required) "name" - layer name
152- (required) "type" - which layer chains should the layer be activated on.
153 Allowable values are "INSTANCE", "DEVICE", "GLOBAL". Global means activate
154 on both device and instance chains.
jon5b1e34d2015-10-29 15:51:28 -0600155- (required) "library_path" - filename / full path / relative path to the text
Jon Ashburn4a511f12015-07-16 10:54:55 -0600156 file
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700157- (required) "api_version" - same as for ICDs.
158- (required) "implementation_version" - layer version, a single number increasing with backward compatible changes.
159- (required) "description" - informative decription of the layer.
160- (optional) "device_extensions" or "instance_extensions" - array of extension information as follows
161- (optional) extension "name" - Vulkan registered name
162- (optional) extension "spec_version" - extension specification version, a single number, increasing with backward compatible changes.
163- (optional) extension "entrypoints" - array of device extension entrypoints; not used for instance extensions
jon5b1e34d2015-10-29 15:51:28 -0600164- (sometimes required) "functions" - mapping list of function entry points. If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600165 multiple layers exist within the same shared library (or if a layer is in the
166 same shared library as an ICD), this must be specified to allow each layer to
167 have its own vkGet*ProcAddr entrypoints that can be found by the loader. At
168 this time, only the following two functions are required:
jon5b1e34d2015-10-29 15:51:28 -0600169 - "vkGetInstanceProcAddr" name
170 - "vkGetDeviceProcAddr" name
171- (optional for implicit layers) "enable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600172 environment variable and value required to enable an implicit layer. This
173 environment variable (which should vary with each "version" of the layer, as
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700174 in "ENABLE_LAYER_FOO_1") must be set to the given value or else the
Jon Ashburn4a511f12015-07-16 10:54:55 -0600175 implicit layer is not loaded. This is for application environments
176 (e.g. Steam) which want to enable a layer(s) only for applications that they
177 launch, and allows for applications run outside of an application environment
178 to not get that implicit layer(s).
jon5b1e34d2015-10-29 15:51:28 -0600179- (required for implicit layers) "disable_environment" requirement(s) -
Jon Ashburn4a511f12015-07-16 10:54:55 -0600180 environment variable and value required to disable an implicit layer. Note:
181 in rare cases of an application not working with an implicit layer, the
182 application can set this environment variable (before calling Vulkan
183 functions) in order to "blacklist" the layer. This environment variable
184 (which should vary with each "version" of the layer, as in
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700185 "DISABLE_LAYER_FOO_1") must be set (not particularly to any value). If
Jon Ashburn4a511f12015-07-16 10:54:55 -0600186 both the "enable_environment" and "disable_environment" variables are set,
187 the implicit layer is disabled.
188
Jon Ashburn6121daf2015-07-24 09:20:11 -0600189For example:
190
Jon Ashburn4a511f12015-07-16 10:54:55 -0600191{
jon5b1e34d2015-10-29 15:51:28 -0600192 "file_format_version" : "1.0.0",
193 "layer": {
Jon Ashburn4a511f12015-07-16 10:54:55 -0600194 "name": "OverlayLayer",
195 "type": "DEVICE",
196 "library_path": "vkOverlayLayer.dll",
Tony Barbourfd2f7882016-01-14 10:40:40 -0700197 "api_version" : "1.0.1",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700198 "implementation_version" : "2",
jon5b1e34d2015-10-29 15:51:28 -0600199 "description" : "LunarG HUD layer",
200 "functions": {
201 "vkGetInstanceProcAddr": "OverlayLayer_GetInstanceProcAddr",
202 "vkGetDeviceProcAddr": "OverlayLayer_GetDeviceProcAddr"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600203 },
jon5b1e34d2015-10-29 15:51:28 -0600204 instance_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600205 {
David Pinedoabd07722015-11-24 09:00:24 -0700206 "name": "VK_LUNARG_DEBUG_REPORT",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700207 "spec_version": "1"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600208 },
209 {
David Pinedoabd07722015-11-24 09:00:24 -0700210 "name": "VK_VENDOR_DEBUG_X",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700211 "spec_version": "3"
Jon Ashburn4a511f12015-07-16 10:54:55 -0600212 }
213 ],
jon5b1e34d2015-10-29 15:51:28 -0600214 device_extensions": [
Jon Ashburn4a511f12015-07-16 10:54:55 -0600215 {
David Pinedoabd07722015-11-24 09:00:24 -0700216 "name": "VK_LUNARG_DEBUG_MARKER",
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700217 "spec_version": "1",
218 "entrypoints": ["vkCmdDbgMarkerBegin", "vkCmdDbgMarkerEnd"]
Jon Ashburn4a511f12015-07-16 10:54:55 -0600219 }
220 ],
jon5b1e34d2015-10-29 15:51:28 -0600221 "disable_environment": {
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700222 "DISABLE_LAYER_OVERLAY_1": ""
Jon Ashburn4a511f12015-07-16 10:54:55 -0600223 }
224 }
225}
226
jon5b1e34d2015-10-29 15:51:28 -0600227The "library_path" specifies either a filename, a relative pathname, or a full
228pathname to a layer shared library (".dll") file, which the loader will attempt
Jon Ashburn4a511f12015-07-16 10:54:55 -0600229to load using LoadLibrary(). If the layer is specified via a relative
230pathname, it is relative to the path of the info file (e.g. for cases when an
231application provides a layer that is in the same folder hierarchy as the rest
232of the application files). If the layer is specified via a filename, the
Jon Ashburnf2a944f2015-11-18 16:46:48 -0700233shared library lives in the system's DLL search path (e.g. in the
jon5b1e34d2015-10-29 15:51:28 -0600234"C:\\Windows\\System32" folder).
Jon Ashburn4a511f12015-07-16 10:54:55 -0600235
236There are no rules about the name of the text files (except the .json suffix).
237There are no rules about the name of the layer shared library files.
238
239
2402.2. Using Pre-Production Layers
241
242As with ICDs, developers may need to use special, pre-production layers,
243without modifying the properly-installed layers.
244
jon5b1e34d2015-10-29 15:51:28 -0600245This need is met with the use of the "VK_LAYER_PATH" environment variable,
Jon Ashburn4a511f12015-07-16 10:54:55 -0600246which will override the mechanism using for finding properly-installed layers.
247Because many layers may exist on a system, this environment variable is a
248semi-colon-separated list of folders that contain layer info files. Only the
jon5b1e34d2015-10-29 15:51:28 -0600249folder listed in "VK_LAYER_PATH" will be scanned for info files. Each
Jon Ashburn4a511f12015-07-16 10:54:55 -0600250semi-colon-separated entry is:
251
252- The full pathname of a folder containing layer info files
253
254In addition to overriding the mechanism for finding layers, the following
255environment variables are used to select one or more layers/extensions
256(respectively) to explicitly enable:
257
jon5b1e34d2015-10-29 15:51:28 -0600258- "VK_INSTANCE_LAYERS" for instance/global layers/extensions, enabled at
Jon Ashburn4a511f12015-07-16 10:54:55 -0600259 vkCreateInstance time
260
jon5b1e34d2015-10-29 15:51:28 -0600261- "VK_DEVICE_LAYERS" for device layers/extensions, enabled at vkCreateDevice
Jon Ashburn4a511f12015-07-16 10:54:55 -0600262 time
263
264These are semi-colon-separated lists of extension names, as listed in the
jon5b1e34d2015-10-29 15:51:28 -0600265"name" field of the info file. The loader will load all layers/extensions that
266match the given extension name(s), ignoring the "version" fields.