Skip to content

Commit

Permalink
build: Automate self vvl renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Jun 24, 2024
1 parent 23f9647 commit 43a3ef8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 4 additions & 10 deletions docs/gpu_validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -939,21 +939,15 @@ as "self validation".
How to setup self validation:
- Build the self validation layer:
- Make sure to use a Release build
- Use the the `-DBUILD_SELF_VVL=ON` cmake option when generating the Cmake project
- Manifest file modification:
- The build will produce a manifest file used by the Vulkan loader, `VkLayer_khronos_validation.json`.
The `name` field in this file needs to be changed, to be able to differentiate the self validation layer from the one you work on.
For instance, rename it to "VK_LAYER_DEV_self_validation"
```patch
- "name": "VK_LAYER_KHRONOS_validation",
+ "name": "VK_LAYER_DEV_self_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.
- 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
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/selfvvl/layers/Release
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.
Expand Down
8 changes: 7 additions & 1 deletion layers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,13 @@ endif()
# NOTE: For WIN32 the JSON and dll MUST be placed in the same location, due to Win32 using a relative path for installation.
set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}.json.in")
set(INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/validation.json")
set(OUTPUT_FILE_FINAL_NAME "${LAYER_NAME}.json")
if (BUILD_SELF_VVL)
set(OUTPUT_FILE_FINAL_NAME "VkLayer_dev_self_validation.json")
set(JSON_LAYER_NAME "VK_LAYER_DEV_self_validation")
else()
set(OUTPUT_FILE_FINAL_NAME "${LAYER_NAME}.json")
set(JSON_LAYER_NAME "VK_LAYER_KHRONOS_validation")
endif()
set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
if (WIN32)
set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}) # WIN32/MINGW expect the dll in the `bin` dir, this matches our WIN32 SDK process
Expand Down
2 changes: 1 addition & 1 deletion layers/VkLayer_khronos_validation.json.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"file_format_version": "1.2.0",
"layer": {
"name": "VK_LAYER_KHRONOS_validation",
"name": "@JSON_LAYER_NAME@",
"type": "GLOBAL",
"library_path": "@JSON_LIBRARY_PATH@",
"api_version": "1.3.288",
Expand Down

0 comments on commit 43a3ef8

Please sign in to comment.