|
| 1 | +<!-- markdownlint-disable MD041 --> |
| 2 | +[![Khronos Vulkan][1]][2] |
| 3 | + |
| 4 | +[1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" |
| 5 | +[2]: https://www.khronos.org/vulkan/ |
| 6 | + |
| 7 | +# Loader Settings File <!-- omit from toc --> |
| 8 | + |
| 9 | +[![Creative Commons][3]][4] |
| 10 | + |
| 11 | +<!-- Copyright © 2025 LunarG, Inc. --> |
| 12 | + |
| 13 | +[3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" |
| 14 | +[4]: https://creativecommons.org/licenses/by-nd/4.0/ |
| 15 | + |
| 16 | + |
| 17 | +## Table of Contents <!-- omit from toc --> |
| 18 | + |
| 19 | +- [Purpose of the Settings File](#purpose-of-the-settings-file) |
| 20 | +- [Settings File Discovery](#settings-file-discovery) |
| 21 | + - [Windows](#windows) |
| 22 | + - [Linux/MacOS/BSD/QNX/Fuchsia/GNU](#linuxmacosbsdqnxfuchsiagnu) |
| 23 | + - [Other Platforms](#other-platforms) |
| 24 | + - [Exception for Elevated Privileges](#exception-for-elevated-privileges) |
| 25 | +- [Per-Application Settings File](#per-application-settings-file) |
| 26 | +- [File Format](#file-format) |
| 27 | +- [Example Settings File](#example-settings-file) |
| 28 | + - [Fields](#fields) |
| 29 | +- [Behavior](#behavior) |
| 30 | + |
| 31 | + |
| 32 | +## Purpose of the Settings File |
| 33 | + |
| 34 | +The purpose of the Loader Settings File is to give developers superb control over the |
| 35 | +behavior of the Vulkan-Loader. |
| 36 | +It enables enhanced controls over which layers to load, the order layers in the call chain, |
| 37 | +logging, and which drivers are available. |
| 38 | + |
| 39 | +The Loader Settings File is intended to be used by "Developer Control Panels" for the Vulkan API, such as the Vulkan Configurator, as a replacement for setting debug envrionment variables. |
| 40 | + |
| 41 | +## Settings File Discovery |
| 42 | + |
| 43 | +The Loader Settings File is located by searching in specific file system paths or through |
| 44 | +platform specific mechanisms such as the Windows Registry. |
| 45 | + |
| 46 | +### Windows |
| 47 | + |
| 48 | +The Vulkan Loader first searches the Registry Key HKEY_CURRENT_USER\SOFTWARE\Khronos\Vulkan\LoaderSettings for a DWORD value whose name is |
| 49 | +a valid path to a file named 'vk_loader_settings.json'. |
| 50 | +If there are no matching values or the file doesn't exist, the Vulkan Loader performs the |
| 51 | +same behavior as described above for the Registry Key HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\LoaderSettings. |
| 52 | + |
| 53 | +### Linux/MacOS/BSD/QNX/Fuchsia/GNU |
| 54 | + |
| 55 | +The Loader Settings File is located by searching for a file named vk_loader_settings.json in the following locations: |
| 56 | + |
| 57 | +`$HOME/.local/share/vulkan/loader_settings.d/` |
| 58 | +`$XDG_DATA_HOME/vulkan/loader_settings.d/` |
| 59 | +`/etc/vulkan/loader_settings.d/` |
| 60 | + |
| 61 | +Where $HOME and %XDG_DATA_HOME refer to the values contained in the environment variables of the same name. |
| 62 | +If a given environment variables is not present, that path is ignored. |
| 63 | + |
| 64 | +### Other Platforms |
| 65 | + |
| 66 | +Platforms not listed above currently do not support the Loader Settings File due to not having an appropriate search mechanism. |
| 67 | + |
| 68 | +### Exception for Elevated Privileges |
| 69 | + |
| 70 | +Because the Loader Settings File contains paths to Layer and ICD manifests, which contain |
| 71 | +the paths to various executable binaries, it is necessary to restrict the use of the Loader |
| 72 | +Settings File when the application is running with elevated privileges. |
| 73 | + |
| 74 | +This is accomplished by not using any Loader Settings Files that are found in non-privileged locations. |
| 75 | + |
| 76 | +On Windows, running with Elevated Privileges will ignore HKEY_CURRENT_USER\SOFTWARE\Khronos\Vulkan\LoaderSettings. |
| 77 | + |
| 78 | +On Linux/MacOS/BSD/QNX/Fuchsia/GNU, running with Elevated Privileges will use a secure method of querying $HOME and $XDG_DATA_HOME to prevent |
| 79 | +malicious injection of unsecure search directories. |
| 80 | + |
| 81 | +## Per-Application Settings File |
| 82 | + |
| 83 | +## File Format |
| 84 | + |
| 85 | +The Loader Settings File is a JSON file with a |
| 86 | + |
| 87 | + |
| 88 | +## Example Settings File |
| 89 | + |
| 90 | + |
| 91 | +```json |
| 92 | +{ |
| 93 | + "file_format_version" : "1.0.1", |
| 94 | + "settings": { |
| 95 | + |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### Fields |
| 101 | + |
| 102 | +<table style="width:100%"> |
| 103 | + <tr> |
| 104 | + <th>JSON Node</th> |
| 105 | + <th>Description and Notes</th> |
| 106 | + <th>Restrictions</th> |
| 107 | + <th>Parent</th> |
| 108 | + <th>Introspection Query</th> |
| 109 | + </tr> |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +## Behavior |
0 commit comments