• Home
Name Date Size #Lines LOC

..--

generated/03-May-2024-106,65593,072

json/03-May-2024-182175

CMakeLists.txtD03-May-202412.6 KiB271248

README.mdD03-May-20247.2 KiB8756

VkLayer_core_validation.defD03-May-20241.1 KiB3128

VkLayer_khronos_validation.defD03-May-20241.1 KiB3128

VkLayer_object_lifetimes.defD03-May-20241.1 KiB3128

VkLayer_stateless_validation.defD03-May-20241.1 KiB3128

VkLayer_thread_safety.defD03-May-20241.1 KiB3128

VkLayer_unique_objects.defD03-May-20241.1 KiB3128

android_ndk_types.hD03-May-20245.1 KiB12370

best_practices.cppD03-May-202419 KiB394292

best_practices.hD03-May-20246.4 KiB9164

buffer_validation.cppD03-May-2024333.7 KiB5,2244,396

buffer_validation.hD03-May-20241.6 KiB4317

cast_utils.hD03-May-20244.4 KiB9461

convert_to_renderpass2.cppD03-May-202410.7 KiB203172

convert_to_renderpass2.hD03-May-2024946 253

core_validation.cppD03-May-2024880.2 KiB14,61012,332

core_validation.hD03-May-2024168.7 KiB2,0171,800

core_validation_error_enums.hD03-May-202431.6 KiB287133

core_validation_types.hD03-May-202470.7 KiB1,5891,267

descriptor_sets.cppD03-May-2024146.1 KiB2,6092,208

descriptor_sets.hD03-May-202435.8 KiB668457

drawdispatch.cppD03-May-202432 KiB485398

gpu_validation.cppD03-May-202482.2 KiB1,5081,220

gpu_validation.hD03-May-20244.1 KiB11076

hash_util.hD03-May-20246.1 KiB16595

hash_vk_types.hD03-May-20243.7 KiB10368

libVkLayer_core_validation.mapD03-May-2024211 1110

libVkLayer_khronos_validation.mapD03-May-2024211 1110

libVkLayer_object_lifetimes.mapD03-May-2024211 1110

libVkLayer_stateless_validation.mapD03-May-2024211 1110

libVkLayer_thread_safety.mapD03-May-2024211 1110

libVkLayer_unique_objects.mapD03-May-2024211 1110

object_lifetime_validation.hD03-May-202415.1 KiB280205

object_tracker_utils.cppD03-May-202450.6 KiB905765

old_vuid_to_new_mapping.txtD03-May-2024148.8 KiB3,1083,107

parameter_name.hD03-May-20245.4 KiB13151

parameter_validation_utils.cppD03-May-2024239.8 KiB3,5853,057

shader_validation.cppD03-May-2024167.5 KiB3,2162,670

shader_validation.hD03-May-202411.2 KiB298208

sparse_containers.hD03-May-202416.7 KiB405257

stateless_validation.hD03-May-202466.9 KiB1,168694

vk_format_utils.cppD03-May-202465.9 KiB1,3731,214

vk_format_utils.hD03-May-20249.2 KiB192160

vk_layer_config.cppD03-May-202413 KiB374285

vk_layer_config.hD03-May-20243.1 KiB7546

vk_layer_data.hD03-May-20241.7 KiB5525

vk_layer_extension_utils.cppD03-May-20242.1 KiB6733

vk_layer_extension_utils.hD03-May-20241.5 KiB4111

vk_layer_logging.hD03-May-202456.1 KiB1,2521,000

vk_layer_settings.txtD03-May-20246.2 KiB120113

vk_layer_utils.cppD03-May-202411 KiB234169

vk_layer_utils.hD03-May-202411.4 KiB320208

vk_loader_layer.hD03-May-20241.5 KiB4721

vk_loader_platform.hD03-May-202413.9 KiB368242

vk_mem_alloc.hD03-May-2024578 KiB16,81411,397

xxhash.cD03-May-202429 KiB889604

xxhash.hD03-May-202412.3 KiB294109

README.md

1# Layer Description and Status
2
3## Layer Library Interface
4
5All layer libraries must support the layer library interface defined in
6[`LoaderAndLayerInterface.md`][].
7
8[`LoaderAndLayerInterface.md`]: ../loader/LoaderAndLayerInterface.md#layer-library-interface
9
10## Overview
11
12Layer libraries can be written to intercept or hook VK entry points for various
13debug and validation purposes.  One or more VK entry points can be defined in your Layer
14library.  Undefined entrypoints in the Layer library will be passed to the next Layer which
15may be the driver.  Multiple layer libraries can be chained (actually a hierarchy) together.
16vkEnumerateInstanceLayerProperties can be called to list the
17available layers and their properties.  Layers can intercept all Vulkan commands
18that take a dispatchable object as it's first argument. I.e.  VkInstance, VkPhysicalDevice,
19VkDevice, VkCommandBuffer, and VkQueue.
20vkXXXXGetProcAddr is used internally by the Layers and Loader to initialize dispatch tables.
21Layers can also be activated via the VK_INSTANCE_LAYERS environment variable.
22
23All validation layers work with the DEBUG_REPORT extension to provide validation feedback.
24When a validation layer is enabled, it will look for a vk_layer_settings.txt file (see"Using
25Layers" section below for more details) to define its logging behavior, which can include
26sending output to a file, stdout, or debug output (Windows). Applications can also register
27debug callback functions via the DEBUG_REPORT extension to receive callbacks when validation
28events occur. Application callbacks are independent of settings in a vk_layer_settings.txt
29file which will be carried out separately. If no vk_layer_settings.txt file is present and
30no application callbacks are registered, error messages will be output through default
31logging callbacks.
32
33### Layer library example code
34
35Note that some layers are code-generated and will therefore exist in the directory `(build_dir)/layers`
36
37`include/vkLayer.h` - header file for layer code.
38
39### Standard Validation
40NOTE: This meta-layer is being deprecated -- users should load the Khronos validation layer (name = `VK_LAYER_KHRONOS_validation`) in its place.
41This is a meta-layer managed by the loader. (name = `VK_LAYER_LUNARG_standard_validation`) - specifying this layer name will cause the loader to load the standard validation layer:  `VK_LAYER_KHRONOS_validation`. Other layers can be specified and the loader will remove duplicates.
42
43### The Khronos Validation Layer
44
45This layer emcompasses all of the functionality that used to be contained in the following layers: VK_LAYER_GOOGLE_threading, VK_LAYER_LUNARG_parameter_validation, VK_LAYER_LUNARG_object_tracker, VK_LAYER_LUNARG_core_validation, and VK_LAYER_GOOGLE_unique_objects. Each of these functional areas can still disabled individually, and are described below.
46
47### Object Validation and Statistics
48The object lifetime tracking will track object creation, use, and destruction. As objects are created their handles are stored in a data structure. As objects are used the layer verifies they exist in the data structure and output errors for unknown objects. As objects are destroyed they are removed from the data structure. At `vkDestroyDevice()` and `vkDestroyInstance()` times, if any objects have not been destroyed they are reported as leaked objects. If a debug callback function is registered this layer will use callback function(s) for reporting, otherwise it will use stdout.
49
50### Validate API State and Shaders
51The set of core checks does the bulk of the API validation that requires storing state. Some of the state it tracks includes the Descriptor Set, Pipeline State, Shaders, and dynamic state, and memory objects and bindings. It performs some point validation as states are created and used, and further validation Draw call and QueueSubmit time. Of primary interest is making sure that the resources bound to Descriptor Sets correctly align with the layout specified for the Set. Also, all of the image and buffer layouts are validated to make sure explicit layout transitions are properly managed. Related to memory, core\_validation includes tracking object bindings, memory hazards, and memory object lifetimes. It also validates several other hazard-related issues related to command buffers, fences, and memory mapping. Additionally core\_validation include shader validation (formerly separate shader\_checker layer) that inspects the SPIR-V shader images and fixed function pipeline stages at PSO creation time. It flags errors when inconsistencies are found across interfaces between shader stages. The exact behavior of the checks depends on the pair of pipeline stages involved. If a debug callback function is registered, this layer will use callback function(s) for reporting, otherwise uses stdout.  This layer also validates correct usage of image- and buffer-related APIs, including image and buffer parameters, formats, and correct use.
52
53### Stateless parameter checking
54The stateless validation checks the input parameters to API calls for validity. If a debug callback function is registered, this layer will use callback function(s) for reporting otherwise uses stdout.
55
56### Thread Safety Checking
57The thread-safety validation will check the multithreading of API calls for validity. Currently this checks that only one thread at a time uses an object in free-threaded API calls. If a debug callback function is registered, this layer will use callback function(s) for reporting, otherwise uses stdout.
58
59### Handle Wrapping
60The khronos layer framework also supports Vulkan handle wrapping.  The Vulkan specification allows objects to have non-unique handles. This makes tracking object lifetimes difficult in that it is unclear which object is being referenced on deletion. When this functionalty is enabled (as it is by default) it will alias all objects with a unique object representation, allowing proper object lifetime tracking. This functionality may interfere with the development of proprietary Vulkan extension development, and is not strictly required for the proper operation of validation. One sign that it is needed is the appearance of errors emitted from the object_tracker layer indicating the use of previously destroyed objects.
61
62## Using Layers
63
641. Build VK loader using normal steps (cmake and make)
652. Place `libVkLayer_khronos_validation.so` in the same directory as your VK test or app:
66
67    `cp build/layer/libVkLayer_khronos_validation.so  build/tests`
68
69    This is required for the Loader to be able to scan and enumerate your library.
70    Alternatively, use the `VK_LAYER_PATH` environment variable to specify where the layer libraries reside.
71
723. To specify how your layers should behave, create a vk_layer_settings.txt file. This file can exist in the same directory as your app or in a directory given by the `VK_LAYER_SETTINGS_PATH` environment variable. Alternatively, you can use any filename you want if you set `VK_LAYER_SETTINGS_PATH` to the full path of the file, rather than the directory that contains it.
73
74    Model the file after the following example:  [*vk_layer_settings.txt*](vk_layer_settings.txt)
75
764. Specify which layers to activate using environment variables.
77
78    `export VK\_INSTANCE\_LAYERS=VK\_LAYER\_KHRONOS\_validation`
79    `cd build/tests; ./vkinfo`
80
81
82## Status
83
84
85### Current known issues
86
87