Copyright © 2015-2021 LunarG, Inc.
VK_LAYER_KHRONOS_synchronization2 extension layer implements the
By default, it will disable itself if the underlying driver provides the extension.
It has a force_enable setting that can be adjusted by either environment variables
or by using the
Even though the
VK_KHR_synchronization2 extension requires the
VK_KHR_create_renderpass2 extensions, this layer will work on devices that do not implement them. See the
Sync2CompatTest.Vulkan10 test case for an example of how to do this.
Enabling the Layer
The synchronization2 layer can be enabled using vkconfig. See the vkconfig documentation for more information.
You must add the location of the generated
VK_LAYER_KHRONOS_synchronization2.json file and corresponding
VkLayer_synchronization2 library to your
VK_LAYER_PATH in order for the Vulkan loader to be able
to find the layer.
Then, you must also enable the layer in one of two ways:
- Directly in your application using the layer's name during vkCreateInstance
- Indirectly by using the
If your source was located in:
C:\my_folder\ExtensionLayer and your build folder was build64, then you would add it to the layer path in the following way:
If your source was located in:
/my_folder/ExtensionLayer and your build folder was build, then you would add it to the layer path in the following way:
Forcing the layer with
To force the layer to be enabled for Vulkan applications, you can set the
VK_INSTANCE_LAYERS environment variable in the following way:
Packaging layer with application
This layer should not require your application to need any additional permissions.
vkCreateInstance time add the layer
// std::vector<const char *> instance_layers instance_layers.push_back("VK_LAYER_KHRONOS_synchronization2"); VkInstanceCreateInfo info; info.enabledLayerCount = static_cast<uint32_t>(instance_layers_.size()); info.ppEnabledLayerNames = instance_layers_.data();
For this to work
libVkLayer_khronos_synchronization2.so needs to be packaged inside the APK as Android will be able to read in the layer from there. One can open the APK in Android Studio to verify the binary is there. Make sure to match up the correct ABI as well (
Globally Enabling the Layer
This will require a debugable application or additional permissions. For more information please read the Android Developer page
Use ADB to enable the layer for your project by:
adb shell "setprop debug.vulkan.layers 'VK_LAYER_KHRONOS_synchronization2'"
When done, disable the layer using:
adb shell "setprop debug.vulkan.layers ''"
Synchronization2 Layer Options
|Setting||Environment Variable||Settings File Value||Default||Description|
||FALSE||If TRUE, the layer's implementation of the extension will be used even if the underlying driver also implements the extension.|
If you have a setting defined in both the Settings File as well as an Environment Variable, the Environment Variable value will always override the Settings File value. This is intended to let you dynamically change settings without having to adjust the Settings File.
Applying Environment Settings on Android
On Android, you must use properties to set the environment variables. The format of the properties to set takes the following form:
debug. + (lower-case environment variable with 'vk_' stripped)
The easiest way to set a property is from the ADB shell:
adb shell "setprop <property_name> '<property_value>'"
To set force enable, which on desktop uses
set the following property:
Which you can set in the following way:
adb shell "setprop debug.sync2_force_enable true"