Skip to content

Commit f4bb74a

Browse files
Update the layer chapter (#357)
1 parent 92f6ec4 commit f4bb74a

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

chapters/layers.adoc

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2022 The Khronos Group, Inc.
1+
// Copyright 2019-2025 The Khronos Group, Inc.
22
// SPDX-License-Identifier: CC-BY-4.0
33

44
ifndef::chapters[:chapters:]
@@ -7,18 +7,34 @@ ifndef::images[:images: images/]
77
[[layers]]
88
= Layers
99

10-
Layers are optional components that augment the Vulkan system. They can intercept, evaluate, and modify existing Vulkan functions on their way from the application down to the hardware. Layer properties can be queried from an application with link:https://docs.vulkan.org/spec/latest/chapters/extensions.html#vkEnumerateInstanceLayerProperties[vkEnumerateInstanceLayerProperties].
10+
Layers are optional components that augment the Vulkan system, packaged as shared libraries that get dynamically loaded in by the loader. They can intercept, evaluate, and modify existing Vulkan functions on their way from the application down to the hardware.
1111

12-
== Using Layers
12+
For example, by design, minimal error checking is done inside a Vulkan driver, link:https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html[_Vulkan Validation_ layer] can be used to to assist developers in isolating incorrect usage, and in verifying that applications correctly use the API.
1313

14-
Layers are packaged as shared libraries that get dynamically loaded in by the loader and inserted between it and the application. The two things needed to use layers are the location of the binary files and which layers to enable. The layers to use can be either explicitly enabled by the application or implicitly enabled by telling the loader to use them. More details about implicit and explicit layers can be found in the link:https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderApplicationInterface.md#implicit-vs-explicit-layers[Loader and Layer Interface].
14+
Layers are packaged as shared libraries that get dynamically loaded in by the loader and inserted between it and the application.
1515

16-
The link:https://vulkan.lunarg.com/sdk/home[Vulkan SDK] contains a link:https://vulkan.lunarg.com/doc/sdk/latest/windows/layer_configuration.html[layer configuration document] that is very specific to how to discover and configure layers on each of the platforms.
16+
The layers can be either explicitly enabled or implicitly enabled. More details about implicit and explicit layers can be found in the link:https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderApplicationInterface.md#implicit-vs-explicit-layers[Loader and Layer Interface].
1717

18-
== Vulkan Configurator Tool
18+
== Configuring Layers
1919

20-
Developers on Windows, Linux, and macOS can use the Vulkan Configurator, vkconfig, to enable explicit layers and disable implicit layers as well as change layer settings from a graphical user interface.
21-
Please see the link:https://vulkan.lunarg.com/doc/sdk/latest/windows/vkconfig.html[Vulkan Configurator documentation] in the Vulkan SDK for more information on using the Vulkan Configurator.
20+
A _layers configuration_ consists in two operations:
21+
- Selecting and ordering layers
22+
- Configuring each layer themselves using settings
23+
24+
Layers can be configured using three different methods to match specific Vulkan developers' workflows:
25+
- Using environment variables: link:https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderInterfaceArchitecture.md[Loader environment variables] and link:https://github.com/KhronosGroup/Vulkan-Utility-Libraries/blob/main/docs/layer_configuration.md#layer-settings-environment-variables[per-layer settings environment variables]
26+
- Using dedicated Vulkan system files: link:https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderSettingsFile.md[`vk_loader_settings.json`] and link:https://github.com/KhronosGroup/Vulkan-Utility-Libraries/blob/main/docs/layer_configuration.md#configuring-the-layers-using-the-settings-file-vk_layer_settingstxt[`vk_layer_settings.txt`]
27+
- Using the Vulkan API, programmably in the Vulkan application: link:https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateInstance.html[`vkCreateInstance`] and link:https://github.com/KhronosGroup/Vulkan-Utility-Libraries/blob/main/docs/layer_configuration.md#configuring-the-layer-settings-using-vk_ext_layer_settings[`VK_EXT_layer_settings`]
28+
29+
link:https://vulkan.lunarg.com/doc/sdk/latest/windows/vkconfig.html[_Vulkan Configurator_] simplifies the usage of these three methods. Using the graphical user interface, we can create _layers configuration_. The tool automatically create and locate the `vk_loader_settings.json` and `vk_layer_settings.txt` files. It can also be used to generate environment variables scripts and a C++ header library that can be directly included within the Vulkan application code.
30+
31+
The link:https://github.com/KhronosGroup/Vulkan-Utility-Libraries/blob/main/docs/layer_configuration.md[Layer Configuration] document is providing details on layer configuration.
32+
33+
== Layers settings backward compatbility policy
34+
35+
Settings which are unknown by the layer will be ignored independently of the method. It's the responsibility of the layer developer to ensure backward compatibility with previous versions of the layer.
36+
37+
This is to ensure the list of layer settings remain relatively stable across versions and that the responsibility of handling layer backward compatibility doesn't fall on Vulkan application developers as this could quickly become untrackable.
2238

2339
== Device Layers Deprecation
2440

@@ -28,26 +44,12 @@ There used to be both instance layers and device layers, but device layers were
2844

2945
Anyone can create a layer as long as it follows the link:https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderApplicationInterface.md#loader-and-layer-interface[loader to layer interface] which is how the loader and layers agree to communicate with each other.
3046

31-
== Platform Variations
32-
33-
The way to load a layer in implicitly varies between loader and platform.
47+
To ensure consistency and a smooth integration with Vulkan Configurator and other SDK tools, the link:https://github.com/KhronosGroup/Vulkan-Utility-Libraries[Vulkan::LayerSettings] should be used by the layer implementation.
3448

35-
=== Android
49+
== Android
3650

3751
As of Android P (Android 9 / API level 28), if a device is in a debuggable state such that `getprop ro.debuggable` link:https://cs.android.com/android/platform/superproject/+/android-9.0.0_r1:frameworks/native/vulkan/libvulkan/layers_extensions.cpp;l=454[returns 1], then the loader will look in link:https://cs.android.com/android/platform/superproject/+/android-9.0.0_r1:frameworks/native/vulkan/libvulkan/layers_extensions.cpp;l=67[/data/local/debug/vulkan].
3852

3953
Starting in Android P (Android 9 / API level 28) implicit layers can be link:https://developer.android.com/ndk/guides/graphics/validation-layer#vl-adb[pushed using ADB] if the application was built in debug mode.
4054

4155
There is no way other than the options above to use implicit layers.
42-
43-
=== Linux
44-
45-
The link:https://vulkan.lunarg.com/doc/sdk/latest/linux/layer_configuration.html[Vulkan SDK] explains how to use implicit layers on Linux.
46-
47-
=== MacOS
48-
49-
The link:https://vulkan.lunarg.com/doc/sdk/latest/mac/layer_configuration.html[Vulkan SDK] explains how to use implicit layers on MacOS.
50-
51-
=== Windows
52-
53-
The link:https://vulkan.lunarg.com/doc/sdk/latest/windows/layer_configuration.html[Vulkan SDK] explains how to use implicit layers on Windows.

0 commit comments

Comments
 (0)