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 vkEnumerateInstanceLayerProperties.
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 Loader and Layer Interface.
The Vulkan SDK contains a layer configuration document that is very specific to how to discover and configure layers on each of the platforms.
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. Please see the Vulkan Configurator documentation in the Vulkan SDK for more information on using the Vulkan Configurator.
There used to be both instance layers and device layers, but device layers were deprecated early in Vulkan’s life and should be avoided.
Anyone can create a layer as long as it follows the loader to layer interface which is how the loader and layers agree to communicate with each other.
LunarG provides a framework for layer creation called the Layer Factory to help develop new layers (Video presentation). The layer factory hides the majority of the loader-layer interface, layer boilerplate, setup and initialization, and complexities of layer development. During application development, the ability to easily create a layer to aid in debugging your application can be useful. For more information, see the Vulkan Layer Factory documentation.
The way to load a layer in implicitly varies between loader and platform.
As of Android P (Android 9 / API level 28), if a device is in a debuggable state such that getprop ro.debuggable
returns 1, then the loader will look in /data/local/debug/vulkan.
Starting in Android P (Android 9 / API level 28) implicit layers can be pushed using ADB if the application was built in debug mode.
There is no way other than the options above to use implicit layers.
The Vulkan SDK explains how to use implicit layers on Linux.
The Vulkan SDK explains how to use implicit layers on MacOS.
The Vulkan SDK explains how to use implicit layers on Windows.