News & Insights > Case Studies

Vulkan Validation Layers

Challenge

By design, Vulkan device drivers provide no error checking. However, Vulkan application developers will need a way to validate that they are using the Vulkan API correctly while developing their applications. The solution described in the Vulkan Specification was to define validation layers as a critical, if not mandatory, part of the development process. While the Vulkan Validation Layers can provide valuable information to developers, constant runtime API validation can result in performance penalties. Vulkan developers can use the Validation Layers as part of the debug process and then turn them off when running production code — eliminating the performance penalty.

Solution

LunarG worked closely with The Khronos Group and the Vulkan Working Group member companies to develop a solution: a comprehensive validation layer for the Vulkan API, which is now part of the Vulkan Software Development Kit (SDK). LunarG remains the curator for the open-source Vulkan-ValidationLayers GitHub project, which is responsible for enforcing adherence to the Vulkan API specification.

As part of these efforts, LunarG worked hard to significantly reduce the learning curve for validation layer developers by simplifying source code organization, documentation and development processes. LunarG also made the workflow clearer and more efficient, including architectural support to isolate interfaces and source code, naming, hiding layer infrastructure, and providing simplified services and features.

How the Solution Works

A layer inserts itself into the call chain for Vulkan commands, enabling developers to validate API parameters, state information, and data. A substantial portion of the validation relies on custom code-generation from resources available in the Khronos Vulkan Registry. This toolchain is python-based and is automated to insulate source from Vulkan Specification modifications and updates.

The Vulkan-ValidationLayers GitHub project, which is implemented in C++11, supports build environments such as CMake and Ninja, and also offers cross-platform support for Windows, Linux, Android, IOS and MacOS.

Testing resources include custom tests for individual validation checks, built on the googletest test framework. Continuous integration testing and code reviews are enforced on a per-commit basis internally using Jenkins and Gerrit, and at the GitHub/GitLab level using Appveyor and Travis.

Outcome & Benefits

Now that Vulkan application developers can perform validation with the Vulkan Validation Layers, they’re able to largely avoid the performance penalty of runtime API validation for production applications. More importantly, they’re able to detect and fix issues earlier in the software development lifecycle improving developer productivity.

  • Need Help with
    3D Graphics Software?

    Let’s talk about your project and how our industry leading team of 3D software engineers can help you build something amazing.