File: gpu_av_development.md

package info (click to toggle)
vulkan-validationlayers 1.4.328.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 49,412 kB
  • sloc: cpp: 615,223; python: 12,115; sh: 24; makefile: 20; xml: 14
file content (39 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# GPU-AV Development Guide

For those brave souls, here are some overall basic tips/advice that should not get outdated as things actively change

## You need to Validate with "Self Valiation"

Since GPU-AV itself utilizes the Vulkan API to perform its tasks,
Vulkan function calls have to valid. To ensure that, those calls have to
go through another instance of the Vulkan Validation Layer. We refer to this
as "self validation".

How to setup self validation:
- Build the self validation layer:
    - Make sure to use a Release build
        - Otherwise might be really slow with double validation
    - Use the the `-DBUILD_SELF_VVL=ON` cmake option when generating the CMake project
        - The build will produce a manifest file used by the Vulkan loader, `VkLayer_dev_self_validation.json`.
        The `name` field in this file is `VK_LAYER_DEV_self_validation` to differentiate the self validation layer from the one you work on.
            - If the name were the same, the loader/os would mark both layers as duplicates and not load the second instance
- Then use it:
    - you need to ask the loader to load the self validation layer, and tell it where to find it.
        Do this by modifying the `VK_INSTANCE_LAYERS` and `VK_LAYER_PATH`, like so for instance:
```bash
# Windows
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation;VK_LAYER_DEV_self_validation
VK_LAYER_PATH=C:\Path\To\Vulkan-ValidationLayers\build\debug\layers\Debug;C:\Path\To\Vulkan-ValidationLayers\build_self_vvl\layers\Release

# Linux
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:VK_LAYER_DEV_self_validation
VK_LAYER_PATH=/Path/To/Vulkan-ValidationLayers/build/debug/layers/Debug:/Path/To/Vulkan-ValidationLayers/build_self_vvl/layers/Release
```

⚠️ Make sure to load the self validation layer **after** the validation layer you work on, by putting its name in `VK_INSTANCE_LAYERS` after the validation layer you work on. Otherwise your Vulkan calls will not be intercepted by the self validation layer.
To make sure you did it properly, you can use the environment variable `VK_LOADER_DEBUG=layer` to see how the loader sets up layers.

## We generate our SPIR-V offline

There is a `scripts/generate_spirv.py` that will take GLSL (maybe Slang in the future) and creates SPIR-V blobs baked in a C++ file. [We have more details here](../layers/gpuav/shaders/README.md)