Vulkan Validation Layers
The Vulkan validation layers included in the Meta Quest operating system make it easy to run validation layers for your app when you want to. These built-in validation layers save time compared to the traditional methods that require you to create special versions of your app to run the Khronos Vulkan validation layer libraries.
Vulkan validation layers are a Khronos-developed and community-contributed tool that measures whether a given Vulkan app conforms to the Vulkan spec. This is extremely important for developers whose apps are using the Vulkan graphics API, since apps that commit spec violations can lead to behavior ranging anywhere from slightly undesirable to complete rendering corruption.
One way where the Vulkan graphics API differs from its predecessor, OpenGL ES, is that GL performs error-checking in the graphics driver itself, but Vulkan graphics drivers have no error-checking responsibilities. This is great for performance, since the driver has to do a lot less work to validate the inputs, but it means that the inputs to these Vulkan functions had better be correct, or else undefined behavior may ensue. At development time, the validation layers are a great chance to figure out if your apps have full spec compliance. At ship time, you won’t have the layers on for performance reasons, but as long as you tested the layer usage strongly, you should have assurance that your app is not performing any large spec violations.
To streamline the process of using validation layers, we decided to include the layers directly in our operating system, updated on a frequent cadence of every few months. This makes it easy to run validation layers for your apps, allowing you to save time compared to the traditional methods that require you to create special versions of your app to run the Khronos Vulkan validation layer libraries. Moreover, in the past, knowing which validation layer to use was a challenge in and of itself, since the layers are bundled with Android NDKs often years-old, and it’s much more optimal for developers to use fully up-to-date layers.
Enabling Validation Layers for an App
To enable validation layers for an app, use the following command from a command prompt:
adb shell setprop debug.oculus.loadandinjectpackagedvvl.<app_package_name> 1
To disable validation layers, use the following command:
adb shell setprop debug.oculus.loadandinjectpackagedvvl.<app_package_name> 0
Validation Errors Are Sent to the App Log
Once enabled, the validation layers log Vulkan errors and warnings to the Android logging system. You can display these log messages with adb logcat
.
Native Apps or Automated Testing:
The validation layer logging must first be activated with adb shell setprop debug.vvl.forcelayerlog 1
and then the validation layer tags each error with the tag “VALIDATION”. Use an adb command such as the following to view them: