Skip to content

Commit

Permalink
build: Downstream 1.3.286 and prepare for release 1.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
aqnuep committed Jul 4, 2024
2 parents 208b998 + 8d6ac1b commit b523ab6
Show file tree
Hide file tree
Showing 715 changed files with 128,802 additions and 280,085 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/vvl.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2021-2023 Valve Corporation
# Copyright (c) 2021-2023 LunarG, Inc.
# Copyright (c) 2021-2024 Valve Corporation
# Copyright (c) 2021-2024 LunarG, Inc.
# Copyright (c) 2023-2024 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ out64/*
scripts/.vs
.*.sw[op]
*~
*.10x

# BUILD.gn artifacts
.cipd/
Expand Down
109 changes: 61 additions & 48 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ vvl_sources = [
"layers/best_practices/bp_synchronization.cpp",
"layers/best_practices/bp_video.cpp",
"layers/best_practices/bp_wsi.cpp",
"layers/chassis/chassis_handle_data.h",
"layers/chassis/chassis_modification_state.h",
"layers/chassis/layer_chassis_dispatch_manual.cpp",
"layers/containers/custom_containers.h",
"layers/containers/qfo_transfer.h",
"layers/containers/range_vector.h",
"layers/containers/subresource_adapter.cpp",
Expand Down Expand Up @@ -143,8 +147,12 @@ vvl_sources = [
"layers/core_checks/cc_shader_interface.cpp",
"layers/core_checks/cc_shader_object.cpp",
"layers/core_checks/cc_spirv.cpp",
"layers/core_checks/cc_state_tracker.h",
"layers/core_checks/cc_state_tracker.cpp",
"layers/core_checks/cc_synchronization.cpp",
"layers/core_checks/cc_video.cpp",
"layers/core_checks/cc_vuid_maps.cpp",
"layers/core_checks/cc_vuid_maps.h",
"layers/core_checks/cc_wsi.cpp",
"layers/core_checks/cc_ycbcr.cpp",
"layers/core_checks/core_validation.h",
Expand All @@ -155,15 +163,20 @@ vvl_sources = [
"layers/external/vma/vk_mem_alloc.h",
"layers/external/vma/vma.cpp",
"layers/external/vma/vma.h",
"layers/gpu_shaders/gpu_error_codes.h",
"layers/gpu_shaders/gpu_error_header.h",
"layers/gpu_shaders/gpu_shaders_constants.h",
"layers/gpu_validation/debug_printf.cpp",
"layers/gpu_validation/debug_printf.h",
"layers/gpu_validation/gpu_constants.h",
"layers/gpu_validation/gpu_descriptor_set.cpp",
"layers/gpu_validation/gpu_descriptor_set.h",
"layers/gpu_validation/gpu_error_message.cpp",
"layers/gpu_validation/gpu_error_message.h",
"layers/gpu_validation/gpu_image_layout.cpp",
"layers/gpu_validation/gpu_settings.h",
"layers/gpu_validation/gpu_shader_instrumentor.cpp",
"layers/gpu_validation/gpu_shader_instrumentor.h",
"layers/gpu_validation/gpu_state_tracker.cpp",
"layers/gpu_validation/gpu_state_tracker.h",
"layers/gpu_validation/gpu_subclasses.cpp",
Expand Down Expand Up @@ -191,7 +204,8 @@ vvl_sources = [
"layers/gpu_validation/spirv/bindless_descriptor_pass.cpp",
"layers/gpu_validation/spirv/buffer_device_address_pass.h",
"layers/gpu_validation/spirv/buffer_device_address_pass.cpp",
"layers/layer_chassis_dispatch_manual.cpp",
"layers/gpu_validation/spirv/ray_query_pass.h",
"layers/gpu_validation/spirv/ray_query_pass.cpp",
"layers/layer_options.cpp",
"layers/layer_options.h",
"layers/object_tracker/object_lifetime_validation.h",
Expand Down Expand Up @@ -236,7 +250,7 @@ vvl_sources = [
"layers/state_tracker/state_object.h",
"layers/state_tracker/state_tracker.cpp",
"layers/state_tracker/state_tracker.h",
"layers/state_tracker/vertex_index_buffer_state.cpp",
"layers/state_tracker/submission_reference.h",
"layers/state_tracker/vertex_index_buffer_state.h",
"layers/state_tracker/video_session_state.cpp",
"layers/state_tracker/video_session_state.h",
Expand Down Expand Up @@ -281,12 +295,10 @@ vvl_sources = [
"layers/thread_tracker/thread_safety_validation.cpp",
"layers/thread_tracker/thread_safety_validation.h",
"layers/utils/android_ndk_types.h",
"layers/utils/convert_utils.cpp",
"layers/utils/convert_utils.h",
"layers/utils/ray_tracing_utils.cpp",
"layers/utils/ray_tracing_utils.h",
"layers/utils/shader_utils.cpp",
"layers/utils/shader_utils.h",
"layers/utils/image_layout_utils.cpp",
"layers/utils/image_layout_utils.h",
"layers/vulkan/generated/best_practices.cpp",
"layers/vulkan/generated/best_practices.h",
"layers/vulkan/generated/chassis.cpp",
Expand All @@ -296,14 +308,21 @@ vvl_sources = [
"layers/vulkan/generated/dynamic_state_helper.cpp",
"layers/vulkan/generated/dynamic_state_helper.h",
"layers/vulkan/generated/enum_flag_bits.h",
"layers/vulkan/generated/gpu_as_inspection_comp.h",
"layers/vulkan/generated/gpu_inst_shader_hash.h",
"layers/vulkan/generated/gpu_pre_dispatch_comp.h",
"layers/vulkan/generated/gpu_pre_dispatch_comp.cpp",
"layers/vulkan/generated/gpu_pre_draw_vert.h",
"layers/vulkan/generated/gpu_pre_draw_vert.cpp",
"layers/vulkan/generated/gpu_pre_trace_rays_rgen.h",
"layers/vulkan/generated/gpu_pre_trace_rays_rgen.cpp",
"layers/vulkan/generated/gpu_pre_copy_buffer_to_image_comp.h",
"layers/vulkan/generated/gpu_pre_copy_buffer_to_image_comp.cpp",
"layers/vulkan/generated/inst_bindless_descriptor_comp.h",
"layers/vulkan/generated/inst_bindless_descriptor_comp.cpp",
"layers/vulkan/generated/inst_buffer_device_address_comp.h",
"layers/vulkan/generated/inst_buffer_device_address_comp.cpp",
"layers/vulkan/generated/inst_ray_query_comp.h",
"layers/vulkan/generated/inst_ray_query_comp.cpp",
"layers/vulkan/generated/layer_chassis_dispatch.cpp",
"layers/vulkan/generated/layer_chassis_dispatch.h",
"layers/vulkan/generated/object_tracker.cpp",
Expand All @@ -327,15 +346,45 @@ vvl_sources = [
"layers/vulkan/generated/valid_enum_values.h",
"layers/vulkan/generated/valid_flag_values.cpp",
"layers/vulkan/generated/vk_api_version.h",
"layers/error_message/error_location.cpp",
"layers/error_message/error_location.h",
"layers/error_message/error_strings.h",
"layers/error_message/logging.h",
"layers/error_message/logging.cpp",
"layers/error_message/record_object.h",
"layers/external/xxhash.h",
"layers/utils/android_ndk_types.h",
"layers/utils/cast_utils.h",
"layers/utils/convert_utils.cpp",
"layers/utils/convert_utils.h",
"layers/utils/hash_util.cpp",
"layers/utils/hash_util.h",
"layers/utils/hash_vk_types.h",
"layers/utils/image_layout_utils.cpp",
"layers/utils/image_layout_utils.h",
"layers/utils/vk_layer_extension_utils.cpp",
"layers/utils/vk_layer_extension_utils.h",
"layers/utils/vk_layer_utils.cpp",
"layers/utils/vk_layer_utils.h",
"layers/vk_layer_config.cpp",
"layers/vk_layer_config.h",
"layers/vulkan/generated/error_location_helper.cpp",
"layers/vulkan/generated/error_location_helper.h",
"layers/vulkan/generated/feature_requirements_helper.cpp",
"layers/vulkan/generated/feature_requirements_helper.h",
"layers/vulkan/generated/pnext_chain_extraction.cpp",
"layers/vulkan/generated/pnext_chain_extraction.h",
"layers/vulkan/generated/vk_function_pointers.cpp",
"layers/vulkan/generated/vk_function_pointers.h",
"layers/vulkan/generated/vk_validation_error_messages.h",
"layers/vulkan/generated/vk_layer_dispatch_table.h",
"layers/vulkan/generated/vk_dispatch_table_helper.cpp",
"layers/vulkan/generated/vk_dispatch_table_helper.h",
"layers/vulkan/generated/vk_object_types.h",
"layers/vulkan/generated/vk_object_types.cpp",
"layers/vulkan/generated/vk_api_version.h",
"layers/vulkan/generated/vk_extension_helper.h",
"layers/vulkan/generated/vk_extension_helper.cpp",
"layers/vulkan/generated/vk_safe_struct_core.cpp",
"layers/vulkan/generated/vk_safe_struct_ext.cpp",
"layers/vulkan/generated/vk_safe_struct_khr.cpp",
"layers/vulkan/generated/vk_safe_struct_utils.cpp",
"layers/vulkan/generated/vk_safe_struct_vendor.cpp",
]

layers = [ [
Expand Down Expand Up @@ -400,42 +449,6 @@ source_set("vulkan_layer_utils") {
sources = [
"$vulkan_headers_dir/include/vulkan/vk_layer.h",
"$vulkan_headers_dir/include/vulkan/vulkan.h",
"layers/containers/custom_containers.h",
"layers/containers/sparse_containers.h",
"layers/error_message/error_location.cpp",
"layers/error_message/error_location.h",
"layers/error_message/error_strings.h",
"layers/error_message/logging.cpp",
"layers/error_message/logging.h",
"layers/error_message/record_object.h",
"layers/external/xxhash.h",
"layers/utils/android_ndk_types.h",
"layers/utils/cast_utils.h",
"layers/utils/hash_util.cpp",
"layers/utils/hash_util.h",
"layers/utils/hash_vk_types.h",
"layers/utils/ray_tracing_utils.cpp",
"layers/utils/ray_tracing_utils.h",
"layers/utils/vk_layer_extension_utils.cpp",
"layers/utils/vk_layer_extension_utils.h",
"layers/utils/vk_layer_utils.cpp",
"layers/utils/vk_layer_utils.h",
"layers/vk_layer_config.cpp",
"layers/vk_layer_config.h",
"layers/vulkan/generated/error_location_helper.cpp",
"layers/vulkan/generated/error_location_helper.h",
"layers/vulkan/generated/layer_chassis_dispatch.h",
"layers/vulkan/generated/feature_requirements_helper.cpp",
"layers/vulkan/generated/feature_requirements_helper.h",
"layers/vulkan/generated/pnext_chain_extraction.cpp",
"layers/vulkan/generated/pnext_chain_extraction.h",
"layers/vulkan/generated/vk_api_version.h",
"layers/vulkan/generated/vk_extension_helper.h",
"layers/vulkan/generated/vk_layer_dispatch_table.h",
"layers/vulkan/generated/vk_object_types.h",
"layers/vulkan/generated/vk_object_types.cpp",
"layers/vulkan/generated/vk_safe_struct.h",
"layers/vulkan/generated/vk_validation_error_messages.h",
]
public_configs = [
":vulkan_internal_config",
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ~~~
# Copyright (c) 2014-2023 Valve Corporation
# Copyright (c) 2014-2023 LunarG, Inc.
# Copyright (c) 2014-2024 Valve Corporation
# Copyright (c) 2014-2024 LunarG, Inc.
# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -65,7 +65,9 @@ else()
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)

find_package(PkgConfig REQUIRED QUIET)
if (BUILD_WSI_XCB_SUPPORT OR BUILD_WSI_XLIB_SUPPORT OR BUILD_WSI_WAYLAND_SUPPORT)
find_package(PkgConfig REQUIRED QUIET)
endif()

if(BUILD_WSI_XCB_SUPPORT)
pkg_check_modules(XCB REQUIRED QUIET IMPORTED_TARGET xcb)
Expand Down Expand Up @@ -99,8 +101,6 @@ find_package(SPIRV-Headers CONFIG QUIET)

find_package(SPIRV-Tools-opt CONFIG QUIET)

find_package(SPIRV-Tools-link CONFIG QUIET)

# NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users.
# So this target needs to be off by default to avoid obtuse build errors or patches.
option(VVL_CODEGEN "Enable vulkan validation layer code generation")
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ a Vulkan driver. Applications have full control and responsibility for correct o
how Vulkan is used can result in a crash. This project provides Vulkan validation layers that can be enabled
to assist development by enabling developers to verify their applications correct use of the Vulkan API.

## Getting Binaries

For those who don't want to build from source, there are few ways to get working binaries to use
- The [Vulkan SDK](https://vulkan.lunarg.com/sdk/home) will have the most well tested versions of the layer
- For Android, each SDK tag will have binaries to download (example: [vulkan-sdk-1.3.280.0 tag](https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/tag/vulkan-sdk-1.3.280.0))
- Every change applied to the main branch runs through GitHub action and will [produce artifacts](https://github.com/KhronosGroup/Vulkan-ValidationLayers/actions?query=branch%3Amain) of the latest commit.

## Community Assistance

Before submitting an issue to the validation layers or reaching out to the developers it may be prudent to reach out to the community first.
Expand Down
40 changes: 21 additions & 19 deletions docs/creating_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ This is an "up-to-speed" document for writing tests to validate the Validation L

## Rule #1

The first rule is to make sure you are actually running the tests on the built version of the Validation Layers you want. If you have the Vulkan SDK installed, then you will have a pre-built version of the Validation Layers set in your path and those are probably not the version you want to test.
The first rule is to make sure you are actually running the tests on the built version of the Validation Layers you want. Set the environment variable `VK_LOADER_DEBUG` to `layer` and check that the output of the tests report that the path of the validation layer matches what is expected.

The tests automatically set `VK_LAYER_PATH` to the validation layer in the build tree. However if you wish to use a different validation layer than the one that was built, or if you wish to use multiple layers in the tests at the same time, you must set `VK_LAYER_PATH` or `VK_ADD_LAYER_PATH` to include each path to the desired layers, including the validation layer.

Make sure you have the correct `VK_LAYER_PATH` set on Windows or Linux (on Android the layers are baked into the APK so there is nothing to worry about)

Expand Down Expand Up @@ -85,13 +87,13 @@ RETURN_IF_SKIP(Init());
const bool copy_commands2 = IsExtensionsEnabled(VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME);

// Validate core copy command
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, vuid);
m_errorMonitor->SetDesiredError(vuid);
vk::CmdCopyBuffer( /* */ );
m_errorMonitor->VerifyFound();

// optional test using VK_KHR_copy_commands2
if (copy_commands2) {
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, vuid);
m_errorMonitor->SetDesiredError(vuid);
vk::CmdCopyBuffer2KHR( /* */ );
m_errorMonitor->VerifyFound();
}
Expand Down Expand Up @@ -149,35 +151,35 @@ The few common patterns that will cover 99% of cases are:
- **By default**, all Vulkan API calls are expected to succeed. In the past, one would have to "wrap" API calls in `ExpectSuccess`/`VerifyNotFound` to ensure an API call did not trigger any errors. This is no longer the case. e.g.,
```cpp
// m_errorMonitor->ExpectSuccess(); <- implicit
vk::CreateSampler(m_device->device(), &sci, nullptr, &samplers[0]);
vk::CreateSampler(device(), &sci, nullptr, &samplers[0]);
// m_errorMonitor->VerifyNoutFound(); <- implicit
```
The `ExpectSuccess` and `VerifyNotFound` calls are now implicit.
- For checking a call that invokes a VUID error
```cpp
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkSamplerCreateInfo-addressModeU-01646");
m_errorMonitor->SetDesiredError("VUID-VkSamplerCreateInfo-addressModeU-01646");
// The following API call is expected to trigger 01646 and _only_ 01646
vk::CreateSampler(m_device->device(), &sci, NULL, &BadSampler);
vk::CreateSampler(device(), &sci, NULL, &BadSampler);
m_errorMonitor->VerifyFound();

// All calls after m_errorMonitor->VerifyFound() are expected to not trigger any errors. e.g., the following API call should succeed with no validation errors being triggered.
vk::CreateImage(m_device->device(), &ci, nullptr, &mp_image);
vk::CreateImage(device(), &ci, nullptr, &mp_image);

```
- When it is possible another VUID will be triggered that you are not testing. This usually happens due to making something invalid can cause a chain effect causing other things to be invalid as well.
- Note: If the `SetUnexpectedError` is never called it will not fail the test
```cpp
m_errorMonitor->SetUnexpectedError("VUID-VkImageMemoryRequirementsInfo2-image-01590");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkImageMemoryRequirementsInfo2-image-02280");
m_errorMonitor->SetDesiredError("VUID-VkImageMemoryRequirementsInfo2-image-02280");
vkGetImageMemoryRequirements2Function(device(), &mem_req_info2, &mem_req2);
m_errorMonitor->VerifyFound();
```

- When you expect multpile VUID to be triggered. This is also be a case if you expect the same VUID to be called twice.
- Note: If both VUID are not found the test will fail
```cpp
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00905");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00907");
m_errorMonitor->SetDesiredError("VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00905");
m_errorMonitor->SetDesiredError("VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00907");
vk::CmdBeginRenderPass(m_commandBuffer->handle(), &m_renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
m_errorMonitor->VerifyFound();
```
Expand All @@ -186,7 +188,7 @@ m_errorMonitor->VerifyFound();
- Note: The start of the test might already have a boolean that checks for extension support
```cpp
const char* vuid = IsExtensionsEnabled(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME) ? "VUID-vkCmdCopyImage-dstImage-01733" : "VUID-vkCmdCopyImage-dstImage-01733";
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, vuid);
m_errorMonitor->SetDesiredError(vuid);
m_commandBuffer->CopyImage(image_2.image(), VK_IMAGE_LAYOUT_GENERAL, image_1.image(), VK_IMAGE_LAYOUT_GENERAL, 1, &copy_region);
m_errorMonitor->VerifyFound();
```
Expand All @@ -195,12 +197,12 @@ m_errorMonitor->VerifyFound();
- Keep it simple. Try to make each test as small and concise as possible.
- Avoid testing VUIDs in "batches" such as:
```cpp
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferBeginInfo-flags-06003");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferInheritanceRenderingInfo-colorAttachmentCount-06004");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferInheritanceRenderingInfo-variableMultisampleRate-06005");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferInheritanceRenderingInfo-depthAttachmentFormat-06007");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferInheritanceRenderingInfo-multiview-06008");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkCommandBufferInheritanceRenderingInfo-viewMask-06009");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferBeginInfo-flags-06003");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferInheritanceRenderingInfo-colorAttachmentCount-06004");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferInheritanceRenderingInfo-variableMultisampleRate-06005");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferInheritanceRenderingInfo-depthAttachmentFormat-06007");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferInheritanceRenderingInfo-multiview-06008");
m_errorMonitor->SetDesiredError("VUID-VkCommandBufferInheritanceRenderingInfo-viewMask-06009");
...
vk::BeginCommandBuffer(secondary_cmd_buffer, &cmd_buffer_begin_info);
m_errorMonitor->VerifyFound();
Expand All @@ -216,15 +218,15 @@ used to make it obvious).
VkImageSubresource subresource{};
subresource.aspectMask = VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT;
VkSubresourceLayout layout{};
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetImageSubresourceLayout-tiling-09433");
m_errorMonitor->SetDesiredError("VUID-vkGetImageSubresourceLayout-tiling-09433");
vk::GetImageSubresourceLayout(m_device->handle(), image.handle(), &subresource, &layout);
m_errorMonitor->VerifyFound();
```
Here it is obvious that the `aspectMask` parameter is the cause of 02271.

### Viewing VU Messages

When `SetDesiredFailureMsg` is used, nothing is displayed if the test is successful. To see the messages regardless use `--print-vu`
When `SetDesiredError` is used, nothing is displayed if the test is successful. To see the messages regardless use `--print-vu`

```bash
./tests/vk_layer_validation_tests --print-vu --gtest_filter=Tests
Expand Down
Loading

0 comments on commit b523ab6

Please sign in to comment.