diff options
author | Cody Northrop <cnorthrop@google.com> | 2018-02-16 23:51:50 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-02-16 23:51:50 +0000 |
commit | b8481cecf6c408349833c55a314416ee4095636f (patch) | |
tree | 76cebaa0faf0d423c6d3a3b3d6ed62a3902b243c | |
parent | 65d038a8ef46d49ec2aab0582e107aefad554c34 (diff) | |
parent | 78d0fe466dca7f42b1705d1b79e369df92941b58 (diff) | |
download | vulkan-validation-layers-b8481cecf6c408349833c55a314416ee4095636f.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into 20180216-merge-android_layers_to_master am: b948098905 am: efca2a46e0
am: 78d0fe466d
Change-Id: I6c3e47727db8cd9dab807b4359d05e98dbb5957c
45 files changed, 1884 insertions, 2001 deletions
diff --git a/.travis.yml b/.travis.yml index c24ca37bd..45e1188e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,11 +73,10 @@ script: git clone https://github.com/LunarG/VulkanTools.git cd VulkanTools # Get as little as possible from external sources - ./update_external_sources.sh --jsoncpp ./update_external_sources.sh --glslang --no-build # Build as few components as possible cmake -H. -Bbuild -DBUILD_LOADER=NO -DBUILD_TESTS=NO \ - -DBUILD_DEMOS=NO -DBUILD_VKTRACE=NO \ + -DBUILD_LAYERS=NO -DBUILD_DEMOS=NO -DBUILD_VKTRACE=NO \ -DBUILD_VKJSON=NO -DBUILD_VIA=NO -DBUILD_ICD=NO make -C build -j $core_count cd ${TRAVIS_BUILD_DIR} @@ -23,8 +23,11 @@ git clone https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers The build process uses CMake to generate makefiles for this project. The build generates the loader, layers, and tests. -This repo has been built and tested on the two most recent Ubuntu LTS versions. -It should be straightforward to use it on other Linux distros. +This repo has been built and tested on the two most recent Ubuntu LTS versions. Currently, the oldest supported +version is Ubuntu 14.04, meaning that the minimum supported compiler versions are GCC 4.8.2 and Clang 3.4, although +earlier versions may work. +It should be straightforward to adapt this repository to other Linux distributions. + These packages are needed to build this repository: ``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 26808788c..5cf85d487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ else() # is WIN32 option(DISABLE_BUILD_PATH_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with MSVC build type info" OFF) option(DISABLE_BUILDTGT_DIR_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with target info" OFF) + option(ENABLE_WIN10_ONECORE "Link the loader with OneCore umbrella libraries" OFF) # For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory. # 32-bit target data goes in build32, and 64-bit target data goes into build. So, include/link the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbc092532..2417cd4d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,6 +57,9 @@ a good reason is "This violates the style guide, but it improves type safety." * Run **clang-format** on your changes to maintain consistent formatting * There are `.clang-format files` present in the repository to define clang-format settings which are found and used automatically by clang-format. + * **clang-format** binaries are available from the LLVM orginization, here: https://clang.llvm.org/. Our CI system (Travis-CI) + currently uses clang-format version 5.0.0 to check that the lines of code you have changed are formatted properly. It is + recommended that you use the same version to format your code prior to submission. * A sample git workflow may look like: > # Make changes to the source. diff --git a/build-android/glslang_revision_android b/build-android/glslang_revision_android index cd5505abf..8843893c5 100644 --- a/build-android/glslang_revision_android +++ b/build-android/glslang_revision_android @@ -1 +1 @@ -b5b08462442239e6537315ea1405b6afcd53043e +23ea3db3e5ea16b4964e9e3b5fee88bfc267fc57 diff --git a/build-android/shaderc_revision_android b/build-android/shaderc_revision_android index f5fd46034..d65bc865d 100644 --- a/build-android/shaderc_revision_android +++ b/build-android/shaderc_revision_android @@ -1 +1 @@ -c60725343fd6c0822bb7f580661d2ec6460391c0 +563bc6e87a43c38b5495469307922c768edbd191 diff --git a/build-android/spirv-headers_revision_android b/build-android/spirv-headers_revision_android index 356c8f129..f6cc8e506 100644 --- a/build-android/spirv-headers_revision_android +++ b/build-android/spirv-headers_revision_android @@ -1 +1 @@ -061097878467b8e040fbf153a837d844ef9f9f96 +ce309203d7eceaf908bea8862c27f3e0749f7d00 diff --git a/build-android/spirv-tools_revision_android b/build-android/spirv-tools_revision_android index 5897580b9..9f033b45c 100644 --- a/build-android/spirv-tools_revision_android +++ b/build-android/spirv-tools_revision_android @@ -1 +1 @@ -90862fe4b1c6763b32ce683d2d32c2f281f577cf +5d442fad2f00fcca8354aaaa9bfd36be8c418a1b diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c index 205f4dc28..c27205a03 100644 --- a/demos/vulkaninfo.c +++ b/demos/vulkaninfo.c @@ -2436,7 +2436,8 @@ int main(int argc, char **argv) { #if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) bool has_display = true; - if (getenv("DISPLAY") == NULL) { + const char *display_var = getenv("DISPLAY"); + if (display_var == NULL || strlen(display_var) == 0) { printf("'DISPLAY' environment variable not set... skipping surface info\n"); has_display = false; } diff --git a/external_revisions/glslang_revision b/external_revisions/glslang_revision index 133bece2b..4eaed0b72 100644 --- a/external_revisions/glslang_revision +++ b/external_revisions/glslang_revision @@ -1 +1 @@ -715c353a15836e5ae192a64a4cf54e2ce7e8d66a +2651ccaec8 diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index c68af4ee0..071f41ab3 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -276,8 +276,7 @@ bool VerifyFramebufferAndRenderPassLayouts(layer_data *device_data, GLOBAL_CB_NO if (pRenderPassInfo->attachmentCount != framebufferInfo.attachmentCount) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", - "You cannot start a render pass using a framebuffer " - "with a different number of attachments."); + "You cannot start a render pass using a framebuffer with a different number of attachments."); } for (uint32_t i = 0; i < pRenderPassInfo->attachmentCount; ++i) { const VkImageView &image_view = framebufferInfo.pAttachments[i]; @@ -300,11 +299,9 @@ bool VerifyFramebufferAndRenderPassLayouts(layer_data *device_data, GLOBAL_CB_NO if (initial_layout != VK_IMAGE_LAYOUT_UNDEFINED && initial_layout != node.layout) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", - "You cannot start a render pass using attachment %u " - "where the render pass initial layout is %s and the previous " - "known layout of the attachment is %s. The layouts must match, or " - "the render pass initial layout for the attachment must be " - "VK_IMAGE_LAYOUT_UNDEFINED", + "You cannot start a render pass using attachment %u where the render pass initial layout is %s " + "and the previous known layout of the attachment is %s. The layouts must match, or the render " + "pass initial layout for the attachment must be VK_IMAGE_LAYOUT_UNDEFINED", i, string_VkImageLayout(initial_layout), string_VkImageLayout(node.layout)); } } @@ -502,9 +499,9 @@ bool ValidateBarriersToImages(layer_data *device_data, GLOBAL_CB_NODE const *cb_ skip |= log_msg( core_validation::GetReportData(device_data), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, HandleToUint64(img_barrier->image), __LINE__, VALIDATION_ERROR_0a00096e, - "DS", "%s: Image barrier 0x%p references image 0x%" PRIx64 - " of format %s that must have the depth and stencil aspects set, but its " - "aspectMask is 0x%" PRIx32 ". %s", + "DS", + "%s: Image barrier 0x%p references image 0x%" PRIx64 + " of format %s that must have the depth and stencil aspects set, but its aspectMask is 0x%" PRIx32 ". %s", func_name, static_cast<const void *>(img_barrier), HandleToUint64(img_barrier->image), string_VkFormat(image_create_info->format), aspect_mask, validation_error_map[VALIDATION_ERROR_0a00096e]); } @@ -806,8 +803,8 @@ bool PreCallValidateCreateImage(layer_data *device_data, const VkImageCreateInfo if (total_size > format_limits.maxResourceSize) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__, IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image", - "CreateImage resource size exceeds allowable maximum " - "Image resource size = 0x%" PRIxLEAST64 ", maximum resource size = 0x%" PRIxLEAST64 " ", + "CreateImage resource size exceeds allowable maximum Image resource size = 0x%" PRIxLEAST64 + ", maximum resource size = 0x%" PRIxLEAST64 " ", total_size, format_limits.maxResourceSize); } @@ -1004,9 +1001,8 @@ bool VerifyClearImageLayout(layer_data *device_data, GLOBAL_CB_NODE *cb_node, IM } skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, HandleToUint64(image_state->image), __LINE__, error_code, "DS", - "%s: Layout for cleared image is %s but can only be " - "TRANSFER_DST_OPTIMAL or GENERAL. %s", - func_name, string_VkImageLayout(dest_image_layout), validation_error_map[error_code]); + "%s: Layout for cleared image is %s but can only be TRANSFER_DST_OPTIMAL or GENERAL. %s", func_name, + string_VkImageLayout(dest_image_layout), validation_error_map[error_code]); } } @@ -1026,8 +1022,7 @@ bool VerifyClearImageLayout(layer_data *device_data, GLOBAL_CB_NODE *cb_node, IM } skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, error_code, "DS", - "%s: Cannot clear an image whose layout is %s and " - "doesn't match the current layout %s. %s", + "%s: Cannot clear an image whose layout is %s and doesn't match the current layout %s. %s", func_name, string_VkImageLayout(dest_image_layout), string_VkImageLayout(node.layout), validation_error_map[error_code]); } @@ -1121,8 +1116,8 @@ bool PreCallValidateCmdClearDepthStencilImage(layer_data *device_data, VkCommand if (((pRanges[i].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) && ((pRanges[i].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT)) { char const str[] = - "vkCmdClearDepthStencilImage aspectMasks for all subresource ranges must be " - "set to VK_IMAGE_ASPECT_DEPTH_BIT and/or VK_IMAGE_ASPECT_STENCIL_BIT"; + "vkCmdClearDepthStencilImage aspectMasks for all subresource ranges must be set to VK_IMAGE_ASPECT_DEPTH_BIT " + "and/or VK_IMAGE_ASPECT_STENCIL_BIT"; skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", str); } @@ -1318,8 +1313,8 @@ static inline bool CheckItgOffset(layer_data *device_data, const GLOBAL_CB_NODE if (IsExtentAllZeroes(&offset_extent) == false) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", - "%s: pRegion[%d].%s (x=%d, y=%d, z=%d) must be (x=0, y=0, z=0) " - "when the command buffer's queue family image transfer granularity is (w=0, h=0, d=0).", + "%s: pRegion[%d].%s (x=%d, y=%d, z=%d) must be (x=0, y=0, z=0) when the command buffer's queue family " + "image transfer granularity is (w=0, h=0, d=0).", function, i, member, offset->x, offset->y, offset->z); } } else { @@ -1328,8 +1323,8 @@ static inline bool CheckItgOffset(layer_data *device_data, const GLOBAL_CB_NODE if (IsExtentAligned(&offset_extent, granularity) == false) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", - "%s: pRegion[%d].%s (x=%d, y=%d, z=%d) dimensions must be even integer " - "multiples of this command buffer's queue family image transfer granularity (w=%d, h=%d, d=%d).", + "%s: pRegion[%d].%s (x=%d, y=%d, z=%d) dimensions must be even integer multiples of this command " + "buffer's queue family image transfer granularity (w=%d, h=%d, d=%d).", function, i, member, offset->x, offset->y, offset->z, granularity->width, granularity->height, granularity->depth); } @@ -1383,15 +1378,14 @@ static inline bool CheckItgExtent(layer_data *device_data, const GLOBAL_CB_NODE assert(false); } if (!(x_ok && y_ok && z_ok)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", - "%s: pRegion[%d].%s (w=%d, h=%d, d=%d) dimensions must be even integer multiples of this command buffer's " - "queue family image transfer granularity (w=%d, h=%d, d=%d) or offset (x=%d, y=%d, z=%d) + " - "extent (w=%d, h=%d, d=%d) must match the image subresource extents (w=%d, h=%d, d=%d).", - function, i, member, extent->width, extent->height, extent->depth, granularity->width, granularity->height, - granularity->depth, offset->x, offset->y, offset->z, extent->width, extent->height, extent->depth, - subresource_extent->width, subresource_extent->height, subresource_extent->depth); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", + "%s: pRegion[%d].%s (w=%d, h=%d, d=%d) dimensions must be even integer multiples of this command " + "buffer's queue family image transfer granularity (w=%d, h=%d, d=%d) or offset (x=%d, y=%d, z=%d) + " + "extent (w=%d, h=%d, d=%d) must match the image subresource extents (w=%d, h=%d, d=%d).", + function, i, member, extent->width, extent->height, extent->depth, granularity->width, + granularity->height, granularity->depth, offset->x, offset->y, offset->z, extent->width, extent->height, + extent->depth, subresource_extent->width, subresource_extent->height, subresource_extent->depth); } } return skip; @@ -1419,12 +1413,12 @@ static inline bool CheckItgSize(layer_data *device_data, const GLOBAL_CB_NODE *c const debug_report_data *report_data = core_validation::GetReportData(device_data); bool skip = false; if (SafeModulo(value, granularity) != 0) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", - "%s: pRegion[%d].%s (%" PRIdLEAST64 - ") must be an even integer multiple of this command buffer's queue family image transfer " - "granularity width (%d).", - function, i, member, value, granularity); + skip |= log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, "DS", + "%s: pRegion[%d].%s (%" PRIdLEAST64 + ") must be an even integer multiple of this command buffer's queue family image transfer granularity width (%d).", + function, i, member, value, granularity); } return skip; } @@ -1629,23 +1623,21 @@ bool ValidateImageCopyData(const layer_data *device_data, const debug_report_dat // if (dst_state->createInfo.imageType == VK_IMAGE_TYPE_1D) { if ((0 != region.dstOffset.y) || (1 != dst_copy_extent.height)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00130, "IMAGE", - "vkCmdCopyImage(): pRegion[%d] dstOffset.y is %d and dst_copy_extent.height is %d. For 1D images these must " - "be 0 and 1, respectively. %s", - i, region.dstOffset.y, dst_copy_extent.height, validation_error_map[VALIDATION_ERROR_09c00130]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00130, "IMAGE", + "vkCmdCopyImage(): pRegion[%d] dstOffset.y is %d and dst_copy_extent.height is %d. For 1D images " + "these must be 0 and 1, respectively. %s", + i, region.dstOffset.y, dst_copy_extent.height, validation_error_map[VALIDATION_ERROR_09c00130]); } } if ((dst_state->createInfo.imageType == VK_IMAGE_TYPE_1D) || (dst_state->createInfo.imageType == VK_IMAGE_TYPE_2D)) { if ((0 != region.dstOffset.z) || (1 != dst_copy_extent.depth)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00134, "IMAGE", - "vkCmdCopyImage(): pRegion[%d] dstOffset.z is %d and dst_copy_extent.depth is %d. For 1D and 2D images " - "these must be 0 and 1, respectively. %s", - i, region.dstOffset.z, dst_copy_extent.depth, validation_error_map[VALIDATION_ERROR_09c00134]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00134, "IMAGE", + "vkCmdCopyImage(): pRegion[%d] dstOffset.z is %d and dst_copy_extent.depth is %d. For 1D and 2D " + "images these must be 0 and 1, respectively. %s", + i, region.dstOffset.z, dst_copy_extent.depth, validation_error_map[VALIDATION_ERROR_09c00134]); } } @@ -1717,37 +1709,37 @@ bool ValidateImageCopyData(const layer_data *device_data, const debug_report_dat const VkExtent3D mip_extent = GetImageSubresourceExtent(dst_state, &(region.dstSubresource)); if ((SafeModulo(dst_copy_extent.width, block_size.width) != 0) && (dst_copy_extent.width + region.dstOffset.x != mip_extent.width)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00146, "IMAGE", - "vkCmdCopyImage(): pRegion[%d] dst_copy_extent width (%d) must be a multiple of the compressed texture block " - "width (%d), or when added to dstOffset.x (%d) must equal the image subresource width (%d). %s.", - i, dst_copy_extent.width, block_size.width, region.dstOffset.x, mip_extent.width, - validation_error_map[VALIDATION_ERROR_09c00146]); + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00146, "IMAGE", + "vkCmdCopyImage(): pRegion[%d] dst_copy_extent width (%d) must be a multiple of the compressed texture " + "block width (%d), or when added to dstOffset.x (%d) must equal the image subresource width (%d). %s.", + i, dst_copy_extent.width, block_size.width, region.dstOffset.x, mip_extent.width, + validation_error_map[VALIDATION_ERROR_09c00146]); } // Extent height must be a multiple of block height, or dst_copy_extent+offset height must equal subresource height if ((SafeModulo(dst_copy_extent.height, block_size.height) != 0) && (dst_copy_extent.height + region.dstOffset.y != mip_extent.height)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00148, "IMAGE", - "vkCmdCopyImage(): pRegion[%d] dst_copy_extent height (%d) must be a multiple of the compressed texture block " - "height (%d), or when added to dstOffset.y (%d) must equal the image subresource height (%d). %s.", - i, dst_copy_extent.height, block_size.height, region.dstOffset.y, mip_extent.height, - validation_error_map[VALIDATION_ERROR_09c00148]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c00148, "IMAGE", + "vkCmdCopyImage(): pRegion[%d] dst_copy_extent height (%d) must be a multiple of the compressed " + "texture block height (%d), or when added to dstOffset.y (%d) must equal the image subresource " + "height (%d). %s.", + i, dst_copy_extent.height, block_size.height, region.dstOffset.y, mip_extent.height, + validation_error_map[VALIDATION_ERROR_09c00148]); } // Extent depth must be a multiple of block depth, or dst_copy_extent+offset depth must equal subresource depth uint32_t copy_depth = (slice_override ? depth_slices : dst_copy_extent.depth); if ((SafeModulo(copy_depth, block_size.depth) != 0) && (copy_depth + region.dstOffset.z != mip_extent.depth)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c0014a, "IMAGE", - "vkCmdCopyImage(): pRegion[%d] dst_copy_extent width (%d) must be a multiple of the compressed texture block " - "depth (%d), or when added to dstOffset.z (%d) must equal the image subresource depth (%d). %s.", - i, dst_copy_extent.depth, block_size.depth, region.dstOffset.z, mip_extent.depth, - validation_error_map[VALIDATION_ERROR_09c0014a]); + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(dst_state->image), __LINE__, VALIDATION_ERROR_09c0014a, "IMAGE", + "vkCmdCopyImage(): pRegion[%d] dst_copy_extent width (%d) must be a multiple of the compressed texture " + "block depth (%d), or when added to dstOffset.z (%d) must equal the image subresource depth (%d). %s.", + i, dst_copy_extent.depth, block_size.depth, region.dstOffset.z, mip_extent.depth, + validation_error_map[VALIDATION_ERROR_09c0014a]); } } // Compressed } @@ -2118,13 +2110,12 @@ bool PreCallValidateCmdClearAttachments(layer_data *device_data, VkCommandBuffer // There are times where app needs to use ClearAttachments (generally when reusing a buffer inside of a render pass) // This warning should be made more specific. It'd be best to avoid triggering this test if it's a use that must call // CmdClearAttachments. - skip |= - log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(commandBuffer), 0, DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, "DS", - "vkCmdClearAttachments() issued on command buffer object 0x%" PRIx64 - " prior to any Draw Cmds." - " It is recommended you use RenderPass LOAD_OP_CLEAR on Attachments prior to any Draw.", - HandleToUint64(commandBuffer)); + skip |= log_msg( + report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(commandBuffer), 0, DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, "DS", + "vkCmdClearAttachments() issued on command buffer object 0x%" PRIx64 + " prior to any Draw Cmds. It is recommended you use RenderPass LOAD_OP_CLEAR on Attachments prior to any Draw.", + HandleToUint64(commandBuffer)); } skip |= outsideRenderPass(device_data, cb_node, "vkCmdClearAttachments()", VALIDATION_ERROR_18600017); } @@ -2209,12 +2200,11 @@ bool PreCallValidateCmdClearAttachments(layer_data *device_data, VkCommandBuffer auto attachment_layer_count = image_view_state->create_info.subresourceRange.layerCount; if ((pRects[j].baseArrayLayer >= attachment_layer_count) || (pRects[j].baseArrayLayer + pRects[j].layerCount > attachment_layer_count)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_18600022, "DS", - "vkCmdClearAttachments(): The layers defined in pRects[%d] are not contained in the layers of " - "pAttachment[%d]. %s", - j, i, validation_error_map[VALIDATION_ERROR_18600022]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_18600022, "DS", + "vkCmdClearAttachments(): The layers defined in pRects[%d] are not contained in the layers " + "of pAttachment[%d]. %s", + j, i, validation_error_map[VALIDATION_ERROR_18600022]); } } } @@ -2343,8 +2333,7 @@ bool PreCallValidateCmdBlitImage(layer_data *device_data, GLOBAL_CB_NODE *cb_nod VkFormatProperties props = GetFormatProperties(device_data, src_format); VkImageTiling tiling = src_image_state->createInfo.tiling; - VkFormatFeatureFlags flags = - (tiling == VK_IMAGE_TILING_LINEAR ? props.linearTilingFeatures : props.optimalTilingFeatures); + VkFormatFeatureFlags flags = (tiling == VK_IMAGE_TILING_LINEAR ? props.linearTilingFeatures : props.optimalTilingFeatures); if (VK_FORMAT_FEATURE_BLIT_SRC_BIT != (flags & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cb_node->commandBuffer), __LINE__, VALIDATION_ERROR_184001b4, "IMAGE", @@ -2446,8 +2435,7 @@ bool PreCallValidateCmdBlitImage(layer_data *device_data, GLOBAL_CB_NODE *cb_nod if (FormatIsDepthAndStencil(src_format)) { if ((srcAspect != VK_IMAGE_ASPECT_DEPTH_BIT) && (srcAspect != VK_IMAGE_ASPECT_STENCIL_BIT)) { std::stringstream ss; - ss << "vkCmdBlitImage: Combination depth/stencil image formats must have only one of " - "VK_IMAGE_ASPECT_DEPTH_BIT " + ss << "vkCmdBlitImage: Combination depth/stencil image formats must have only one of VK_IMAGE_ASPECT_DEPTH_BIT " << "and VK_IMAGE_ASPECT_STENCIL_BIT set in srcImage and dstImage"; skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", @@ -2716,8 +2704,8 @@ void PreCallRecordCmdBlitImage(layer_data *device_data, GLOBAL_CB_NODE *cb_node, // the IMAGE is the same // as the global IMAGE layout bool ValidateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB, - std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> const & globalImageLayoutMap, - std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> & overlayLayoutMap) { + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> const &globalImageLayoutMap, + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> &overlayLayoutMap) { bool skip = false; const debug_report_data *report_data = core_validation::GetReportData(device_data); for (auto cb_image_data : pCB->imageLayoutMap) { @@ -2729,20 +2717,18 @@ bool ValidateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB, // TODO: Set memory invalid which is in mem_tracker currently } else if (imageLayout != cb_image_data.second.initialLayout) { if (cb_image_data.first.hasSubresource) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", - "Cannot submit cmd buffer using image (0x%" PRIx64 - ") [sub-resource: aspectMask 0x%X array layer %u, mip level %u], " - "with layout %s when first use is %s.", - HandleToUint64(cb_image_data.first.image), cb_image_data.first.subresource.aspectMask, - cb_image_data.first.subresource.arrayLayer, cb_image_data.first.subresource.mipLevel, - string_VkImageLayout(imageLayout), string_VkImageLayout(cb_image_data.second.initialLayout)); + skip |= log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", + "Cannot submit cmd buffer using image (0x%" PRIx64 + ") [sub-resource: aspectMask 0x%X array layer %u, mip level %u], with layout %s when first use is %s.", + HandleToUint64(cb_image_data.first.image), cb_image_data.first.subresource.aspectMask, + cb_image_data.first.subresource.arrayLayer, cb_image_data.first.subresource.mipLevel, + string_VkImageLayout(imageLayout), string_VkImageLayout(cb_image_data.second.initialLayout)); } else { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", - "Cannot submit cmd buffer using image (0x%" PRIx64 - ") with layout %s when " - "first use is %s.", + "Cannot submit cmd buffer using image (0x%" PRIx64 ") with layout %s when first use is %s.", HandleToUint64(cb_image_data.first.image), string_VkImageLayout(imageLayout), string_VkImageLayout(cb_image_data.second.initialLayout)); } @@ -2802,9 +2788,8 @@ static bool ValidateMaskBits(core_validation::layer_data *device_data, VkCommand if (!required_bit) { skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS", - "%s AccessMask %d %s must contain at least one of access bits %d " - "%s when layout is %s, unless the app has previously added a " - "barrier for this transition.", + "%s AccessMask %d %s must contain at least one of access bits %d %s when layout is %s, unless the app " + "has previously added a barrier for this transition.", type, accessMask, string_VkAccessFlags(accessMask).c_str(), optional_bits, string_VkAccessFlags(optional_bits).c_str(), string_VkImageLayout(layout)); } else { @@ -2816,9 +2801,8 @@ static bool ValidateMaskBits(core_validation::layer_data *device_data, VkCommand } skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS", - "%s AccessMask %d %s must have required access bit %d %s %s when " - "layout is %s, unless the app has previously added a barrier for " - "this transition.", + "%s AccessMask %d %s must have required access bit %d %s %s when layout is %s, unless the app has " + "previously added a barrier for this transition.", type, accessMask, string_VkAccessFlags(accessMask).c_str(), required_bit, string_VkAccessFlags(required_bit).c_str(), opt_bits.c_str(), string_VkImageLayout(layout)); } @@ -2853,23 +2837,20 @@ bool ValidateLayouts(core_validation::layer_data *device_data, VkDevice device, if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_UNDEFINED) { if ((FormatIsColor(format) || FormatHasDepth(format)) && pCreateInfo->pAttachments[i].loadOp == VK_ATTACHMENT_LOAD_OP_LOAD) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", - "Render pass has an attachment with loadOp == VK_ATTACHMENT_LOAD_OP_LOAD and " - "initialLayout == VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you " - "intended. Consider using VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the " - "image truely is undefined at the start of the render pass."); + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + DRAWSTATE_INVALID_RENDERPASS, "DS", + "Render pass has an attachment with loadOp == VK_ATTACHMENT_LOAD_OP_LOAD and initialLayout == " + "VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you intended. Consider using " + "VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the image truely is undefined at the start of the " + "render pass."); } - if (FormatHasStencil(format) && - pCreateInfo->pAttachments[i].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", - "Render pass has an attachment with stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD " - "and initialLayout == VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you " - "intended. Consider using VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the " - "image truely is undefined at the start of the render pass."); + if (FormatHasStencil(format) && pCreateInfo->pAttachments[i].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + DRAWSTATE_INVALID_RENDERPASS, "DS", + "Render pass has an attachment with stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD and initialLayout " + "== VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you intended. Consider using " + "VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the image truely is undefined at the start of the " + "render pass."); } } } @@ -2914,12 +2895,11 @@ bool ValidateLayouts(core_validation::layer_data *device_data, VkDevice device, (subpass.pColorAttachments[c].attachment == attach_index && subpass.pColorAttachments[c].layout != layout); } if (found_layout_mismatch) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_140006ae, "DS", - "CreateRenderPass: Subpass %u pInputAttachments[%u] (%u) has layout %u, but is also used as a depth/color " - "attachment with a different layout. %s", - i, j, attach_index, layout, validation_error_map[VALIDATION_ERROR_140006ae]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_140006ae, "DS", + "CreateRenderPass: Subpass %u pInputAttachments[%u] (%u) has layout %u, but is also used as a " + "depth/color attachment with a different layout. %s", + i, j, attach_index, layout, validation_error_map[VALIDATION_ERROR_140006ae]); } if (attach_first_use[attach_index]) { @@ -2980,34 +2960,34 @@ bool ValidateLayouts(core_validation::layer_data *device_data, VkDevice device, if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { switch (subpass.pDepthStencilAttachment->layout) { - case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: - case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL: - // These are ideal. - break; - - case VK_IMAGE_LAYOUT_GENERAL: - // May not be optimal; TODO: reconsider this warning based on other constraints? GENERAL can be better than - // doing a bunch of transitions. - skip |= log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", - "GENERAL layout for depth attachment may not give optimal performance."); - break; + case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: + case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL: + // These are ideal. + break; - case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR: - case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR: - if (GetDeviceExtensions(device_data)->vk_khr_maintenance2) { + case VK_IMAGE_LAYOUT_GENERAL: + // May not be optimal; TODO: reconsider this warning based on other constraints? GENERAL can be better than + // doing a bunch of transitions. + skip |= log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", + "GENERAL layout for depth attachment may not give optimal performance."); break; - } else { - // Intentionally fall through to generic error message - } - default: - // No other layouts are acceptable - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", - "Layout for depth attachment is %s but can only be DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " - "DEPTH_STENCIL_READ_ONLY_OPTIMAL or GENERAL.", - string_VkImageLayout(subpass.pDepthStencilAttachment->layout)); + case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR: + case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR: + if (GetDeviceExtensions(device_data)->vk_khr_maintenance2) { + break; + } else { + // Intentionally fall through to generic error message + } + + default: + // No other layouts are acceptable + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", + "Layout for depth attachment is %s but can only be DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " + "DEPTH_STENCIL_READ_ONLY_OPTIMAL or GENERAL.", + string_VkImageLayout(subpass.pDepthStencilAttachment->layout)); } auto attach_index = subpass.pDepthStencilAttachment->attachment; @@ -3040,8 +3020,8 @@ bool ValidateMapImageLayouts(core_validation::layer_data *device_data, VkDevice skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, HandleToUint64(mem_info->mem), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS", - "Mapping an image with layout %s can result in undefined behavior if this memory is " - "used by the device. Only GENERAL or PREINITIALIZED should be used.", + "Mapping an image with layout %s can result in undefined behavior if this memory is used " + "by the device. Only GENERAL or PREINITIALIZED should be used.", string_VkImageLayout(layout)); } } @@ -3069,16 +3049,17 @@ static bool validate_usage_flags(layer_data *device_data, VkFlags actual, VkFlag if (!correct_usage) { if (msgCode == -1) { // TODO: Fix callers with msgCode == -1 to use correct validation checks. - skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[obj_type], obj_handle, __LINE__, - MEMTRACK_INVALID_USAGE_FLAG, "MEM", "Invalid usage flag for %s 0x%" PRIx64 - " used by %s. In this case, %s should have %s set during creation.", - type_str, obj_handle, func_name, type_str, usage_str); + skip = + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[obj_type], obj_handle, __LINE__, + MEMTRACK_INVALID_USAGE_FLAG, "MEM", + "Invalid usage flag for %s 0x%" PRIx64 " used by %s. In this case, %s should have %s set during creation.", + type_str, obj_handle, func_name, type_str, usage_str); } else { const char *valid_usage = (msgCode == -1) ? "" : validation_error_map[msgCode]; - skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[obj_type], obj_handle, __LINE__, - msgCode, "MEM", "Invalid usage flag for %s 0x%" PRIx64 - " used by %s. In this case, %s should have %s set during creation. %s", - type_str, obj_handle, func_name, type_str, usage_str, valid_usage); + skip = log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[obj_type], obj_handle, __LINE__, msgCode, "MEM", + "Invalid usage flag for %s 0x%" PRIx64 " used by %s. In this case, %s should have %s set during creation. %s", + type_str, obj_handle, func_name, type_str, usage_str, valid_usage); } } return skip; @@ -3115,21 +3096,19 @@ bool PreCallValidateCreateBuffer(layer_data *device_data, const VkBufferCreateIn } if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) && (!GetEnabledFeatures(device_data)->sparseResidencyBuffer)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_01400728, "DS", - "vkCreateBuffer(): the sparseResidencyBuffer device feature is disabled: Buffers cannot be created with the " - "VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT set. %s", - validation_error_map[VALIDATION_ERROR_01400728]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_01400728, "DS", + "vkCreateBuffer(): the sparseResidencyBuffer device feature is disabled: Buffers cannot be created with " + "the VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT set. %s", + validation_error_map[VALIDATION_ERROR_01400728]); } if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) && (!GetEnabledFeatures(device_data)->sparseResidencyAliased)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_0140072a, "DS", - "vkCreateBuffer(): the sparseResidencyAliased device feature is disabled: Buffers cannot be created with the " - "VK_BUFFER_CREATE_SPARSE_ALIASED_BIT set. %s", - validation_error_map[VALIDATION_ERROR_0140072a]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_0140072a, "DS", + "vkCreateBuffer(): the sparseResidencyAliased device feature is disabled: Buffers cannot be created with " + "the VK_BUFFER_CREATE_SPARSE_ALIASED_BIT set. %s", + validation_error_map[VALIDATION_ERROR_0140072a]); } return skip; } @@ -3180,9 +3159,8 @@ bool ValidateImageAspectMask(layer_data *device_data, VkImage image, VkFormat fo if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) == 0) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, HandleToUint64(image), __LINE__, VALIDATION_ERROR_0a400c01, "IMAGE", - "%s: Depth/stencil image formats must have " - "at least one of VK_IMAGE_ASPECT_DEPTH_BIT " - "and VK_IMAGE_ASPECT_STENCIL_BIT set. %s", + "%s: Depth/stencil image formats must have at least one of VK_IMAGE_ASPECT_DEPTH_BIT and " + "VK_IMAGE_ASPECT_STENCIL_BIT set. %s", func_name, validation_error_map[VALIDATION_ERROR_0a400c01]); } else if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) != aspect_mask) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, @@ -3365,7 +3343,7 @@ bool PreCallValidateCreateImageView(layer_data *device_data, const VkImageViewCr skip |= ValidateImageUsageFlags( device_data, image_state, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | - VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, false, -1, "vkCreateImageView()", "VK_IMAGE_USAGE_[SAMPLED|STORAGE|COLOR_ATTACHMENT|DEPTH_STENCIL_ATTACHMENT|INPUT_ATTACHMENT]_BIT"); // If this isn't a sparse image, it needs to have memory backing it at CreateImageView time @@ -3459,14 +3437,14 @@ bool PreCallValidateCreateImageView(layer_data *device_data, const VkImageViewCr validation_error_map[VALIDATION_ERROR_0ac007da]); } else if ((image_flags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT))) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_0ac007fa, "IMAGE", - "vkCreateImageView(): pCreateInfo->viewType %s is not compatible with image type %s when the " - "VK_IMAGE_CREATE_SPARSE_BINDING_BIT, VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, or " - "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT flags are enabled. %s", - string_VkImageViewType(view_type), string_VkImageType(image_type), - validation_error_map[VALIDATION_ERROR_0ac007fa]); + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_0ac007fa, "IMAGE", + "vkCreateImageView(): pCreateInfo->viewType %s is not compatible with image type %s " + "when the VK_IMAGE_CREATE_SPARSE_BINDING_BIT, VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, or " + "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT flags are enabled. %s", + string_VkImageViewType(view_type), string_VkImageType(image_type), + validation_error_map[VALIDATION_ERROR_0ac007fa]); } } else { skip |= @@ -3518,38 +3496,37 @@ bool PreCallValidateCreateImageView(layer_data *device_data, const VkImageViewCr skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, error_codes[0], "IMAGE", - "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the " - "%s flag set. %s", + "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the %s flag set. %s", string_VkFormat(view_format), string_VkImageTiling(image_tiling), validation_error_map[error_codes[0]]); } else if ((image_usage & VK_IMAGE_USAGE_SAMPLED_BIT) && !(tiling_features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, error_codes[1], "IMAGE", - "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the " - "%s and VK_IMAGE_USAGE_SAMPLED_BIT flags set. %s", + "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the %s and " + "VK_IMAGE_USAGE_SAMPLED_BIT flags set. %s", string_VkFormat(view_format), string_VkImageTiling(image_tiling), validation_error_map[error_codes[1]]); } else if ((image_usage & VK_IMAGE_USAGE_STORAGE_BIT) && !(tiling_features & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, error_codes[2], "IMAGE", - "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the " - "%s and VK_IMAGE_USAGE_STORAGE_BIT flags set. %s", + "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the %s and " + "VK_IMAGE_USAGE_STORAGE_BIT flags set. %s", string_VkFormat(view_format), string_VkImageTiling(image_tiling), validation_error_map[error_codes[2]]); } else if ((image_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) && !(tiling_features & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, error_codes[3], "IMAGE", - "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the " - "%s and VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT flags set. %s", + "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the %s and " + "VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT flags set. %s", string_VkFormat(view_format), string_VkImageTiling(image_tiling), validation_error_map[error_codes[3]]); } else if ((image_usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) && !(tiling_features & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, error_codes[4], "IMAGE", - "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the " - "%s and VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT flags set. %s", + "vkCreateImageView() pCreateInfo->format %s cannot be used with an image having the %s and " + "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT flags set. %s", string_VkFormat(view_format), string_VkImageTiling(image_tiling), validation_error_map[error_codes[4]]); } } @@ -3715,8 +3692,8 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t if ((pRegions[i].imageOffset.y != 0) || (pRegions[i].imageExtent.height != 1)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_0160018e, "IMAGE", - "%s(): pRegion[%d] imageOffset.y is %d and imageExtent.height is %d. For 1D images these " - "must be 0 and 1, respectively. %s", + "%s(): pRegion[%d] imageOffset.y is %d and imageExtent.height is %d. For 1D images these must be 0 " + "and 1, respectively. %s", function, i, pRegions[i].imageOffset.y, pRegions[i].imageExtent.height, validation_error_map[VALIDATION_ERROR_0160018e]); } @@ -3737,8 +3714,8 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t if ((0 != pRegions[i].imageSubresource.baseArrayLayer) || (1 != pRegions[i].imageSubresource.layerCount)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_016001aa, "IMAGE", - "%s(): pRegion[%d] imageSubresource.baseArrayLayer is %d and imageSubresource.layerCount is " - "%d. For 3D images these must be 0 and 1, respectively. %s", + "%s(): pRegion[%d] imageSubresource.baseArrayLayer is %d and imageSubresource.layerCount is %d. " + "For 3D images these must be 0 and 1, respectively. %s", function, i, pRegions[i].imageSubresource.baseArrayLayer, pRegions[i].imageSubresource.layerCount, validation_error_map[VALIDATION_ERROR_016001aa]); } @@ -3821,12 +3798,11 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t // BufferRowHeight must be a multiple of block height if (SafeModulo(pRegions[i].bufferImageHeight, block_size.height) != 0) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_01600198, "IMAGE", - "%s(): pRegion[%d] bufferImageHeight (%d) must be a multiple of the compressed image's texel " - "height (%d). %s.", - function, i, pRegions[i].bufferImageHeight, block_size.height, - validation_error_map[VALIDATION_ERROR_01600198]); + skip |= log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_01600198, "IMAGE", + "%s(): pRegion[%d] bufferImageHeight (%d) must be a multiple of the compressed image's texel height (%d). %s.", + function, i, pRegions[i].bufferImageHeight, block_size.height, validation_error_map[VALIDATION_ERROR_01600198]); } // image offsets must be multiples of block dimensions @@ -3844,13 +3820,12 @@ bool ValidateBufferImageCopyData(const debug_report_data *report_data, uint32_t // bufferOffset must be a multiple of block size (linear bytes) size_t block_size_in_bytes = FormatSize(image_state->createInfo.format); if (SafeModulo(pRegions[i].bufferOffset, block_size_in_bytes) != 0) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_0160019c, "IMAGE", - "%s(): pRegion[%d] bufferOffset (0x%" PRIxLEAST64 - ") must be a multiple of the compressed image's texel block " - "size (" PRINTF_SIZE_T_SPECIFIER "). %s.", - function, i, pRegions[i].bufferOffset, block_size_in_bytes, - validation_error_map[VALIDATION_ERROR_0160019c]); + skip |= log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_0160019c, "IMAGE", + "%s(): pRegion[%d] bufferOffset (0x%" PRIxLEAST64 + ") must be a multiple of the compressed image's texel block size (" PRINTF_SIZE_T_SPECIFIER "). %s.", + function, i, pRegions[i].bufferOffset, block_size_in_bytes, validation_error_map[VALIDATION_ERROR_0160019c]); } // imageExtent width must be a multiple of block width, or extent+offset width must equal subresource width diff --git a/layers/buffer_validation.h b/layers/buffer_validation.h index b8a3a2ff4..9c7fa2afb 100644 --- a/layers/buffer_validation.h +++ b/layers/buffer_validation.h @@ -97,8 +97,7 @@ void SetLayout(layer_data *device_data, GLOBAL_CB_NODE *pCB, ImageSubresourcePai void SetLayout(std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> &imageLayoutMap, ImageSubresourcePair imgpair, VkImageLayout layout); -void SetImageViewLayout(layer_data *device_data, GLOBAL_CB_NODE *pCB, VkImageView imageView, - const VkImageLayout &layout); +void SetImageViewLayout(layer_data *device_data, GLOBAL_CB_NODE *pCB, VkImageView imageView, const VkImageLayout &layout); bool VerifyFramebufferAndRenderPassLayouts(layer_data *dev_data, GLOBAL_CB_NODE *pCB, const VkRenderPassBeginInfo *pRenderPassBegin, const FRAMEBUFFER_STATE *framebuffer_state); diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 69449b1f9..475accf3e 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -91,13 +91,13 @@ using unique_lock_t = std::unique_lock<mutex_t>; namespace core_validation { +using std::max; +using std::string; +using std::stringstream; +using std::unique_ptr; using std::unordered_map; using std::unordered_set; -using std::unique_ptr; using std::vector; -using std::string; -using std::stringstream; -using std::max; // WSI Image Objects bypass usual Image Object creation methods. A special Memory // Object value will be used to identify them internally. @@ -182,11 +182,14 @@ static unordered_map<void *, instance_layer_data *> instance_layer_data_map; static uint32_t loader_layer_if_version = CURRENT_LOADER_LAYER_INTERFACE_VERSION; static const VkLayerProperties global_layer = { - "VK_LAYER_LUNARG_core_validation", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer", + "VK_LAYER_LUNARG_core_validation", + VK_LAYER_API_VERSION, + 1, + "LunarG Validation Layer", }; static const VkExtensionProperties device_extensions[] = { - { VK_EXT_VALIDATION_CACHE_EXTENSION_NAME, VK_EXT_VALIDATION_CACHE_SPEC_VERSION }, + {VK_EXT_VALIDATION_CACHE_EXTENSION_NAME, VK_EXT_VALIDATION_CACHE_SPEC_VERSION}, }; template <class TCreateInfo> @@ -319,9 +322,7 @@ SURFACE_STATE *GetSurfaceState(instance_layer_data *instance_data, VkSurfaceKHR return &it->second; } -DeviceExtensions const *GetEnabledExtensions(layer_data const *dev_data) { - return &dev_data->extensions; -} +DeviceExtensions const *GetEnabledExtensions(layer_data const *dev_data) { return &dev_data->extensions; } // Return ptr to memory binding for given handle of specified type static BINDABLE *GetObjectMemBinding(layer_data *dev_data, uint64_t handle, VulkanObjectType type) { @@ -540,15 +541,16 @@ bool VerifyBoundMemoryIsValid(const layer_data *dev_data, VkDeviceMemory mem, ui bool result = false; if (VK_NULL_HANDLE == mem) { result = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, handle, - __LINE__, error_code, "MEM", "%s: Vk%s object 0x%" PRIx64 - " used with no memory bound. Memory should be bound by calling " - "vkBind%sMemory(). %s", + __LINE__, error_code, "MEM", + "%s: Vk%s object 0x%" PRIx64 + " used with no memory bound. Memory should be bound by calling vkBind%sMemory(). %s", api_name, type_name, handle, type_name, validation_error_map[error_code]); } else if (MEMORY_UNBOUND == mem) { result = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, handle, - __LINE__, error_code, "MEM", "%s: Vk%s object 0x%" PRIx64 - " used with no memory bound and previously bound memory was freed. " - "Memory must not be freed prior to this operation. %s", + __LINE__, error_code, "MEM", + "%s: Vk%s object 0x%" PRIx64 + " used with no memory bound and previously bound memory was freed. Memory must not be freed prior to this " + "operation. %s", api_name, type_name, handle, validation_error_map[error_code]); } return result; @@ -857,9 +859,8 @@ static bool validateAttachmentCompatibility(layer_data const *dev_data, const ch secondary_attach, "They have different samples.", caller, error_code); } if (primaryPassCI.pAttachments[primary_attach].flags != secondaryPassCI.pAttachments[secondary_attach].flags) { - skip |= - logInvalidAttachmentMessage(dev_data, type1_string, rp1_state, type2_string, rp2_state, primary_attach, secondary_attach, - "They have different flags.", caller, error_code); + skip |= logInvalidAttachmentMessage(dev_data, type1_string, rp1_state, type2_string, rp2_state, primary_attach, + secondary_attach, "They have different flags.", caller, error_code); } return skip; @@ -986,9 +987,9 @@ static bool ValidatePipelineDrawtimeState(layer_data const *dev_data, LAST_BOUND log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS", "The Pipeline State Object (0x%" PRIx64 - ") expects that this Command Buffer's vertex binding Index %u " - "should be set via vkCmdBindVertexBuffers. This is because VkVertexInputBindingDescription struct " - "at index " PRINTF_SIZE_T_SPECIFIER " of pVertexBindingDescriptions has a binding value of %u.", + ") expects that this Command Buffer's vertex binding Index %u should be set via " + "vkCmdBindVertexBuffers. This is because VkVertexInputBindingDescription struct at " + "index " PRINTF_SIZE_T_SPECIFIER " of pVertexBindingDescriptions has a binding value of %u.", HandleToUint64(state.pipeline_state->pipeline), vertex_binding, i, vertex_binding); } } @@ -1245,7 +1246,8 @@ static void UpdateDrawState(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, cons } } -static bool ValidatePipelineLocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, int pipelineIndex) { +static bool ValidatePipelineLocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, + int pipelineIndex) { bool skip = false; PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex].get(); @@ -1286,7 +1288,8 @@ static bool ValidatePipelineLocked(layer_data *dev_data, std::vector<std::unique } // UNLOCKED pipeline validation. DO NOT lookup objects in the layer_data->* maps in this function. -static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, int pipelineIndex) { +static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, + int pipelineIndex) { bool skip = false; PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex].get(); @@ -1298,8 +1301,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq if (pPipeline->graphicsPipelineCI.subpass >= pPipeline->rp_state->createInfo.subpassCount) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_096005ee, "DS", - "Invalid Pipeline CreateInfo State: Subpass index %u " - "is out of range for this renderpass (0..%u). %s", + "Invalid Pipeline CreateInfo State: Subpass index %u is out of range for this renderpass (0..%u). %s", pPipeline->graphicsPipelineCI.subpass, pPipeline->rp_state->createInfo.subpassCount - 1, validation_error_map[VALIDATION_ERROR_096005ee]); subpass_desc = nullptr; @@ -1329,8 +1331,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_0f4004ba, "DS", - "Invalid Pipeline CreateInfo: If independent blend feature not " - "enabled, all elements of pAttachments must be identical. %s", + "Invalid Pipeline CreateInfo: If independent blend feature not enabled, all elements of " + "pAttachments must be identical. %s", validation_error_map[VALIDATION_ERROR_0f4004ba]); break; } @@ -1396,9 +1398,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq pPipeline->graphicsPipelineCI.pInputAssemblyState->topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_096005c0, "DS", - "Invalid Pipeline CreateInfo State: " - "VK_PRIMITIVE_TOPOLOGY_PATCH_LIST must be set as IA " - "topology for tessellation pipelines. %s", + "Invalid Pipeline CreateInfo State: VK_PRIMITIVE_TOPOLOGY_PATCH_LIST must be set as IA topology for " + "tessellation pipelines. %s", validation_error_map[VALIDATION_ERROR_096005c0]); } if (pPipeline->graphicsPipelineCI.pInputAssemblyState && @@ -1406,9 +1407,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq if (!has_control || !has_eval) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_096005c2, "DS", - "Invalid Pipeline CreateInfo State: " - "VK_PRIMITIVE_TOPOLOGY_PATCH_LIST primitive " - "topology is only valid for tessellation pipelines. %s", + "Invalid Pipeline CreateInfo State: VK_PRIMITIVE_TOPOLOGY_PATCH_LIST primitive topology is only valid " + "for tessellation pipelines. %s", validation_error_map[VALIDATION_ERROR_096005c2]); } } @@ -1419,8 +1419,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq (!dev_data->enabled_features.depthClamp)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_1020061c, "DS", - "vkCreateGraphicsPipelines(): the depthClamp device feature is disabled: the depthClampEnable " - "member of the VkPipelineRasterizationStateCreateInfo structure must be set to VK_FALSE. %s", + "vkCreateGraphicsPipelines(): the depthClamp device feature is disabled: the depthClampEnable member " + "of the VkPipelineRasterizationStateCreateInfo structure must be set to VK_FALSE. %s", validation_error_map[VALIDATION_ERROR_1020061c]); } @@ -1429,8 +1429,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq (!dev_data->enabled_features.depthBiasClamp)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS", - "vkCreateGraphicsPipelines(): the depthBiasClamp device feature is disabled: the depthBiasClamp " - "member of the VkPipelineRasterizationStateCreateInfo structure must be set to 0.0 unless the " + "vkCreateGraphicsPipelines(): the depthBiasClamp device feature is disabled: the depthBiasClamp member " + "of the VkPipelineRasterizationStateCreateInfo structure must be set to 0.0 unless the " "VK_DYNAMIC_STATE_DEPTH_BIAS dynamic state is enabled"); } @@ -1451,18 +1451,18 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq if (!pPipeline->graphicsPipelineCI.pDepthStencilState) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_096005e0, "DS", - "Invalid Pipeline CreateInfo State: pDepthStencilState is NULL when rasterization is " - "enabled and subpass uses a depth/stencil attachment. %s", + "Invalid Pipeline CreateInfo State: pDepthStencilState is NULL when rasterization is enabled " + "and subpass uses a depth/stencil attachment. %s", validation_error_map[VALIDATION_ERROR_096005e0]); } else if ((pPipeline->graphicsPipelineCI.pDepthStencilState->depthBoundsTestEnable == VK_TRUE) && (!dev_data->enabled_features.depthBounds)) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, - HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_0f6004ac, "DS", - "vkCreateGraphicsPipelines(): the depthBounds device feature is disabled: the depthBoundsTestEnable " - "member of the VkPipelineDepthStencilStateCreateInfo structure must be set to VK_FALSE. %s", - validation_error_map[VALIDATION_ERROR_0f6004ac]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, + HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_0f6004ac, "DS", + "vkCreateGraphicsPipelines(): the depthBounds device feature is disabled: the " + "depthBoundsTestEnable member of the VkPipelineDepthStencilStateCreateInfo structure must be " + "set to VK_FALSE. %s", + validation_error_map[VALIDATION_ERROR_0f6004ac]); } } @@ -1477,8 +1477,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq if (color_attachment_count > 0 && pPipeline->graphicsPipelineCI.pColorBlendState == nullptr) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_096005e2, "DS", - "Invalid Pipeline CreateInfo State: pColorBlendState is NULL when rasterization is " - "enabled and subpass uses color attachments. %s", + "Invalid Pipeline CreateInfo State: pColorBlendState is NULL when rasterization is enabled and " + "subpass uses color attachments. %s", validation_error_map[VALIDATION_ERROR_096005e2]); } } @@ -1491,14 +1491,15 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq VkFormat format = vi->pVertexAttributeDescriptions[j].format; // Internal call to get format info. Still goes through layers, could potentially go directly to ICD. VkFormatProperties properties; - dev_data->instance_data->dispatch_table.GetPhysicalDeviceFormatProperties(dev_data->physical_device, format, &properties); + dev_data->instance_data->dispatch_table.GetPhysicalDeviceFormatProperties(dev_data->physical_device, format, + &properties); if ((properties.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) == 0) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_14a004de, "IMAGE", - "vkCreateGraphicsPipelines: pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].format " - "(%s) is not a supported vertex buffer format. %s", - pipelineIndex, j, string_VkFormat(format), validation_error_map[VALIDATION_ERROR_14a004de]); + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_14a004de, "IMAGE", + "vkCreateGraphicsPipelines: pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].format " + "(%s) is not a supported vertex buffer format. %s", + pipelineIndex, j, string_VkFormat(format), validation_error_map[VALIDATION_ERROR_14a004de]); } } } @@ -1507,21 +1508,25 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq VkSampleCountFlagBits max_sample_count = static_cast<VkSampleCountFlagBits>(0); for (uint32_t i = 0; i < subpass_desc->colorAttachmentCount; ++i) { if (subpass_desc->pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) { - max_sample_count = std::max(max_sample_count, pPipeline->rp_state->createInfo.pAttachments[subpass_desc->pColorAttachments[i].attachment].samples); + max_sample_count = + std::max(max_sample_count, + pPipeline->rp_state->createInfo.pAttachments[subpass_desc->pColorAttachments[i].attachment].samples); } } if (subpass_desc->pDepthStencilAttachment && subpass_desc->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { - max_sample_count = std::max(max_sample_count, pPipeline->rp_state->createInfo.pAttachments[subpass_desc->pDepthStencilAttachment->attachment].samples); + max_sample_count = + std::max(max_sample_count, + pPipeline->rp_state->createInfo.pAttachments[subpass_desc->pDepthStencilAttachment->attachment].samples); } if (pPipeline->graphicsPipelineCI.pMultisampleState->rasterizationSamples != max_sample_count) { - skip |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, - HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_09600bc2, "DS", - "vkCreateGraphicsPipelines: pCreateInfo[%d].pMultisampleState->rasterizationSamples (%s) != max attachment samples (%s) " - "used in subpass %u. %s", - pipelineIndex, string_VkSampleCountFlagBits(pPipeline->graphicsPipelineCI.pMultisampleState->rasterizationSamples), - string_VkSampleCountFlagBits(max_sample_count), pPipeline->graphicsPipelineCI.subpass, - validation_error_map[VALIDATION_ERROR_09600bc2]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, + HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_09600bc2, "DS", + "vkCreateGraphicsPipelines: pCreateInfo[%d].pMultisampleState->rasterizationSamples (%s) != max " + "attachment samples (%s) used in subpass %u. %s", + pipelineIndex, + string_VkSampleCountFlagBits(pPipeline->graphicsPipelineCI.pMultisampleState->rasterizationSamples), + string_VkSampleCountFlagBits(max_sample_count), pPipeline->graphicsPipelineCI.subpass, + validation_error_map[VALIDATION_ERROR_09600bc2]); } } @@ -1649,11 +1654,9 @@ bool ValidateCmdQueueFlags(layer_data *dev_data, const GLOBAL_CB_NODE *cb_node, return false; } -static char const * GetCauseStr(VK_OBJECT obj) { - if (obj.type == kVulkanObjectTypeDescriptorSet) - return "destroyed or updated"; - if (obj.type == kVulkanObjectTypeCommandBuffer) - return "destroyed or rerecorded"; +static char const *GetCauseStr(VK_OBJECT obj) { + if (obj.type == kVulkanObjectTypeDescriptorSet) return "destroyed or updated"; + if (obj.type == kVulkanObjectTypeCommandBuffer) return "destroyed or rerecorded"; return "destroyed"; } @@ -1671,7 +1674,7 @@ static bool ReportInvalidCommandBuffer(layer_data *dev_data, const GLOBAL_CB_NOD } // 'commandBuffer must be in the recording state' valid usage error code for each command -// Note: grepping for ^^^^^^^^^ in vk_validation_databate is easily massaged into the following list +// Note: grepping for ^^^^^^^^^ in vk_validation_database is easily massaged into the following list // Note: C++11 doesn't automatically devolve enum types to the underlying type for hash traits purposes (fixed in C++14) using CmdTypeHashType = std::underlying_type<CMD_TYPE>::type; static const std::unordered_map<CmdTypeHashType, UNIQUE_VALIDATION_ERROR_CODE> must_be_recording_map = { @@ -1886,9 +1889,7 @@ static void ResetCommandBufferState(layer_data *dev_data, const VkCommandBuffer pCB->primaryCommandBuffer = VK_NULL_HANDLE; // If secondary, invalidate any primary command buffer that may call us. if (pCB->createInfo.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) { - invalidateCommandBuffers(dev_data, - pCB->linkedCommandBuffers, - {HandleToUint64(cb), kVulkanObjectTypeCommandBuffer}); + invalidateCommandBuffers(dev_data, pCB->linkedCommandBuffers, {HandleToUint64(cb), kVulkanObjectTypeCommandBuffer}); } // Remove reverse command buffer links. @@ -2119,17 +2120,15 @@ static bool ValidateDeviceQueueCreateInfos(instance_layer_data *instance_data, c if (!queue_family_has_props || requested_queue_count > pd_state->queue_family_properties[requested_queue_family].queueCount) { - skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(pd_state->phys_device), __LINE__, - VALIDATION_ERROR_06c002fc, "DL", - "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueCount (=%" PRIu32 - ") is not " - "less than or equal to available queue count for this " - "pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex} (=%" PRIu32 - ") obtained previously " - "from vkGetPhysicalDeviceQueueFamilyProperties%s (%s). %s", - i, requested_queue_count, i, requested_queue_family, conditional_ext_cmd, count_note.c_str(), - validation_error_map[VALIDATION_ERROR_06c002fc]); + skip |= log_msg( + instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + HandleToUint64(pd_state->phys_device), __LINE__, VALIDATION_ERROR_06c002fc, "DL", + "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueCount (=%" PRIu32 + ") is not less than or equal to available queue count for this pCreateInfo->pQueueCreateInfos[%" PRIu32 + "].queueFamilyIndex} (=%" PRIu32 + ") obtained previously from vkGetPhysicalDeviceQueueFamilyProperties%s (%s). %s", + i, requested_queue_count, i, requested_queue_family, conditional_ext_cmd, count_note.c_str(), + validation_error_map[VALIDATION_ERROR_06c002fc]); } } } @@ -2153,8 +2152,8 @@ static bool ValidateRequestedFeatures(instance_layer_data *instance_data, const if (requested[i] > actual[i]) { skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVLIMITS_INVALID_FEATURE_REQUESTED, "DL", - "While calling vkCreateDevice(), requesting feature '%s' in VkPhysicalDeviceFeatures struct, " - "which is not available on this device.", + "While calling vkCreateDevice(), requesting feature '%s' in VkPhysicalDeviceFeatures struct, which is " + "not available on this device.", GetPhysDevFeatureString(i)); errors++; } @@ -2164,8 +2163,8 @@ static bool ValidateRequestedFeatures(instance_layer_data *instance_data, const // TODO: Verify this against the spec. I believe this is an invalid use of the API and should return an error skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVLIMITS_INVALID_FEATURE_REQUESTED, "DL", - "You requested features that are unavailable on this device. You should first query feature " - "availability by calling vkGetPhysicalDeviceFeatures()."); + "You requested features that are unavailable on this device. You should first query feature availability " + "by calling vkGetPhysicalDeviceFeatures()."); } return skip; } @@ -2318,17 +2317,17 @@ static bool ValidateStageMaskGsTsEnables(layer_data *dev_data, VkPipelineStageFl if (!dev_data->enabled_features.geometryShader && (stageMask & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, geo_error_id, "DL", - "%s call includes a stageMask with VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT bit set when " - "device does not have geometryShader feature enabled. %s", + "%s call includes a stageMask with VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT bit set when device does not have " + "geometryShader feature enabled. %s", caller, validation_error_map[geo_error_id]); } if (!dev_data->enabled_features.tessellationShader && (stageMask & (VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT))) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, tess_error_id, "DL", - "%s call includes a stageMask with VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT " - "and/or VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT bit(s) set when device " - "does not have tessellationShader feature enabled. %s", + "%s call includes a stageMask with VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT and/or " + "VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT bit(s) set when device does not have " + "tessellationShader feature enabled. %s", caller, validation_error_map[tess_error_id]); } return skip; @@ -2375,10 +2374,10 @@ static bool VerifyQueueStateToSeq(layer_data *dev_data, QUEUE_STATE *initial_que bool skip = false; // sequence number we want to validate up to, per queue - std::unordered_map<QUEUE_STATE *, uint64_t> target_seqs { { initial_queue, initial_seq } }; + std::unordered_map<QUEUE_STATE *, uint64_t> target_seqs{{initial_queue, initial_seq}}; // sequence number we've completed validation for, per queue std::unordered_map<QUEUE_STATE *, uint64_t> done_seqs; - std::vector<QUEUE_STATE *> worklist { initial_queue }; + std::vector<QUEUE_STATE *> worklist{initial_queue}; while (worklist.size()) { auto queue = worklist.back(); @@ -2392,8 +2391,7 @@ static bool VerifyQueueStateToSeq(layer_data *dev_data, QUEUE_STATE *initial_que for (auto &wait : sub_it->waitSemaphores) { auto other_queue = GetQueueState(dev_data, wait.queue); - if (other_queue == queue) - continue; // semaphores /always/ point backwards, so no point here. + if (other_queue == queue) continue; // semaphores /always/ point backwards, so no point here. auto other_target_seq = std::max(target_seqs[other_queue], wait.seq); auto other_done_seq = std::max(done_seqs[other_queue], other_queue->seq); @@ -2559,8 +2557,8 @@ static bool validateCommandBufferState(layer_data *dev_data, GLOBAL_CB_NODE *cb_ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_COMMAND_BUFFER_SINGLE_SUBMIT_VIOLATION, "DS", "Commandbuffer 0x%" PRIx64 - " was begun w/ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT " - "set, but has been submitted 0x%" PRIxLEAST64 " times.", + " was begun w/ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT set, but has been submitted 0x%" PRIxLEAST64 + " times.", HandleToUint64(cb_state->commandBuffer), cb_state->submitCount + current_submit_count); } @@ -2625,11 +2623,12 @@ bool ValidImageBufferQueue(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, const } if (!found) { - skip = log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[object->type], object->handle, __LINE__, - DRAWSTATE_INVALID_QUEUE_FAMILY, "DS", "vkQueueSubmit: Command buffer 0x%" PRIx64 " contains %s 0x%" PRIx64 - " which was not created allowing concurrent access to this queue family %d.", - HandleToUint64(cb_node->commandBuffer), object_string[object->type], object->handle, queue_state->queueFamilyIndex); + skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[object->type], + object->handle, __LINE__, DRAWSTATE_INVALID_QUEUE_FAMILY, "DS", + "vkQueueSubmit: Command buffer 0x%" PRIx64 " contains %s 0x%" PRIx64 + " which was not created allowing concurrent access to this queue family %d.", + HandleToUint64(cb_node->commandBuffer), object_string[object->type], object->handle, + queue_state->queueFamilyIndex); } } return skip; @@ -2647,8 +2646,7 @@ static bool validateQueueFamilyIndices(layer_data *dev_data, GLOBAL_CB_NODE *pCB skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_31a00094, "DS", "vkQueueSubmit: Primary command buffer 0x%" PRIx64 - " created in queue family %d is being submitted on queue " - "0x%" PRIx64 " from queue family %d. %s", + " created in queue family %d is being submitted on queue 0x%" PRIx64 " from queue family %d. %s", HandleToUint64(pCB->commandBuffer), pPool->queueFamilyIndex, HandleToUint64(queue), queue_state->queueFamilyIndex, validation_error_map[VALIDATION_ERROR_31a00094]); } @@ -2692,8 +2690,8 @@ static bool validatePrimaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_NO log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, VALIDATION_ERROR_31a00092, "DS", "Commandbuffer 0x%" PRIx64 " was submitted with secondary buffer 0x%" PRIx64 - " but that buffer has subsequently been bound to " - "primary cmd buffer 0x%" PRIx64 " and it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set. %s", + " but that buffer has subsequently been bound to primary cmd buffer 0x%" PRIx64 + " and it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set. %s", HandleToUint64(pCB->commandBuffer), HandleToUint64(pSubCB->commandBuffer), HandleToUint64(pSubCB->primaryCommandBuffer), validation_error_map[VALIDATION_ERROR_31a00092]); } @@ -2752,8 +2750,8 @@ static void PostCallRecordQueueSubmit(layer_data *dev_data, VkQueue queue, uint3 log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, HandleToUint64(fence), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS", "vkQueueSubmit(): Signaling external fence 0x%" PRIx64 " on queue 0x%" PRIx64 - " will disable validation of preceding command buffer lifecycle states and the in-use status of " - "associated objects.", + " will disable validation of preceding command buffer lifecycle states and the in-use status of associated " + "objects.", HandleToUint64(fence), HandleToUint64(queue)); } } @@ -3127,8 +3125,8 @@ static void initializeAndTrackMemory(layer_data *dev_data, VkDeviceMemory mem, V size = mem_info->alloc_info.allocationSize - offset; } mem_info->shadow_pad_size = dev_data->phys_dev_properties.properties.limits.minMemoryMapAlignment; - assert(SafeModulo(mem_info->shadow_pad_size, - dev_data->phys_dev_properties.properties.limits.minMemoryMapAlignment) == 0); + assert(SafeModulo(mem_info->shadow_pad_size, dev_data->phys_dev_properties.properties.limits.minMemoryMapAlignment) == + 0); // Ensure start of mapped region reflects hardware alignment constraints uint64_t map_alignment = dev_data->phys_dev_properties.properties.limits.minMemoryMapAlignment; @@ -3143,7 +3141,7 @@ static void initializeAndTrackMemory(layer_data *dev_data, VkDeviceMemory mem, V ~(map_alignment - 1)) + start_offset; assert(SafeModulo(reinterpret_cast<uintptr_t>(mem_info->shadow_copy) + mem_info->shadow_pad_size - start_offset, - map_alignment) == 0); + map_alignment) == 0); memset(mem_info->shadow_copy, NoncoherentMemoryFillValue, static_cast<size_t>(2 * mem_info->shadow_pad_size + size)); *ppData = static_cast<char *>(mem_info->shadow_copy) + mem_info->shadow_pad_size; @@ -3160,12 +3158,11 @@ static inline bool verifyWaitFenceState(layer_data *dev_data, VkFence fence, con auto pFence = GetFenceNode(dev_data, fence); if (pFence && pFence->scope == kSyncScopeInternal) { if (pFence->state == FENCE_UNSIGNALED) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, - HandleToUint64(fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM", - "%s called for fence 0x%" PRIx64 - " which has not been submitted on a Queue or during " - "acquire next image.", - apiCall, HandleToUint64(fence)); + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, + HandleToUint64(fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM", + "%s called for fence 0x%" PRIx64 " which has not been submitted on a Queue or during acquire next image.", + apiCall, HandleToUint64(fence)); } } return skip; @@ -3581,13 +3578,13 @@ static bool rangesIntersect(layer_data const *dev_data, MEMORY_RANGE const *rang const char *r2_linear_str = range2->linear ? "linear" : "non-linear"; const char *r2_type_str = range2->image ? "image" : "buffer"; auto obj_type = range1->image ? VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT : VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT; - *skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, obj_type, range1->handle, 0, - MEMTRACK_INVALID_ALIASING, "MEM", "%s %s 0x%" PRIx64 " is aliased with %s %s 0x%" PRIx64 - " which may indicate a bug. For further info refer to the " - "Buffer-Image Granularity section of the Vulkan specification. " - "(https://www.khronos.org/registry/vulkan/specs/1.0-extensions/" - "xhtml/vkspec.html#resources-bufferimagegranularity)", - r1_linear_str, r1_type_str, range1->handle, r2_linear_str, r2_type_str, range2->handle); + *skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, obj_type, range1->handle, 0, MEMTRACK_INVALID_ALIASING, "MEM", + "%s %s 0x%" PRIx64 " is aliased with %s %s 0x%" PRIx64 + " which may indicate a bug. For further info refer to the Buffer-Image Granularity section of the Vulkan " + "specification. " + "(https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-bufferimagegranularity)", + r1_linear_str, r1_type_str, range1->handle, r2_linear_str, r2_type_str, range2->handle); } // Ranges intersect return true; @@ -3841,8 +3838,7 @@ static bool PreCallValidateBindBufferMemory(layer_data *dev_data, VkBuffer buffe skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, buffer_handle, __LINE__, VALIDATION_ERROR_17000818, "DS", "%s: memoryOffset is 0x%" PRIxLEAST64 - " but must be an integer multiple of the " - "VkMemoryRequirements::alignment value 0x%" PRIxLEAST64 + " but must be an integer multiple of the VkMemoryRequirements::alignment value 0x%" PRIxLEAST64 ", returned from a call to vkGetBufferMemoryRequirements with buffer. %s", api_name, memoryOffset, buffer_state->requirements.alignment, validation_error_map[VALIDATION_ERROR_17000818]); @@ -3854,8 +3850,7 @@ static bool PreCallValidateBindBufferMemory(layer_data *dev_data, VkBuffer buffe skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, buffer_handle, __LINE__, VALIDATION_ERROR_1700081a, "DS", "%s: memory size minus memoryOffset is 0x%" PRIxLEAST64 - " but must be at least as large as " - "VkMemoryRequirements::size value 0x%" PRIxLEAST64 + " but must be at least as large as VkMemoryRequirements::size value 0x%" PRIxLEAST64 ", returned from a call to vkGetBufferMemoryRequirements with buffer. %s", api_name, mem_info->alloc_info.allocationSize - memoryOffset, buffer_state->requirements.size, validation_error_map[VALIDATION_ERROR_1700081a]); @@ -3889,8 +3884,7 @@ static bool PreCallValidateBindBufferMemory(layer_data *dev_data, VkBuffer buffe skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, buffer_handle, __LINE__, msgCode[i], "DS", "%s: %s memoryOffset is 0x%" PRIxLEAST64 - " but must be a multiple of " - "device limit %s 0x%" PRIxLEAST64 ". %s", + " but must be a multiple of device limit %s 0x%" PRIxLEAST64 ". %s", api_name, memory_type[i], memoryOffset, offset_name[i], offset_requirement[i], validation_error_map[msgCode[i]]); } @@ -3976,7 +3970,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2KHR(VkDevice device, uint32_t bi static void PostCallRecordGetBufferMemoryRequirements(layer_data *dev_data, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) { - BUFFER_STATE* buffer_state; + BUFFER_STATE *buffer_state; { unique_lock_t lock(global_lock); buffer_state = GetBufferState(dev_data, buffer); @@ -4003,7 +3997,7 @@ VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements2KHR(VkDevice device, cons static void PostCallRecordGetImageMemoryRequirements(layer_data *dev_data, VkImage image, VkMemoryRequirements *pMemoryRequirements) { - IMAGE_STATE* image_state; + IMAGE_STATE *image_state; { unique_lock_t lock(global_lock); image_state = GetImageState(dev_data, image); @@ -4027,6 +4021,75 @@ VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements2KHR(VkDevice device, const PostCallRecordGetImageMemoryRequirements(dev_data, pInfo->image, &pMemoryRequirements->memoryRequirements); } +static void PostCallRecordGetImageSparseMemoryRequirements(IMAGE_STATE *image_state, uint32_t req_count, + VkSparseImageMemoryRequirements *reqs) { + image_state->get_sparse_reqs_called = true; + image_state->sparse_requirements.resize(req_count); + if (reqs) { + std::copy(reqs, reqs + req_count, image_state->sparse_requirements.begin()); + } + for (const auto &req : image_state->sparse_requirements) { + if (req.formatProperties.aspectMask & VK_IMAGE_ASPECT_METADATA_BIT) { + image_state->sparse_metadata_required = true; + } + } +} + +VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { + // TODO : Implement tracking here, just passthrough initially + layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); + dev_data->dispatch_table.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, + pSparseMemoryRequirements); + unique_lock_t lock(global_lock); + auto image_state = GetImageState(dev_data, image); + PostCallRecordGetImageSparseMemoryRequirements(image_state, *pSparseMemoryRequirementCount, pSparseMemoryRequirements); +} + +static void PostCallRecordGetImageSparseMemoryRequirements2KHR(IMAGE_STATE *image_state, uint32_t req_count, + VkSparseImageMemoryRequirements2KHR *reqs) { + std::vector<VkSparseImageMemoryRequirements> sparse_reqs(req_count); + // Migrate to old struct type for common handling with GetImageSparseMemoryRequirements() + for (uint32_t i = 0; i < req_count; ++i) { + assert(!reqs[i].pNext); // TODO: If an extension is ever added here we need to handle it + sparse_reqs[i] = reqs[i].memoryRequirements; + } + PostCallRecordGetImageSparseMemoryRequirements(image_state, req_count, sparse_reqs.data()); +} + +VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements2KHR(VkDevice device, + const VkImageSparseMemoryRequirementsInfo2KHR *pInfo, + uint32_t *pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2KHR *pSparseMemoryRequirements) { + // TODO : Implement tracking here, just passthrough initially + layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); + dev_data->dispatch_table.GetImageSparseMemoryRequirements2KHR(device, pInfo, pSparseMemoryRequirementCount, + pSparseMemoryRequirements); + unique_lock_t lock(global_lock); + auto image_state = GetImageState(dev_data, pInfo->image); + PostCallRecordGetImageSparseMemoryRequirements2KHR(image_state, *pSparseMemoryRequirementCount, pSparseMemoryRequirements); +} + +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkImageType type, VkSampleCountFlagBits samples, + VkImageUsageFlags usage, VkImageTiling tiling, + uint32_t *pPropertyCount, + VkSparseImageFormatProperties *pProperties) { + // TODO : Implement this intercept, track sparse image format properties and make sure they are obeyed. + instance_layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); + instance_data->dispatch_table.GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, + pPropertyCount, pProperties); +} + +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, + VkSparseImageFormatProperties2KHR *pProperties) { + // TODO : Implement this intercept, track sparse image format properties and make sure they are obeyed. + instance_layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); + instance_data->dispatch_table.GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, + pProperties); +} + VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); // Common data objects used pre & post call @@ -4281,8 +4344,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoo if (!dev_data->enabled_features.pipelineStatisticsQuery) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, __LINE__, VALIDATION_ERROR_11c0062e, "DS", - "Query pool with type VK_QUERY_TYPE_PIPELINE_STATISTICS created on a device " - "with VkDeviceCreateInfo.pEnabledFeatures.pipelineStatisticsQuery == VK_FALSE. %s", + "Query pool with type VK_QUERY_TYPE_PIPELINE_STATISTICS created on a device with " + "VkDeviceCreateInfo.pEnabledFeatures.pipelineStatisticsQuery == VK_FALSE. %s", validation_error_map[VALIDATION_ERROR_11c0062e]); } } @@ -4407,8 +4470,7 @@ void invalidateCommandBuffers(const layer_data *dev_data, std::unordered_set<GLO "Invalidating a command buffer that's currently being recorded: 0x%" PRIx64 ".", HandleToUint64(cb_node->commandBuffer)); cb_node->state = CB_INVALID_INCOMPLETE; - } - else if (cb_node->state == CB_RECORDED) { + } else if (cb_node->state == CB_RECORDED) { cb_node->state = CB_INVALID_COMPLETE; } cb_node->broken_bindings.push_back(obj); @@ -4577,13 +4639,9 @@ std::unordered_map<VkImageView, std::unique_ptr<IMAGE_VIEW_STATE>> *GetImageView return &device_data->imageViewMap; } -const PHYS_DEV_PROPERTIES_NODE *GetPhysDevProperties(const layer_data *device_data) { - return &device_data->phys_dev_properties; -} +const PHYS_DEV_PROPERTIES_NODE *GetPhysDevProperties(const layer_data *device_data) { return &device_data->phys_dev_properties; } -const VkPhysicalDeviceFeatures *GetEnabledFeatures(const layer_data *device_data) { - return &device_data->enabled_features; -} +const VkPhysicalDeviceFeatures *GetEnabledFeatures(const layer_data *device_data) { return &device_data->enabled_features; } const DeviceExtensions *GetDeviceExtensions(const layer_data *device_data) { return &device_data->extensions; } @@ -4899,33 +4957,33 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t // This is a pain just to adapt the log message to the caller, but better to sort it out only when there is a problem. if (0 == strcmp(caller_name, "vkCreatePipelineLayout()")) { if (offset >= maxPushConstantsSize) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_11a0024c, "DS", - "%s call has push constants index %u with offset %u that " - "exceeds this device's maxPushConstantSize of %u. %s", - caller_name, index, offset, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_11a0024c]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_11a0024c, "DS", + "%s call has push constants index %u with offset %u that exceeds this device's maxPushConstantSize of %u. %s", + caller_name, index, offset, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_11a0024c]); } if (size > maxPushConstantsSize - offset) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_11a00254, "DS", - "%s call has push constants index %u with offset %u and size %u that " - "exceeds this device's maxPushConstantSize of %u. %s", + "%s call has push constants index %u with offset %u and size %u that exceeds this device's " + "maxPushConstantSize of %u. %s", caller_name, index, offset, size, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_11a00254]); } } else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) { if (offset >= maxPushConstantsSize) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_1bc002e4, "DS", - "%s call has push constants index %u with offset %u that " - "exceeds this device's maxPushConstantSize of %u. %s", - caller_name, index, offset, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_1bc002e4]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_1bc002e4, "DS", + "%s call has push constants index %u with offset %u that exceeds this device's maxPushConstantSize of %u. %s", + caller_name, index, offset, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_1bc002e4]); } if (size > maxPushConstantsSize - offset) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_1bc002e6, "DS", - "%s call has push constants index %u with offset %u and size %u that " - "exceeds this device's maxPushConstantSize of %u. %s", + "%s call has push constants index %u with offset %u and size %u that exceeds this device's " + "maxPushConstantSize of %u. %s", caller_name, index, offset, size, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_1bc002e6]); } @@ -4940,31 +4998,27 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t if (size == 0) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_11a00250, "DS", - "%s call has push constants index %u with " - "size %u. Size must be greater than zero. %s", - caller_name, index, size, validation_error_map[VALIDATION_ERROR_11a00250]); + "%s call has push constants index %u with size %u. Size must be greater than zero. %s", caller_name, + index, size, validation_error_map[VALIDATION_ERROR_11a00250]); } if (size & 0x3) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_11a00252, "DS", - "%s call has push constants index %u with " - "size %u. Size must be a multiple of 4. %s", - caller_name, index, size, validation_error_map[VALIDATION_ERROR_11a00252]); + "%s call has push constants index %u with size %u. Size must be a multiple of 4. %s", caller_name, + index, size, validation_error_map[VALIDATION_ERROR_11a00252]); } } else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) { if (size == 0) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_1bc2c21b, "DS", - "%s call has push constants index %u with " - "size %u. Size must be greater than zero. %s", - caller_name, index, size, validation_error_map[VALIDATION_ERROR_1bc2c21b]); + "%s call has push constants index %u with size %u. Size must be greater than zero. %s", caller_name, + index, size, validation_error_map[VALIDATION_ERROR_1bc2c21b]); } if (size & 0x3) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_1bc002e2, "DS", - "%s call has push constants index %u with " - "size %u. Size must be a multiple of 4. %s", - caller_name, index, size, validation_error_map[VALIDATION_ERROR_1bc002e2]); + "%s call has push constants index %u with size %u. Size must be a multiple of 4. %s", caller_name, + index, size, validation_error_map[VALIDATION_ERROR_1bc002e2]); } } else { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, @@ -4976,15 +5030,13 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t if (0 == strcmp(caller_name, "vkCreatePipelineLayout()")) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_11a0024e, "DS", - "%s call has push constants index %u with " - "offset %u. Offset must be a multiple of 4. %s", - caller_name, index, offset, validation_error_map[VALIDATION_ERROR_11a0024e]); + "%s call has push constants index %u with offset %u. Offset must be a multiple of 4. %s", caller_name, + index, offset, validation_error_map[VALIDATION_ERROR_11a0024e]); } else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_1bc002e0, "DS", - "%s call has push constants with " - "offset %u. Offset must be a multiple of 4. %s", - caller_name, offset, validation_error_map[VALIDATION_ERROR_1bc002e0]); + "%s call has push constants with offset %u. Offset must be a multiple of 4. %s", caller_name, offset, + validation_error_map[VALIDATION_ERROR_1bc002e0]); } else { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DRAWSTATE_INTERNAL_ERROR, "DS", "%s caller not supported.", caller_name); @@ -5583,8 +5635,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_16e00062, "MEM", "Calling vkBeginCommandBuffer() on active command buffer %" PRIx64 - " before it has completed. " - "You must check command buffer fence before this call. %s", + " before it has completed. You must check command buffer fence before this call. %s", HandleToUint64(commandBuffer), validation_error_map[VALIDATION_ERROR_16e00062]); } clear_cmd_buf_and_mem_references(dev_data, cb_node); @@ -5620,9 +5671,8 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_16e00068, "DS", "vkBeginCommandBuffer(): Secondary Command Buffer (0x%" PRIx64 - ") must not have " - "VK_QUERY_CONTROL_PRECISE_BIT if occulusionQuery is disabled or the device does not " - "support precise occlusion queries. %s", + ") must not have VK_QUERY_CONTROL_PRECISE_BIT if occulusionQuery is disabled or the device " + "does not support precise occlusion queries. %s", HandleToUint64(commandBuffer), validation_error_map[VALIDATION_ERROR_16e00068]); } } @@ -5630,14 +5680,13 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, auto renderPass = GetRenderPassState(dev_data, pInfo->renderPass); if (renderPass) { if (pInfo->subpass >= renderPass->createInfo.subpassCount) { - skip |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, - VALIDATION_ERROR_0280006c, "DS", "vkBeginCommandBuffer(): Secondary Command Buffers (0x%" PRIx64 - ") must have a subpass index (%d) " - "that is less than the number of subpasses (%d). %s", - HandleToUint64(commandBuffer), pInfo->subpass, renderPass->createInfo.subpassCount, - validation_error_map[VALIDATION_ERROR_0280006c]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, + VALIDATION_ERROR_0280006c, "DS", + "vkBeginCommandBuffer(): Secondary Command Buffers (0x%" PRIx64 + ") must have a subpass index (%d) that is less than the number of subpasses (%d). %s", + HandleToUint64(commandBuffer), pInfo->subpass, renderPass->createInfo.subpassCount, + validation_error_map[VALIDATION_ERROR_0280006c]); } } } @@ -5841,8 +5890,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float if (pCB->static_status & CBSTATUS_LINE_WIDTH_SET) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1d600626, "DS", - "vkCmdSetLineWidth called but pipeline was created without VK_DYNAMIC_STATE_LINE_WIDTH " - "flag. %s", + "vkCmdSetLineWidth called but pipeline was created without VK_DYNAMIC_STATE_LINE_WIDTH flag. %s", validation_error_map[VALIDATION_ERROR_1d600626]); } if (!skip) { @@ -5871,8 +5919,8 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float if ((depthBiasClamp != 0.0) && (!dev_data->enabled_features.depthBiasClamp)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1cc0062c, "DS", - "vkCmdSetDepthBias(): the depthBiasClamp device feature is disabled: the depthBiasClamp " - "parameter must be set to 0.0. %s", + "vkCmdSetDepthBias(): the depthBiasClamp device feature is disabled: the depthBiasClamp parameter must " + "be set to 0.0. %s", validation_error_map[VALIDATION_ERROR_1cc0062c]); } if (!skip) { @@ -5939,10 +5987,11 @@ VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffe ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetStencilCompareMask()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1da02415); skip |= ValidateCmd(dev_data, pCB, CMD_SETSTENCILCOMPAREMASK, "vkCmdSetStencilCompareMask()"); if (pCB->static_status & CBSTATUS_STENCIL_READ_MASK_SET) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1da004b4, "DS", - "vkCmdSetStencilCompareMask(): pipeline was created without VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK flag. %s.", - validation_error_map[VALIDATION_ERROR_1da004b4]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1da004b4, "DS", + "vkCmdSetStencilCompareMask(): pipeline was created without VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK flag. %s.", + validation_error_map[VALIDATION_ERROR_1da004b4]); } if (!skip) { pCB->status |= CBSTATUS_STENCIL_READ_MASK_SET; @@ -5962,10 +6011,11 @@ VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetStencilWriteMask()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1de02415); skip |= ValidateCmd(dev_data, pCB, CMD_SETSTENCILWRITEMASK, "vkCmdSetStencilWriteMask()"); if (pCB->static_status & CBSTATUS_STENCIL_WRITE_MASK_SET) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1de004b6, "DS", - "vkCmdSetStencilWriteMask(): pipeline was created without VK_DYNAMIC_STATE_STENCIL_WRITE_MASK flag. %s.", - validation_error_map[VALIDATION_ERROR_1de004b6]); + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1de004b6, "DS", + "vkCmdSetStencilWriteMask(): pipeline was created without VK_DYNAMIC_STATE_STENCIL_WRITE_MASK flag. %s.", + validation_error_map[VALIDATION_ERROR_1de004b6]); } if (!skip) { pCB->status |= CBSTATUS_STENCIL_WRITE_MASK_SET; @@ -6088,8 +6138,8 @@ static bool PreCallValidateCmdBindDescriptorSets(layer_data *device_data, GLOBAL skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(pDescriptorSets[set_idx]), __LINE__, VALIDATION_ERROR_17c002cc, "DS", - "descriptorSet #%u being bound is not compatible with overlapping descriptorSetLayout " - "at index %u of pipelineLayout 0x%" PRIx64 " due to: %s. %s", + "descriptorSet #%u being bound is not compatible with overlapping descriptorSetLayout at index %u of " + "pipelineLayout 0x%" PRIx64 " due to: %s. %s", set_idx, set_idx + firstSet, HandleToUint64(layout), error_string.c_str(), validation_error_map[VALIDATION_ERROR_17c002cc]); } @@ -6103,8 +6153,8 @@ static bool PreCallValidateCmdBindDescriptorSets(layer_data *device_data, GLOBAL VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(pDescriptorSets[set_idx]), __LINE__, DRAWSTATE_INVALID_DYNAMIC_OFFSET_COUNT, "DS", "descriptorSet #%u (0x%" PRIx64 - ") requires %u dynamicOffsets, but only %u dynamicOffsets are left in pDynamicOffsets " - "array. There must be one dynamic offset for each dynamic descriptor being bound.", + ") requires %u dynamicOffsets, but only %u dynamicOffsets are left in pDynamicOffsets array. " + "There must be one dynamic offset for each dynamic descriptor being bound.", set_idx, HandleToUint64(pDescriptorSets[set_idx]), descriptor_set->GetDynamicDescriptorCount(), (dynamicOffsetCount - total_dynamic_descriptors)); } else { // Validate dynamic offsets and Dynamic Offset Minimums @@ -6155,8 +6205,8 @@ static bool PreCallValidateCmdBindDescriptorSets(layer_data *device_data, GLOBAL if (total_dynamic_descriptors != dynamicOffsetCount) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cb_state->commandBuffer), __LINE__, VALIDATION_ERROR_17c002ce, "DS", - "Attempting to bind %u descriptorSets with %u dynamic descriptors, but dynamicOffsetCount " - "is %u. It should exactly match the number of dynamic descriptors. %s", + "Attempting to bind %u descriptorSets with %u dynamic descriptors, but dynamicOffsetCount is %u. It should " + "exactly match the number of dynamic descriptors. %s", setCount, total_dynamic_descriptors, dynamicOffsetCount, validation_error_map[VALIDATION_ERROR_17c002ce]); } return skip; @@ -6181,7 +6231,6 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); } else { lock.unlock(); - } } @@ -6304,8 +6353,8 @@ VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkB assert(cb_node); assert(buffer_state); - skip |= ValidateBufferUsageFlags(dev_data, buffer_state, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, true, - VALIDATION_ERROR_17e00362, "vkCmdBindIndexBuffer()", "VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); + skip |= ValidateBufferUsageFlags(dev_data, buffer_state, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, true, VALIDATION_ERROR_17e00362, + "vkCmdBindIndexBuffer()", "VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); skip |= ValidateCmdQueueFlags(dev_data, cb_node, "vkCmdBindIndexBuffer()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_17e02415); skip |= ValidateCmd(dev_data, cb_node, CMD_BINDINDEXBUFFER, "vkCmdBindIndexBuffer()"); skip |= ValidateMemoryIsBoundToBuffer(dev_data, buffer_state, "vkCmdBindIndexBuffer()", VALIDATION_ERROR_17e00364); @@ -6314,12 +6363,10 @@ VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkB skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_17e00360, "DS", "vkCmdBindIndexBuffer() offset (0x%" PRIxLEAST64 ") does not fall on alignment (%s) boundary. %s", offset, - string_VkIndexType(indexType), - validation_error_map[VALIDATION_ERROR_17e00360]); + string_VkIndexType(indexType), validation_error_map[VALIDATION_ERROR_17e00360]); } - if (skip) - return; + if (skip) return; std::function<bool()> function = [=]() { return ValidateBufferMemoryIsValid(dev_data, buffer_state, "vkCmdBindIndexBuffer()"); @@ -6357,19 +6404,18 @@ VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, u for (uint32_t i = 0; i < bindingCount; ++i) { auto buffer_state = GetBufferState(dev_data, pBuffers[i]); assert(buffer_state); - skip |= ValidateBufferUsageFlags(dev_data, buffer_state, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, true, - VALIDATION_ERROR_182004e6, "vkCmdBindVertexBuffers()", "VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); + skip |= ValidateBufferUsageFlags(dev_data, buffer_state, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, true, VALIDATION_ERROR_182004e6, + "vkCmdBindVertexBuffers()", "VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); skip |= ValidateMemoryIsBoundToBuffer(dev_data, buffer_state, "vkCmdBindVertexBuffers()", VALIDATION_ERROR_182004e8); if (pOffsets[i] >= buffer_state->createInfo.size) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, HandleToUint64(buffer_state->buffer), __LINE__, VALIDATION_ERROR_182004e4, "DS", - "vkCmdBindVertexBuffers() offset (0x%" PRIxLEAST64 ") is beyond the end of the buffer. %s", - pOffsets[i], validation_error_map[VALIDATION_ERROR_182004e4]); + "vkCmdBindVertexBuffers() offset (0x%" PRIxLEAST64 ") is beyond the end of the buffer. %s", pOffsets[i], + validation_error_map[VALIDATION_ERROR_182004e4]); } } - if (skip) - return; + if (skip) return; for (uint32_t i = 0; i < bindingCount; ++i) { auto buffer_state = GetBufferState(dev_data, pBuffers[i]); @@ -6718,7 +6764,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, V auto dst_image_state = GetImageState(device_data, dstImage); if (cb_node && src_buffer_state && dst_image_state) { skip = PreCallValidateCmdCopyBufferToImage(device_data, dstImageLayout, cb_node, src_buffer_state, dst_image_state, - regionCount, pRegions, "vkCmdCopyBufferToImage()"); + regionCount, pRegions, "vkCmdCopyBufferToImage()"); } else { lock.unlock(); assert(0); @@ -6743,7 +6789,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, V auto dst_buffer_state = GetBufferState(device_data, dstBuffer); if (cb_node && src_image_state && dst_buffer_state) { skip = PreCallValidateCmdCopyImageToBuffer(device_data, srcImageLayout, cb_node, src_image_state, dst_buffer_state, - regionCount, pRegions, "vkCmdCopyImageToBuffer()"); + regionCount, pRegions, "vkCmdCopyImageToBuffer()"); } else { lock.unlock(); assert(0); @@ -6926,7 +6972,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent ev if (!pCB->waitedEvents.count(event)) { pCB->writeEventsBeforeWait.push_back(event); } - pCB->eventUpdates.emplace_back([=](VkQueue q){return setEventStageMask(q, commandBuffer, event, stageMask);}); + pCB->eventUpdates.emplace_back([=](VkQueue q) { return setEventStageMask(q, commandBuffer, event, stageMask); }); } lock.unlock(); if (!skip) dev_data->dispatch_table.CmdSetEvent(commandBuffer, event, stageMask); @@ -6954,7 +7000,8 @@ VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent pCB->writeEventsBeforeWait.push_back(event); } // TODO : Add check for VALIDATION_ERROR_32c008f8 - pCB->eventUpdates.emplace_back([=](VkQueue q){return setEventStageMask(q, commandBuffer, event, VkPipelineStageFlags(0));}); + pCB->eventUpdates.emplace_back( + [=](VkQueue q) { return setEventStageMask(q, commandBuffer, event, VkPipelineStageFlags(0)); }); } lock.unlock(); if (!skip) dev_data->dispatch_table.CmdResetEvent(commandBuffer, event, stageMask); @@ -7030,13 +7077,13 @@ static bool ValidateImageBarrierImage(layer_data *device_data, const char *funcN funcName, img_index, HandleToUint64(img_bar_image), fb_handle, validation_error_map[VALIDATION_ERROR_1b800936]); } if (img_barrier.oldLayout != img_barrier.newLayout) { - skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(cb_state->commandBuffer), __LINE__, VALIDATION_ERROR_1b80093a, "CORE", - "%s: As the Image Barrier for image 0x%" PRIx64 - " is being executed within a render pass instance, oldLayout must equal newLayout yet they are " - "%s and %s. %s", - funcName, HandleToUint64(img_barrier.image), string_VkImageLayout(img_barrier.oldLayout), - string_VkImageLayout(img_barrier.newLayout), validation_error_map[VALIDATION_ERROR_1b80093a]); + skip |= + log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(cb_state->commandBuffer), __LINE__, VALIDATION_ERROR_1b80093a, "CORE", + "%s: As the Image Barrier for image 0x%" PRIx64 + " is being executed within a render pass instance, oldLayout must equal newLayout yet they are %s and %s. %s", + funcName, HandleToUint64(img_barrier.image), string_VkImageLayout(img_barrier.oldLayout), + string_VkImageLayout(img_barrier.newLayout), validation_error_map[VALIDATION_ERROR_1b80093a]); } else { if (sub_image_found && sub_image_layout != img_barrier.oldLayout) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, @@ -7065,8 +7112,7 @@ static bool ValidateRenderPassImageBarriers(layer_data *device_data, const char skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b80092e, "CORE", "%s: Barrier pImageMemoryBarriers[%d].srcAccessMask(0x%X) is not a subset of VkSubpassDependency " - "srcAccessMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "srcAccessMask(0x%X) of subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, i, img_src_access_mask, sub_src_access_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b80092e]); } @@ -7075,8 +7121,7 @@ static bool ValidateRenderPassImageBarriers(layer_data *device_data, const char skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b800930, "CORE", "%s: Barrier pImageMemoryBarriers[%d].dstAccessMask(0x%X) is not a subset of VkSubpassDependency " - "dstAccessMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "dstAccessMask(0x%X) of subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, i, img_dst_access_mask, sub_dst_access_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b800930]); } @@ -7134,8 +7179,8 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch (src_stage_mask != (sub_src_stage_mask & src_stage_mask))) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b80092a, "CORE", - "%s: Barrier srcStageMask(0x%X) is not a subset of VkSubpassDependency srcStageMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "%s: Barrier srcStageMask(0x%X) is not a subset of VkSubpassDependency srcStageMask(0x%X) of subpass " + "%d of renderPass 0x%" PRIx64 ". %s", funcName, src_stage_mask, sub_src_stage_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b80092a]); } @@ -7143,18 +7188,17 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch (dst_stage_mask != (sub_dst_stage_mask & dst_stage_mask))) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b80092c, "CORE", - "%s: Barrier dstStageMask(0x%X) is not a subset of VkSubpassDependency dstStageMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "%s: Barrier dstStageMask(0x%X) is not a subset of VkSubpassDependency dstStageMask(0x%X) of subpass " + "%d of renderPass 0x%" PRIx64 ". %s", funcName, dst_stage_mask, sub_dst_stage_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b80092c]); } if (0 != buffer_mem_barrier_count) { - skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, - rp_handle, __LINE__, VALIDATION_ERROR_1b800934, "CORE", - "%s: bufferMemoryBarrierCount is non-zero (%d) for " - "subpass %d of renderPass 0x%" PRIx64 ". %s", - funcName, buffer_mem_barrier_count, active_subpass, rp_handle, - validation_error_map[VALIDATION_ERROR_1b800934]); + skip |= + log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + rp_handle, __LINE__, VALIDATION_ERROR_1b800934, "CORE", + "%s: bufferMemoryBarrierCount is non-zero (%d) for subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, + buffer_mem_barrier_count, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b800934]); } const auto &sub_src_access_mask = sub_dep.srcAccessMask; const auto &sub_dst_access_mask = sub_dep.dstAccessMask; @@ -7164,8 +7208,7 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b80092e, "CORE", "%s: Barrier pMemoryBarriers[%d].srcAccessMask(0x%X) is not a subset of VkSubpassDependency " - "srcAccessMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "srcAccessMask(0x%X) of subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, i, mb_src_access_mask, sub_src_access_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b80092e]); } @@ -7174,8 +7217,7 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b800930, "CORE", "%s: Barrier pMemoryBarriers[%d].dstAccessMask(0x%X) is not a subset of VkSubpassDependency " - "dstAccessMask(0x%X) of " - "subpass %d of renderPass 0x%" PRIx64 ". %s", + "dstAccessMask(0x%X) of subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, i, mb_dst_access_mask, sub_dst_access_mask, active_subpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b800930]); } @@ -7185,8 +7227,7 @@ static bool ValidateRenderPassPipelineBarriers(layer_data *device_data, const ch if (sub_dep.dependencyFlags != dependency_flags) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, rp_handle, __LINE__, VALIDATION_ERROR_1b800932, "CORE", - "%s: dependencyFlags param (0x%X) does not equal VkSubpassDependency " - "dependencyFlags value (0x%X) for " + "%s: dependencyFlags param (0x%X) does not equal VkSubpassDependency dependencyFlags value (0x%X) for " "subpass %d of renderPass 0x%" PRIx64 ". %s", funcName, dependency_flags, sub_dep.dependencyFlags, cb_state->activeSubpass, rp_handle, validation_error_map[VALIDATION_ERROR_1b800932]); @@ -7350,8 +7391,7 @@ class ValidatorState { return log_msg(report_data_, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, cb_handle64_, location, val_code, "DS", "%s: Barrier using %s 0x%" PRIx64 - " created with sharingMode %s, " - "has srcQueueFamilyIndex %u%s and dstQueueFamilyIndex %u%s. %s %s", + " created with sharingMode %s, has srcQueueFamilyIndex %u%s and dstQueueFamilyIndex %u%s. %s %s", func_name_, GetTypeString(), barrier_handle64_, GetModeString(), src_family, src_annotation, dst_family, dst_annotation, vu_summary[vu_index], validation_error_map[val_code]); } @@ -7639,11 +7679,9 @@ bool validateEventStageMask(VkQueue queue, GLOBAL_CB_NODE *pCB, uint32_t eventCo if (sourceStageMask != stageMask && sourceStageMask != (stageMask | VK_PIPELINE_STAGE_HOST_BIT)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_1e62d401, "DS", - "Submitting cmdbuffer with call to VkCmdWaitEvents " - "using srcStageMask 0x%X which must be the bitwise " - "OR of the stageMask parameters used in calls to " - "vkCmdSetEvent and VK_PIPELINE_STAGE_HOST_BIT if " - "used with vkSetEvent but instead is 0x%X. %s", + "Submitting cmdbuffer with call to VkCmdWaitEvents using srcStageMask 0x%X which must be the bitwise OR of " + "the stageMask parameters used in calls to vkCmdSetEvent and VK_PIPELINE_STAGE_HOST_BIT if used with " + "vkSetEvent but instead is 0x%X. %s", sourceStageMask, stageMask, validation_error_map[VALIDATION_ERROR_1e62d401]); } return skip; @@ -7692,8 +7730,7 @@ bool CheckStageMaskQueueCompatibility(layer_data *dev_data, VkCommandBuffer comm skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(command_buffer), __LINE__, error_code, "DL", - "%s(): %s flag %s is not compatible with the queue family properties of this " - "command buffer. %s", + "%s(): %s flag %s is not compatible with the queue family properties of this command buffer. %s", function, src_or_dest, string_VkPipelineStageFlagBits(static_cast<VkPipelineStageFlagBits>(item)), validation_error_map[error_code]); } @@ -7757,15 +7794,15 @@ VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t for (uint32_t i = 0; i < eventCount; ++i) { auto event_state = GetEventNode(dev_data, pEvents[i]); if (event_state) { - addCommandBufferBinding(&event_state->cb_bindings, {HandleToUint64(pEvents[i]), kVulkanObjectTypeEvent}, cb_state); + addCommandBufferBinding(&event_state->cb_bindings, {HandleToUint64(pEvents[i]), kVulkanObjectTypeEvent}, + cb_state); event_state->cb_bindings.insert(cb_state); } cb_state->waitedEvents.insert(pEvents[i]); cb_state->events.push_back(pEvents[i]); } - cb_state->eventUpdates.emplace_back([=](VkQueue q){ - return validateEventStageMask(q, cb_state, eventCount, first_event_index, sourceStageMask); - }); + cb_state->eventUpdates.emplace_back( + [=](VkQueue q) { return validateEventStageMask(q, cb_state, eventCount, first_event_index, sourceStageMask); }); TransitionImageLayouts(dev_data, commandBuffer, imageMemoryBarrierCount, pImageMemoryBarriers); } } @@ -7831,9 +7868,9 @@ VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkP } lock.unlock(); if (!skip) { - device_data->dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, - pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, - imageMemoryBarrierCount, pImageMemoryBarriers); + device_data->dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, + memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, + pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); } } @@ -7902,7 +7939,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPoo lock.lock(); if (cb_state) { cb_state->activeQueries.erase(query); - cb_state->queryUpdates.emplace_back([=](VkQueue q){return setQueryState(q, commandBuffer, query, true);}); + cb_state->queryUpdates.emplace_back([=](VkQueue q) { return setQueryState(q, commandBuffer, query, true); }); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state); } @@ -7914,10 +7951,10 @@ VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQu layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); unique_lock_t lock(global_lock); GLOBAL_CB_NODE *cb_state = GetCBNode(dev_data, commandBuffer); - skip |= insideRenderPass(dev_data, cb_state, "vkCmdResetQueryPool()", VALIDATION_ERROR_1c600017); - skip |= ValidateCmd(dev_data, cb_state, CMD_RESETQUERYPOOL, "VkCmdResetQueryPool()"); - skip |= ValidateCmdQueueFlags(dev_data, cb_state, "VkCmdResetQueryPool()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, - VALIDATION_ERROR_1c602415); + skip |= insideRenderPass(dev_data, cb_state, "vkCmdResetQueryPool()", VALIDATION_ERROR_1c600017); + skip |= ValidateCmd(dev_data, cb_state, CMD_RESETQUERYPOOL, "VkCmdResetQueryPool()"); + skip |= ValidateCmdQueueFlags(dev_data, cb_state, "VkCmdResetQueryPool()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, + VALIDATION_ERROR_1c602415); lock.unlock(); if (skip) return; @@ -7928,7 +7965,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQu for (uint32_t i = 0; i < queryCount; i++) { QueryObject query = {queryPool, firstQuery + i}; cb_state->waitedEventsBeforeQueryReset[query] = cb_state->waitedEvents; - cb_state->queryUpdates.emplace_back([=](VkQueue q){return setQueryState(q, commandBuffer, query, false);}); + cb_state->queryUpdates.emplace_back([=](VkQueue q) { return setQueryState(q, commandBuffer, query, false); }); } addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state); @@ -7941,8 +7978,7 @@ static bool IsQueryInvalid(layer_data *dev_data, QUEUE_STATE *queue_data, VkQuer if (!query_data->second) return true; } else { auto it = dev_data->queryToStateMap.find(query); - if (it == dev_data->queryToStateMap.end() || !it->second) - return true; + if (it == dev_data->queryToStateMap.end() || !it->second) return true; } return false; @@ -7988,8 +8024,8 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer if (skip) return; - dev_data->dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, - stride, flags); + dev_data->dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, + flags); lock.lock(); if (cb_node && dst_buff_state) { @@ -7998,9 +8034,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer SetBufferMemoryValid(dev_data, dst_buff_state, true); return false; }); - cb_node->queryUpdates.emplace_back([=](VkQueue q) { - return validateQuery(q, cb_node, queryPool, firstQuery, queryCount); - }); + cb_node->queryUpdates.emplace_back([=](VkQueue q) { return validateQuery(q, cb_node, queryPool, firstQuery, queryCount); }); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_node); } @@ -8038,13 +8072,13 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip } } if (!found_matching_range) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1bc002de, "DS", - "vkCmdPushConstants() stageFlags = 0x%" PRIx32 - " do not match the stageFlags in any of the ranges with" - " offset = %d and size = %d in pipeline layout 0x%" PRIx64 ". %s", - (uint32_t)stageFlags, offset, size, HandleToUint64(layout), - validation_error_map[VALIDATION_ERROR_1bc002de]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1bc002de, "DS", + "vkCmdPushConstants() stageFlags = 0x%" PRIx32 + " do not match the stageFlags in any of the ranges with offset = %d and size = %d in pipeline layout 0x%" PRIx64 + ". %s", + (uint32_t)stageFlags, offset, size, HandleToUint64(layout), validation_error_map[VALIDATION_ERROR_1bc002de]); } } lock.unlock(); @@ -8071,7 +8105,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPi lock.lock(); if (cb_state) { QueryObject query = {queryPool, slot}; - cb_state->queryUpdates.emplace_back([=](VkQueue q) {return setQueryState(q, commandBuffer, query, true);}); + cb_state->queryUpdates.emplace_back([=](VkQueue q) { return setQueryState(q, commandBuffer, query, true); }); } } @@ -8121,13 +8155,12 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf if (rp_state) { const VkRenderPassCreateInfo *rpci = rp_state->createInfo.ptr(); if (rpci->attachmentCount != pCreateInfo->attachmentCount) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, - HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_094006d8, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachmentCount of %u does not match attachmentCount of %u of " - "renderPass (0x%" PRIx64 ") being used to create Framebuffer. %s", - pCreateInfo->attachmentCount, rpci->attachmentCount, HandleToUint64(pCreateInfo->renderPass), - validation_error_map[VALIDATION_ERROR_094006d8]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_094006d8, "DS", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachmentCount of %u does not match attachmentCount " + "of %u of renderPass (0x%" PRIx64 ") being used to create Framebuffer. %s", + pCreateInfo->attachmentCount, rpci->attachmentCount, HandleToUint64(pCreateInfo->renderPass), + validation_error_map[VALIDATION_ERROR_094006d8]); } else { // attachmentCounts match, so make sure corresponding attachment details line up const VkImageView *image_views = pCreateInfo->pAttachments; @@ -8135,22 +8168,21 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf auto view_state = GetImageViewState(dev_data, image_views[i]); auto &ivci = view_state->create_info; if (ivci.format != rpci->pAttachments[i].format) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, - HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_094006e0, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has format of %s that does not match " - "the format of " - "%s used by the corresponding attachment for renderPass (0x%" PRIx64 "). %s", - i, string_VkFormat(ivci.format), string_VkFormat(rpci->pAttachments[i].format), - HandleToUint64(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_094006e0]); + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_094006e0, "DS", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has format of %s that does not " + "match the format of %s used by the corresponding attachment for renderPass (0x%" PRIx64 "). %s", + i, string_VkFormat(ivci.format), string_VkFormat(rpci->pAttachments[i].format), + HandleToUint64(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_094006e0]); } const VkImageCreateInfo *ici = &GetImageState(dev_data, ivci.image)->createInfo; if (ici->samples != rpci->pAttachments[i].samples) { skip |= log_msg( dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_094006e2, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match " - "the %s samples used by the corresponding attachment for renderPass (0x%" PRIx64 "). %s", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match the %s " + "samples used by the corresponding attachment for renderPass (0x%" PRIx64 "). %s", i, string_VkSampleCountFlagBits(ici->samples), string_VkSampleCountFlagBits(rpci->pAttachments[i].samples), HandleToUint64(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_094006e2]); } @@ -8158,8 +8190,8 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf if (ivci.subresourceRange.levelCount != 1) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_094006e6, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has mip levelCount of %u " - "but only a single mip level (levelCount == 1) is allowed when creating a Framebuffer. %s", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has mip levelCount of %u but " + "only a single mip level (levelCount == 1) is allowed when creating a Framebuffer. %s", i, ivci.subresourceRange.levelCount, validation_error_map[VALIDATION_ERROR_094006e6]); } const uint32_t mip_level = ivci.subresourceRange.baseMipLevel; @@ -8167,35 +8199,35 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf uint32_t mip_height = max(1u, ici->extent.height >> mip_level); if ((ivci.subresourceRange.layerCount < pCreateInfo->layers) || (mip_width < pCreateInfo->width) || (mip_height < pCreateInfo->height)) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_094006e4, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u mip level %u has dimensions smaller " - "than the corresponding framebuffer dimensions. Here are the respective dimensions for attachment #%u, " - "framebuffer:\n" - "width: %u, %u\n" - "height: %u, %u\n" - "layerCount: %u, %u\n%s", - i, ivci.subresourceRange.baseMipLevel, i, mip_width, pCreateInfo->width, mip_height, pCreateInfo->height, - ivci.subresourceRange.layerCount, pCreateInfo->layers, validation_error_map[VALIDATION_ERROR_094006e4]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + 0, __LINE__, VALIDATION_ERROR_094006e4, "DS", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u mip level %u has dimensions " + "smaller than the corresponding framebuffer dimensions. Here are the respective dimensions for " + "attachment #%u, framebuffer:\n" + "width: %u, %u\n" + "height: %u, %u\n" + "layerCount: %u, %u\n%s", + i, ivci.subresourceRange.baseMipLevel, i, mip_width, pCreateInfo->width, mip_height, + pCreateInfo->height, ivci.subresourceRange.layerCount, pCreateInfo->layers, + validation_error_map[VALIDATION_ERROR_094006e4]); } if (((ivci.components.r != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci.components.r != VK_COMPONENT_SWIZZLE_R)) || ((ivci.components.g != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci.components.g != VK_COMPONENT_SWIZZLE_G)) || ((ivci.components.b != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci.components.b != VK_COMPONENT_SWIZZLE_B)) || ((ivci.components.a != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci.components.a != VK_COMPONENT_SWIZZLE_A))) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_094006e8, "DS", - "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has non-identy swizzle. All framebuffer " - "attachments must have been created with the identity swizzle. Here are the actual swizzle values:\n" - "r swizzle = %s\n" - "g swizzle = %s\n" - "b swizzle = %s\n" - "a swizzle = %s\n" - "%s", - i, string_VkComponentSwizzle(ivci.components.r), string_VkComponentSwizzle(ivci.components.g), - string_VkComponentSwizzle(ivci.components.b), string_VkComponentSwizzle(ivci.components.a), - validation_error_map[VALIDATION_ERROR_094006e8]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + 0, __LINE__, VALIDATION_ERROR_094006e8, "DS", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has non-identy swizzle. All " + "framebuffer attachments must have been created with the identity swizzle. Here are the actual " + "swizzle values:\n" + "r swizzle = %s\n" + "g swizzle = %s\n" + "b swizzle = %s\n" + "a swizzle = %s\n" + "%s", + i, string_VkComponentSwizzle(ivci.components.r), string_VkComponentSwizzle(ivci.components.g), + string_VkComponentSwizzle(ivci.components.b), string_VkComponentSwizzle(ivci.components.a), + validation_error_map[VALIDATION_ERROR_094006e8]); } } } @@ -8220,27 +8252,24 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf if (pCreateInfo->width > dev_data->phys_dev_properties.properties.limits.maxFramebufferWidth) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_094006ec, "DS", - "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo width exceeds physical device limits. " - "Requested width: %u, device max: %u\n" - "%s", + "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo width exceeds physical device limits. Requested " + "width: %u, device max: %u\n%s", pCreateInfo->width, dev_data->phys_dev_properties.properties.limits.maxFramebufferWidth, validation_error_map[VALIDATION_ERROR_094006ec]); } if (pCreateInfo->height > dev_data->phys_dev_properties.properties.limits.maxFramebufferHeight) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_094006f0, "DS", - "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo height exceeds physical device limits. " - "Requested height: %u, device max: %u\n" - "%s", + "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo height exceeds physical device limits. Requested " + "height: %u, device max: %u\n%s", pCreateInfo->height, dev_data->phys_dev_properties.properties.limits.maxFramebufferHeight, validation_error_map[VALIDATION_ERROR_094006f0]); } if (pCreateInfo->layers > dev_data->phys_dev_properties.properties.limits.maxFramebufferLayers) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_094006f4, "DS", - "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo layers exceeds physical device limits. " - "Requested layers: %u, device max: %u\n" - "%s", + "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo layers exceeds physical device limits. Requested " + "layers: %u, device max: %u\n%s", pCreateInfo->layers, dev_data->phys_dev_properties.properties.limits.maxFramebufferLayers, validation_error_map[VALIDATION_ERROR_094006f4]); } @@ -8457,15 +8486,13 @@ static bool ValidateDependencies(const layer_data *dev_data, FRAMEBUFFER_STATE c if (!(pCreateInfo->pAttachments[attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, HandleToUint64(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_12200682, "DS", - "Attachment %d aliases attachment %d but doesn't " - "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s", + "Attachment %d aliases attachment %d but doesn't set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s", attachment, other_attachment, validation_error_map[VALIDATION_ERROR_12200682]); } if (!(pCreateInfo->pAttachments[other_attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, HandleToUint64(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_12200682, "DS", - "Attachment %d aliases attachment %d but doesn't " - "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s", + "Attachment %d aliases attachment %d but doesn't set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s", other_attachment, attachment, validation_error_map[VALIDATION_ERROR_12200682]); } } @@ -8577,8 +8604,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShade layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); bool spirv_valid; - if (PreCallValidateCreateShaderModule(dev_data, pCreateInfo, &spirv_valid)) - return VK_ERROR_VALIDATION_FAILED_EXT; + if (PreCallValidateCreateShaderModule(dev_data, pCreateInfo, &spirv_valid)) return VK_ERROR_VALIDATION_FAILED_EXT; VkResult res = dev_data->dispatch_table.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); @@ -8659,8 +8685,8 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend pCreateInfo->pAttachments[attachment].samples != VK_SAMPLE_COUNT_1_BIT) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_140006a2, "DS", - "CreateRenderPass: Subpass %u requests multisample resolve into attachment %u, " - "which must have VK_SAMPLE_COUNT_1_BIT but has %s. %s", + "CreateRenderPass: Subpass %u requests multisample resolve into attachment %u, which must " + "have VK_SAMPLE_COUNT_1_BIT but has %s. %s", i, attachment, string_VkSampleCountFlagBits(pCreateInfo->pAttachments[attachment].samples), validation_error_map[VALIDATION_ERROR_140006a2]); } @@ -8669,8 +8695,8 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend subpass.pColorAttachments[j].attachment == VK_ATTACHMENT_UNUSED) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_1400069e, "DS", - "CreateRenderPass: Subpass %u requests multisample resolve from attachment %u " - "which has attachment=VK_ATTACHMENT_UNUSED. %s", + "CreateRenderPass: Subpass %u requests multisample resolve from attachment %u which has " + "attachment=VK_ATTACHMENT_UNUSED. %s", i, attachment, validation_error_map[VALIDATION_ERROR_1400069e]); } } @@ -8683,8 +8709,8 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend if (subpass_performs_resolve && pCreateInfo->pAttachments[attachment].samples == VK_SAMPLE_COUNT_1_BIT) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_140006a0, "DS", - "CreateRenderPass: Subpass %u requests multisample resolve from attachment %u " - "which has VK_SAMPLE_COUNT_1_BIT. %s", + "CreateRenderPass: Subpass %u requests multisample resolve from attachment %u which has " + "VK_SAMPLE_COUNT_1_BIT. %s", i, attachment, validation_error_map[VALIDATION_ERROR_140006a0]); } @@ -8696,22 +8722,23 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_140006a4, "DS", "CreateRenderPass: Subpass %u pColorAttachments[%u] resolves to an attachment with a " - "different format. " - "color format: %u, resolve format: %u. %s", + "different format. color format: %u, resolve format: %u. %s", i, j, color_desc.format, resolve_desc.format, validation_error_map[VALIDATION_ERROR_140006a4]); } } - if (dev_data->extensions.vk_amd_mixed_attachment_samples && - subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { - const auto depth_stencil_sample_count = pCreateInfo->pAttachments[subpass.pDepthStencilAttachment->attachment].samples; + if (dev_data->extensions.vk_amd_mixed_attachment_samples && subpass.pDepthStencilAttachment && + subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { + const auto depth_stencil_sample_count = + pCreateInfo->pAttachments[subpass.pDepthStencilAttachment->attachment].samples; if (pCreateInfo->pAttachments[attachment].samples > depth_stencil_sample_count) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_14000bc4, "DS", + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_14000bc4, "DS", "CreateRenderPass: Subpass %u pColorAttachments[%u] has %s which is larger than " "depth/stencil attachment %s. %s", i, j, string_VkSampleCountFlagBits(pCreateInfo->pAttachments[attachment].samples), - string_VkSampleCountFlagBits(depth_stencil_sample_count), validation_error_map[VALIDATION_ERROR_14000bc4]); + string_VkSampleCountFlagBits(depth_stencil_sample_count), + validation_error_map[VALIDATION_ERROR_14000bc4]); } } } @@ -8731,26 +8758,20 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend skip |= ValidateAttachmentIndex(dev_data, attachment, pCreateInfo->attachmentCount, "Input"); } - if (!dev_data->extensions.vk_amd_mixed_attachment_samples && - sample_count && !IsPowerOfTwo(sample_count)) { + if (!dev_data->extensions.vk_amd_mixed_attachment_samples && sample_count && !IsPowerOfTwo(sample_count)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_0082b401, "DS", - "CreateRenderPass: Subpass %u attempts to render to " - "attachments with inconsistent sample counts. %s", + "CreateRenderPass: Subpass %u attempts to render to attachments with inconsistent sample counts. %s", i, validation_error_map[VALIDATION_ERROR_0082b401]); } } return skip; } -static void MarkAttachmentFirstUse(RENDER_PASS_STATE *render_pass, - uint32_t index, - bool is_read) { - if (index == VK_ATTACHMENT_UNUSED) - return; +static void MarkAttachmentFirstUse(RENDER_PASS_STATE *render_pass, uint32_t index, bool is_read) { + if (index == VK_ATTACHMENT_UNUSED) return; - if (!render_pass->attachment_first_read.count(index)) - render_pass->attachment_first_read[index] = is_read; + if (!render_pass->attachment_first_read.count(index)) render_pass->attachment_first_read[index] = is_read; } VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, @@ -8838,9 +8859,8 @@ static bool VerifyRenderAreaBounds(const layer_data *dev_data, const VkRenderPas skip |= static_cast<bool>(log_msg( dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DRAWSTATE_INVALID_RENDER_AREA, "CORE", - "Cannot execute a render pass with renderArea not within the bound of the " - "framebuffer. RenderArea: x %d, y %d, width %d, height %d. Framebuffer: width %d, " - "height %d.", + "Cannot execute a render pass with renderArea not within the bound of the framebuffer. RenderArea: x %d, y %d, width " + "%d, height %d. Framebuffer: width %d, height %d.", pRenderPassBegin->renderArea.offset.x, pRenderPassBegin->renderArea.offset.y, pRenderPassBegin->renderArea.extent.width, pRenderPassBegin->renderArea.extent.height, pFramebufferInfo->width, pFramebufferInfo->height)); } @@ -8858,8 +8878,7 @@ static bool FormatSpecificLoadAndStoreOpSettings(VkFormat format, T color_depth_ bool check_color_depth_load_op = !FormatIsStencilOnly(format); bool check_stencil_load_op = FormatIsDepthAndStencil(format) || !check_color_depth_load_op; - return ((check_color_depth_load_op && (color_depth_op == op)) || - (check_stencil_load_op && (stencil_op == op))); + return ((check_color_depth_load_op && (color_depth_op == op)) || (check_stencil_load_op && (stencil_op == op))); } VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, @@ -8909,17 +8928,16 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, con } } if (clear_op_size > pRenderPassBegin->clearValueCount) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, - HandleToUint64(render_pass_state->renderPass), __LINE__, VALIDATION_ERROR_1200070c, "DS", - "In vkCmdBeginRenderPass() the VkRenderPassBeginInfo struct has a clearValueCount of %u but there must " - "be at least %u entries in pClearValues array to account for the highest index attachment in renderPass " - "0x%" PRIx64 - " that uses VK_ATTACHMENT_LOAD_OP_CLEAR is %u. Note that the pClearValues array " - "is indexed by attachment number so even if some pClearValues entries between 0 and %u correspond to " - "attachments that aren't cleared they will be ignored. %s", - pRenderPassBegin->clearValueCount, clear_op_size, HandleToUint64(render_pass_state->renderPass), clear_op_size, - clear_op_size - 1, validation_error_map[VALIDATION_ERROR_1200070c]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + HandleToUint64(render_pass_state->renderPass), __LINE__, VALIDATION_ERROR_1200070c, "DS", + "In vkCmdBeginRenderPass() the VkRenderPassBeginInfo struct has a clearValueCount of %u but there " + "must be at least %u entries in pClearValues array to account for the highest index attachment in " + "renderPass 0x%" PRIx64 + " that uses VK_ATTACHMENT_LOAD_OP_CLEAR is %u. Note that the pClearValues array is indexed by " + "attachment number so even if some pClearValues entries between 0 and %u correspond to attachments " + "that aren't cleared they will be ignored. %s", + pRenderPassBegin->clearValueCount, clear_op_size, HandleToUint64(render_pass_state->renderPass), + clear_op_size, clear_op_size - 1, validation_error_map[VALIDATION_ERROR_1200070c]); } skip |= VerifyRenderAreaBounds(dev_data, pRenderPassBegin); skip |= VerifyFramebufferAndRenderPassLayouts(dev_data, cb_node, pRenderPassBegin, @@ -9088,15 +9106,14 @@ static bool validateSecondaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_ pSubCB->beginInfo.pInheritanceInfo) { VkQueryPipelineStatisticFlags cmdBufStatistics = pSubCB->beginInfo.pInheritanceInfo->pipelineStatistics; if ((cmdBufStatistics & queryPoolData->second.createInfo.pipelineStatistics) != cmdBufStatistics) { - skip |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, - VALIDATION_ERROR_1b2000d0, "DS", "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%" PRIx64 - " which has invalid active query pool 0x%" PRIx64 - ". Pipeline statistics is being queried so the command " - "buffer must have all bits set on the queryPool. %s", - HandleToUint64(pCB->commandBuffer), HandleToUint64(queryPoolData->first), - validation_error_map[VALIDATION_ERROR_1b2000d0]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_1b2000d0, "DS", + "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%" PRIx64 + " which has invalid active query pool 0x%" PRIx64 + ". Pipeline statistics is being queried so the command buffer must have all bits set on the queryPool. %s", + HandleToUint64(pCB->commandBuffer), HandleToUint64(queryPoolData->first), + validation_error_map[VALIDATION_ERROR_1b2000d0]); } } activeTypes.insert(queryPoolData->second.createInfo.queryType); @@ -9109,8 +9126,7 @@ static bool validateSecondaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS", "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%" PRIx64 " which has invalid active query pool 0x%" PRIx64 - " of type %d but a query of that type has been started on " - "secondary Cmd Buffer 0x%" PRIx64 ".", + " of type %d but a query of that type has been started on secondary Cmd Buffer 0x%" PRIx64 ".", HandleToUint64(pCB->commandBuffer), HandleToUint64(queryPoolData->first), queryPoolData->second.createInfo.queryType, HandleToUint64(pSubCB->commandBuffer)); } @@ -9142,26 +9158,25 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin pSubCB = GetCBNode(dev_data, pCommandBuffers[i]); assert(pSubCB); if (VK_COMMAND_BUFFER_LEVEL_PRIMARY == pSubCB->createInfo.level) { - skip |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_1b2000b0, "DS", - "vkCmdExecuteCommands() called w/ Primary Cmd Buffer 0x%" PRIx64 - " in element %u of pCommandBuffers " - "array. All cmd buffers in pCommandBuffers array must be secondary. %s", - HandleToUint64(pCommandBuffers[i]), i, validation_error_map[VALIDATION_ERROR_1b2000b0]); + skip |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_1b2000b0, "DS", + "vkCmdExecuteCommands() called w/ Primary Cmd Buffer 0x%" PRIx64 + " in element %u of pCommandBuffers array. All cmd buffers in pCommandBuffers array must be secondary. %s", + HandleToUint64(pCommandBuffers[i]), i, validation_error_map[VALIDATION_ERROR_1b2000b0]); } else if (pCB->activeRenderPass) { // Secondary CB w/i RenderPass must have *CONTINUE_BIT set if (pSubCB->beginInfo.pInheritanceInfo != nullptr) { auto secondary_rp_state = GetRenderPassState(dev_data, pSubCB->beginInfo.pInheritanceInfo->renderPass); if (!(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)) { - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_1b2000c0, "DS", - "vkCmdExecuteCommands(): Secondary Command Buffer (0x%" PRIx64 - ") executed within render pass (0x%" PRIx64 - ") must have had vkBeginCommandBuffer() called w/ VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT " - "set. %s", - HandleToUint64(pCommandBuffers[i]), HandleToUint64(pCB->activeRenderPass->renderPass), - validation_error_map[VALIDATION_ERROR_1b2000c0]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCommandBuffers[i]), + __LINE__, VALIDATION_ERROR_1b2000c0, "DS", + "vkCmdExecuteCommands(): Secondary Command Buffer (0x%" PRIx64 + ") executed within render pass (0x%" PRIx64 + ") must have had vkBeginCommandBuffer() called w/ " + "VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT set. %s", + HandleToUint64(pCommandBuffers[i]), HandleToUint64(pCB->activeRenderPass->renderPass), + validation_error_map[VALIDATION_ERROR_1b2000c0]); } else { // Make sure render pass is compatible with parent command buffer pass if has continue if (pCB->activeRenderPass->renderPass != secondary_rp_state->renderPass) { @@ -9186,25 +9201,24 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin skip |= validateCommandBufferState(dev_data, pSubCB, "vkCmdExecuteCommands()", 0, VALIDATION_ERROR_1b2000b2); if (!(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) { if (pSubCB->in_use.load() || pCB->linkedCommandBuffers.count(pSubCB)) { - skip |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, - VALIDATION_ERROR_1b2000b4, "DS", "Attempt to simultaneously execute command buffer 0x%" PRIx64 - " without VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set! %s", - HandleToUint64(pCB->commandBuffer), validation_error_map[VALIDATION_ERROR_1b2000b4]); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__, + VALIDATION_ERROR_1b2000b4, "DS", + "Attempt to simultaneously execute command buffer 0x%" PRIx64 + " without VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set! %s", + HandleToUint64(pCB->commandBuffer), validation_error_map[VALIDATION_ERROR_1b2000b4]); } if (pCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT) { // Warn that non-simultaneous secondary cmd buffer renders primary non-simultaneous - skip |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - HandleToUint64(pCommandBuffers[i]), __LINE__, DRAWSTATE_INVALID_CB_SIMULTANEOUS_USE, "DS", - "vkCmdExecuteCommands(): Secondary Command Buffer (0x%" PRIx64 - ") " - "does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set and will cause primary command buffer " - "(0x%" PRIx64 - ") to be treated as if it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT " - "set, even though it does.", - HandleToUint64(pCommandBuffers[i]), HandleToUint64(pCB->commandBuffer)); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCommandBuffers[i]), __LINE__, + DRAWSTATE_INVALID_CB_SIMULTANEOUS_USE, "DS", + "vkCmdExecuteCommands(): Secondary Command Buffer (0x%" PRIx64 + ") does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set and will cause primary " + "command buffer (0x%" PRIx64 + ") to be treated as if it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set, even " + "though it does.", + HandleToUint64(pCommandBuffers[i]), HandleToUint64(pCB->commandBuffer)); pCB->beginInfo.flags &= ~VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; } } @@ -9212,11 +9226,8 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_1b2000ca, "DS", - "vkCmdExecuteCommands(): Secondary Command Buffer " - "(0x%" PRIx64 - ") cannot be submitted with a query in " - "flight and inherited queries not " - "supported on this device. %s", + "vkCmdExecuteCommands(): Secondary Command Buffer (0x%" PRIx64 + ") cannot be submitted with a query in flight and inherited queries not supported on this device. %s", HandleToUint64(pCommandBuffers[i]), validation_error_map[VALIDATION_ERROR_1b2000ca]); } // TODO: separate validate from update! This is very tangled. @@ -9317,8 +9328,7 @@ static bool validateMemoryIsMapped(layer_data *dev_data, const char *funcName, u log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, HandleToUint64(pMemRanges[i].memory), __LINE__, VALIDATION_ERROR_0c20055c, "MEM", "%s: Flush/Invalidate offset (" PRINTF_SIZE_T_SPECIFIER - ") is less than Memory Object's offset " - "(" PRINTF_SIZE_T_SPECIFIER "). %s", + ") is less than Memory Object's offset (" PRINTF_SIZE_T_SPECIFIER "). %s", funcName, static_cast<size_t>(pMemRanges[i].offset), static_cast<size_t>(mem_info->mem_range.offset), validation_error_map[VALIDATION_ERROR_0c20055c]); } @@ -9332,8 +9342,7 @@ static bool validateMemoryIsMapped(layer_data *dev_data, const char *funcName, u log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, HandleToUint64(pMemRanges[i].memory), __LINE__, VALIDATION_ERROR_0c20055a, "MEM", "%s: Flush/Invalidate size or offset (" PRINTF_SIZE_T_SPECIFIER ", " PRINTF_SIZE_T_SPECIFIER - ") exceed the Memory Object's upper-bound " - "(" PRINTF_SIZE_T_SPECIFIER "). %s", + ") exceed the Memory Object's upper-bound (" PRINTF_SIZE_T_SPECIFIER "). %s", funcName, static_cast<size_t>(pMemRanges[i].offset + pMemRanges[i].size), static_cast<size_t>(pMemRanges[i].offset), static_cast<size_t>(data_end), validation_error_map[VALIDATION_ERROR_0c20055a]); @@ -9500,8 +9509,7 @@ static bool PreCallValidateBindImageMemory(layer_data *dev_data, VkImage image, skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, image_handle, __LINE__, VALIDATION_ERROR_17400830, "DS", "%s: memoryOffset is 0x%" PRIxLEAST64 - " but must be an integer multiple of the " - "VkMemoryRequirements::alignment value 0x%" PRIxLEAST64 + " but must be an integer multiple of the VkMemoryRequirements::alignment value 0x%" PRIxLEAST64 ", returned from a call to vkGetImageMemoryRequirements with image. %s", api_name, memoryOffset, image_state->requirements.alignment, validation_error_map[VALIDATION_ERROR_17400830]); @@ -9513,8 +9521,7 @@ static bool PreCallValidateBindImageMemory(layer_data *dev_data, VkImage image, skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, image_handle, __LINE__, VALIDATION_ERROR_17400832, "DS", "%s: memory size minus memoryOffset is 0x%" PRIxLEAST64 - " but must be at least as large as " - "VkMemoryRequirements::size value 0x%" PRIxLEAST64 + " but must be at least as large as VkMemoryRequirements::size value 0x%" PRIxLEAST64 ", returned from a call to vkGetImageMemoryRequirements with image. %s", api_name, mem_info->alloc_info.allocationSize - memoryOffset, image_state->requirements.size, validation_error_map[VALIDATION_ERROR_17400832]); @@ -9680,6 +9687,49 @@ static bool PreCallValidateQueueBindSparse(layer_data *dev_data, VkQueue queue, } } } + // Store sparse binding image_state and after binding is complete make sure that any requiring metadata have it bound + std::unordered_set<IMAGE_STATE *> sparse_images; + // If we're binding sparse image memory make sure reqs were queried and note if metadata is required and bound + for (uint32_t i = 0; i < bindInfo.imageBindCount; ++i) { + const auto &opaque_bind = bindInfo.pImageOpaqueBinds[i]; + auto image_state = GetImageState(dev_data, opaque_bind.image); + sparse_images.insert(image_state); + if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) { + // For now just warning if sparse image binding occurs without calling to get reqs first + return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, MEMTRACK_INVALID_STATE, "CV", + "vkQueueBindSparse(): Binding sparse memory to image 0x%" PRIx64 + " without first calling vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.", + HandleToUint64(image_state->image)); + } + for (uint32_t j = 0; j < opaque_bind.bindCount; ++j) { + if (opaque_bind.pBinds[j].flags & VK_IMAGE_ASPECT_METADATA_BIT) { + image_state->sparse_metadata_bound = true; + } + } + } + for (uint32_t i = 0; i < bindInfo.imageOpaqueBindCount; ++i) { + auto image_state = GetImageState(dev_data, bindInfo.pImageOpaqueBinds[i].image); + sparse_images.insert(image_state); + if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) { + // For now just warning if sparse image binding occurs without calling to get reqs first + return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, MEMTRACK_INVALID_STATE, "CV", + "vkQueueBindSparse(): Binding opaque sparse memory to image 0x%" PRIx64 + " without first calling vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.", + HandleToUint64(image_state->image)); + } + } + for (const auto &sparse_image_state : sparse_images) { + if (sparse_image_state->sparse_metadata_required && !sparse_image_state->sparse_metadata_bound) { + // Warn if sparse image binding metadata required for image with sparse binding, but metadata not bound + return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(sparse_image_state->image), __LINE__, MEMTRACK_INVALID_STATE, "CV", + "vkQueueBindSparse(): Binding sparse memory to image 0x%" PRIx64 + " which requires a metadata aspect but no binding with VK_IMAGE_ASPECT_METADATA_BIT set was made.", + HandleToUint64(sparse_image_state->image)); + } + } } return skip; @@ -9706,8 +9756,8 @@ static void PostCallRecordQueueBindSparse(layer_data *dev_data, VkQueue queue, u log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, HandleToUint64(fence), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS", "vkQueueBindSparse(): Signaling external fence 0x%" PRIx64 " on queue 0x%" PRIx64 - " will disable validation of preceding command buffer lifecycle states and the in-use status of " - "associated objects.", + " will disable validation of preceding command buffer lifecycle states and the in-use status of associated " + "objects.", HandleToUint64(fence), HandleToUint64(queue)); } } @@ -10044,15 +10094,15 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * // TODO: should restrict search only to queue families of VkDeviceQueueCreateInfos, not whole phys. device return (qs.first.gpu == dev_data->physical_device) && qs.second; }; - const auto& support = surface_state->gpu_queue_support; + const auto &support = surface_state->gpu_queue_support; bool is_supported = std::any_of(support.begin(), support.end(), support_predicate); if (!is_supported) { if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_146009ec, "DS", - "%s: pCreateInfo->surface is not known at this time to be supported for presentation by this device. " - "The vkGetPhysicalDeviceSurfaceSupportKHR() must be called beforehand, and it must return VK_TRUE support " - "with this surface for at least one queue family of this device. %s", + "%s: pCreateInfo->surface is not known at this time to be supported for presentation by this device. The " + "vkGetPhysicalDeviceSurfaceSupportKHR() must be called beforehand, and it must return VK_TRUE support with " + "this surface for at least one queue family of this device. %s", func_name, validation_error_map[VALIDATION_ERROR_146009ec])) return true; } @@ -10082,8 +10132,8 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * if (pCreateInfo->minImageCount < capabilities.minImageCount) { if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_146009ee, "DS", - "%s called with minImageCount = %d, which is outside the bounds returned " - "by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s", + "%s called with minImageCount = %d, which is outside the bounds returned by " + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s", func_name, pCreateInfo->minImageCount, capabilities.minImageCount, capabilities.maxImageCount, validation_error_map[VALIDATION_ERROR_146009ee])) return true; @@ -10092,8 +10142,8 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * if ((capabilities.maxImageCount > 0) && (pCreateInfo->minImageCount > capabilities.maxImageCount)) { if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_146009f0, "DS", - "%s called with minImageCount = %d, which is outside the bounds returned " - "by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s", + "%s called with minImageCount = %d, which is outside the bounds returned by " + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s", func_name, pCreateInfo->minImageCount, capabilities.minImageCount, capabilities.maxImageCount, validation_error_map[VALIDATION_ERROR_146009f0])) return true; @@ -10361,15 +10411,15 @@ static bool PreCallValidateGetSwapchainImagesKHR(layer_data *device_data, SWAPCH if (swapchain_state->vkGetSwapchainImagesKHRState == UNCALLED) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(device), __LINE__, SWAPCHAIN_PRIOR_COUNT, "DS", - "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount; but no prior positive " - "value has been seen for pSwapchainImages."); + "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount; but no prior positive value has " + "been seen for pSwapchainImages."); } else if (*pSwapchainImageCount > swapchain_state->get_swapchain_image_count) { - skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - HandleToUint64(device), __LINE__, SWAPCHAIN_INVALID_COUNT, "DS", - "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount, and with " - "pSwapchainImages set to a value (%d) that is greater than the value (%d) that was returned when " - "pSwapchainImageCount was NULL.", - *pSwapchainImageCount, swapchain_state->get_swapchain_image_count); + skip |= + log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + HandleToUint64(device), __LINE__, SWAPCHAIN_INVALID_COUNT, "DS", + "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount, and with pSwapchainImages set to a " + "value (%d) that is greater than the value (%d) that was returned when pSwapchainImageCount was NULL.", + *pSwapchainImageCount, swapchain_state->get_swapchain_image_count); } } return skip; @@ -10488,14 +10538,13 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf vector<VkImageLayout> layouts; if (FindLayouts(dev_data, image, layouts)) { for (auto layout : layouts) { - if ((layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) && - (!dev_data->extensions.vk_khr_shared_presentable_image || - (layout != VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR))) { + if ((layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) && (!dev_data->extensions.vk_khr_shared_presentable_image || + (layout != VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR))) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, HandleToUint64(queue), __LINE__, VALIDATION_ERROR_11200a20, "DS", - "Images passed to present must be in layout " - "VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in %s. %s", + "Images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or " + "VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in %s. %s", string_VkImageLayout(layout), validation_error_map[VALIDATION_ERROR_11200a20]); } } @@ -10513,14 +10562,12 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, "DS", - "vkQueuePresentKHR: Presenting image without calling " - "vkGetPhysicalDeviceSurfaceSupportKHR"); + "vkQueuePresentKHR: Presenting image without calling vkGetPhysicalDeviceSurfaceSupportKHR"); } else if (!support_it->second) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, VALIDATION_ERROR_31800a18, "DS", - "vkQueuePresentKHR: Presenting image on queue that cannot " - "present to this surface. %s", + "vkQueuePresentKHR: Presenting image on queue that cannot present to this surface. %s", validation_error_map[VALIDATION_ERROR_31800a18]); } } @@ -10541,28 +10588,26 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS", - "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext " - "chain, pRegion[%i].pRectangles[%i], the sum of offset.x " - "(%i) and extent.width (%i) is greater than the " - "corresponding swapchain's imageExtent.width (%i).", + "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext chain, " + "pRegion[%i].pRectangles[%i], the sum of offset.x (%i) and extent.width (%i) is greater " + "than the corresponding swapchain's imageExtent.width (%i).", i, j, rect.offset.x, rect.extent.width, swapchain_data->createInfo.imageExtent.width); } if ((rect.offset.y + rect.extent.height) > swapchain_data->createInfo.imageExtent.height) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS", - "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext " - "chain, pRegion[%i].pRectangles[%i], the sum of offset.y " - "(%i) and extent.height (%i) is greater than the " - "corresponding swapchain's imageExtent.height (%i).", + "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext chain, " + "pRegion[%i].pRectangles[%i], the sum of offset.y (%i) and extent.height (%i) is greater " + "than the corresponding swapchain's imageExtent.height (%i).", i, j, rect.offset.y, rect.extent.height, swapchain_data->createInfo.imageExtent.height); } if (rect.layer > swapchain_data->createInfo.imageArrayLayers) { skip |= log_msg( dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS", - "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext chain, pRegion[%i].pRectangles[%i], the " - "layer (%i) is greater than the corresponding swapchain's imageArrayLayers (%i).", + "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext chain, pRegion[%i].pRectangles[%i], the layer " + "(%i) is greater than the corresponding swapchain's imageArrayLayers (%i).", i, j, rect.layer, swapchain_data->createInfo.imageArrayLayers); } } @@ -10572,15 +10617,15 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf const auto *present_times_info = lvl_find_in_chain<VkPresentTimesInfoGOOGLE>(pPresentInfo->pNext); if (present_times_info) { if (pPresentInfo->swapchainCount != present_times_info->swapchainCount) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, - HandleToUint64(pPresentInfo->pSwapchains[0]), __LINE__, + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, + HandleToUint64(pPresentInfo->pSwapchains[0]), __LINE__, - VALIDATION_ERROR_118009be, "DS", - "vkQueuePresentKHR(): VkPresentTimesInfoGOOGLE.swapchainCount is %i but " - "pPresentInfo->swapchainCount is %i. For VkPresentTimesInfoGOOGLE down pNext " - "chain of VkPresentInfoKHR, VkPresentTimesInfoGOOGLE.swapchainCount " - "must equal VkPresentInfoKHR.swapchainCount.", - present_times_info->swapchainCount, pPresentInfo->swapchainCount); + VALIDATION_ERROR_118009be, "DS", + "vkQueuePresentKHR(): VkPresentTimesInfoGOOGLE.swapchainCount is %i but pPresentInfo->swapchainCount " + "is %i. For VkPresentTimesInfoGOOGLE down pNext chain of VkPresentInfoKHR, " + "VkPresentTimesInfoGOOGLE.swapchainCount must equal VkPresentInfoKHR.swapchainCount.", + present_times_info->swapchainCount, pPresentInfo->swapchainCount); } } } @@ -10701,8 +10746,8 @@ static bool PreCallValidateAcquireNextImageKHR(layer_data *dev_data, VkDevice de if (fence == VK_NULL_HANDLE && semaphore == VK_NULL_HANDLE) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(device), __LINE__, DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, "DS", - "vkAcquireNextImageKHR: Semaphore and fence cannot both be VK_NULL_HANDLE. There would be no way " - "to determine the completion of this operation."); + "vkAcquireNextImageKHR: Semaphore and fence cannot both be VK_NULL_HANDLE. There would be no way to " + "determine the completion of this operation."); } auto pSemaphore = GetSemaphoreNode(dev_data, semaphore); @@ -10722,8 +10767,8 @@ static bool PreCallValidateAcquireNextImageKHR(layer_data *dev_data, VkDevice de if (swapchain_data->replaced) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, HandleToUint64(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_REPLACED, "DS", - "vkAcquireNextImageKHR: This swapchain has been replaced. The application can still " - "present any images it has acquired, but cannot acquire any more."); + "vkAcquireNextImageKHR: This swapchain has been replaced. The application can still present any images it " + "has acquired, but cannot acquire any more."); } auto physical_device_state = GetPhysicalDeviceState(dev_data->instance_data, dev_data->physical_device); @@ -10810,15 +10855,15 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uin // robust on platforms with multiple physical devices. skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, 0, __LINE__, DEVLIMITS_MISSING_QUERY_COUNT, "DL", - "Call sequence has vkEnumeratePhysicalDevices() w/ non-NULL pPhysicalDevices. You should first " - "call vkEnumeratePhysicalDevices() w/ NULL pPhysicalDevices to query pPhysicalDeviceCount."); + "Call sequence has vkEnumeratePhysicalDevices() w/ non-NULL pPhysicalDevices. You should first call " + "vkEnumeratePhysicalDevices() w/ NULL pPhysicalDevices to query pPhysicalDeviceCount."); } // TODO : Could also flag a warning if re-calling this function in QUERY_DETAILS state else if (instance_data->physical_devices_count != *pPhysicalDeviceCount) { // Having actual count match count from app is not a requirement, so this can be a warning skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL", - "Call to vkEnumeratePhysicalDevices() w/ pPhysicalDeviceCount value %u, but actual count " - "supported by this instance is %u.", + "Call to vkEnumeratePhysicalDevices() w/ pPhysicalDeviceCount value %u, but actual count supported by " + "this instance is %u.", *pPhysicalDeviceCount, instance_data->physical_devices_count); } instance_data->vkEnumeratePhysicalDevicesState = QUERY_DETAILS; @@ -10999,9 +11044,9 @@ VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR s if ((surface_state) && (surface_state->swapchain)) { skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - HandleToUint64(instance), __LINE__, VALIDATION_ERROR_26c009e4, "DS", - "vkDestroySurfaceKHR() called before its associated VkSwapchainKHR was destroyed. %s", - validation_error_map[VALIDATION_ERROR_26c009e4]); + HandleToUint64(instance), __LINE__, VALIDATION_ERROR_26c009e4, "DS", + "vkDestroySurfaceKHR() called before its associated VkSwapchainKHR was destroyed. %s", + validation_error_map[VALIDATION_ERROR_26c009e4]); } instance_data->surface_map.erase(surface); lock.unlock(); @@ -11285,11 +11330,11 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysica auto prev_mode_count = (uint32_t)physical_device_state->present_modes.size(); switch (call_state) { case UNCALLED: - skip |= log_msg( - instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - HandleToUint64(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL", - "vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior positive " - "value has been seen for pPresentModeCount."); + skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, + DEVLIMITS_MUST_QUERY_COUNT, "DL", + "vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior " + "positive value has been seen for pPresentModeCount."); break; default: // both query count and query details @@ -11297,9 +11342,8 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysica skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL", - "vkGetPhysicalDeviceSurfacePresentModesKHR() called with *pPresentModeCount (%u) that " - "differs from the value " - "(%u) that was returned when pPresentModes was NULL.", + "vkGetPhysicalDeviceSurfacePresentModesKHR() called with *pPresentModeCount (%u) that differs " + "from the value (%u) that was returned when pPresentModes was NULL.", *pPresentModeCount, prev_mode_count); } break; @@ -11348,23 +11392,21 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevi // Since we haven't recorded a preliminary value of *pSurfaceFormatCount, that likely means that the application // didn't // previously call this function with a NULL value of pSurfaceFormats: - skip |= log_msg( - instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - HandleToUint64(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL", - "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior positive " - "value has been seen for pSurfaceFormats."); + skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, + DEVLIMITS_MUST_QUERY_COUNT, "DL", + "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior " + "positive value has been seen for pSurfaceFormats."); break; default: if (prev_format_count != *pSurfaceFormatCount) { - skip |= log_msg( - instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, - DEVLIMITS_COUNT_MISMATCH, "DL", - "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount, and with pSurfaceFormats " - "set " - "to " - "a value (%u) that is greater than the value (%u) that was returned when pSurfaceFormatCount was NULL.", - *pSurfaceFormatCount, prev_format_count); + skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, + DEVLIMITS_COUNT_MISMATCH, "DL", + "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount, and with " + "pSurfaceFormats set to a value (%u) that is greater than the value (%u) that was returned " + "when pSurfaceFormatCount was NULL.", + *pSurfaceFormatCount, prev_format_count); } break; } @@ -11476,7 +11518,8 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char * VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { - if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) return util_GetExtensionProperties(1, device_extensions, pCount, pProperties); + if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) + return util_GetExtensionProperties(1, device_extensions, pCount, pProperties); assert(physicalDevice); @@ -11500,18 +11543,16 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX( skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, 0, __LINE__, DEVLIMITS_MISSING_QUERY_COUNT, "DL", "Call sequence has vkEnumeratePhysicalDeviceGroupsKHX() w/ non-NULL " - "pPhysicalDeviceGroupProperties. You should first " - "call vkEnumeratePhysicalDeviceGroupsKHX() w/ NULL pPhysicalDeviceGroupProperties to query " - "pPhysicalDeviceGroupCount."); - } // TODO : Could also flag a warning if re-calling this function in QUERY_DETAILS state + "pPhysicalDeviceGroupProperties. You should first call vkEnumeratePhysicalDeviceGroupsKHX() w/ " + "NULL pPhysicalDeviceGroupProperties to query pPhysicalDeviceGroupCount."); + } // TODO : Could also flag a warning if re-calling this function in QUERY_DETAILS state else if (instance_data->physical_device_groups_count != *pPhysicalDeviceGroupCount) { // Having actual count match count from app is not a requirement, so this can be a warning - skip |= - log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL", - "Call to vkEnumeratePhysicalDeviceGroupsKHX() w/ pPhysicalDeviceGroupCount value %u, but actual count " - "supported by this instance is %u.", - *pPhysicalDeviceGroupCount, instance_data->physical_device_groups_count); + skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL", + "Call to vkEnumeratePhysicalDeviceGroupsKHX() w/ pPhysicalDeviceGroupCount value %u, but actual " + "count supported by this instance is %u.", + *pPhysicalDeviceGroupCount, instance_data->physical_device_groups_count); } instance_data->vkEnumeratePhysicalDeviceGroupsState = QUERY_DETAILS; } @@ -11519,10 +11560,10 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX( return VK_ERROR_VALIDATION_FAILED_EXT; } VkResult result = instance_data->dispatch_table.EnumeratePhysicalDeviceGroupsKHX(instance, pPhysicalDeviceGroupCount, - pPhysicalDeviceGroupProperties); + pPhysicalDeviceGroupProperties); if (NULL == pPhysicalDeviceGroupProperties) { instance_data->physical_device_groups_count = *pPhysicalDeviceGroupCount; - } else if (result == VK_SUCCESS) { // Save physical devices + } else if (result == VK_SUCCESS) { // Save physical devices for (uint32_t i = 0; i < *pPhysicalDeviceGroupCount; i++) { for (uint32_t j = 0; j < pPhysicalDeviceGroupProperties[i].physicalDeviceCount; j++) { VkPhysicalDevice cur_phys_dev = pPhysicalDeviceGroupProperties[i].physicalDevices[j]; @@ -11713,7 +11754,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, cons layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); if (pNameInfo->pObjectName) { device_data->report_data->debugObjectNameMap->insert( - std::make_pair<uint64_t, std::string>((uint64_t &&)pNameInfo->object, pNameInfo->pObjectName)); + std::make_pair<uint64_t, std::string>((uint64_t &&) pNameInfo->object, pNameInfo->pObjectName)); } else { device_data->report_data->debugObjectNameMap->erase(pNameInfo->object); } @@ -11944,6 +11985,10 @@ static const std::unordered_map<std::string, void *> name_to_funcptr_map = { {"vkGetBufferMemoryRequirements2KHR", (void *)GetBufferMemoryRequirements2KHR}, {"vkGetImageMemoryRequirements", (void *)GetImageMemoryRequirements}, {"vkGetImageMemoryRequirements2KHR", (void *)GetImageMemoryRequirements2KHR}, + {"vkGetImageSparseMemoryRequirements", (void *)GetImageSparseMemoryRequirements}, + {"vkGetImageSparseMemoryRequirements2KHR", (void *)GetImageSparseMemoryRequirements2KHR}, + {"vkGetPhysicalDeviceSparseImageFormatProperties", (void *)GetPhysicalDeviceSparseImageFormatProperties}, + {"vkGetPhysicalDeviceSparseImageFormatProperties2KHR", (void *)GetPhysicalDeviceSparseImageFormatProperties2KHR}, {"vkGetQueryPoolResults", (void *)GetQueryPoolResults}, {"vkBindImageMemory", (void *)BindImageMemory}, {"vkBindImageMemory2KHR", (void *)BindImageMemory2KHR}, diff --git a/layers/core_validation.h b/layers/core_validation.h index d4a78bbda..de1aeac51 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -68,8 +68,6 @@ // TODO : Is there a way to track when Cmd Buffer finishes & remove mem references at that point? // TODO : Could potentially store a list of freed mem allocs to flag when they're incorrectly used - - struct GENERIC_HEADER { VkStructureType sType; const void *pNext; @@ -161,7 +159,7 @@ struct hash<GpuQueue> { return hash<uint64_t>()((uint64_t)(gq.gpu)) ^ hash<uint32_t>()(gq.queue_family_index); } }; -} +} // namespace std struct SURFACE_STATE { VkSurfaceKHR surface = VK_NULL_HANDLE; diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h index 12099c327..45d03f65d 100644 --- a/layers/core_validation_error_enums.h +++ b/layers/core_validation_error_enums.h @@ -203,25 +203,25 @@ enum IMAGE_ERROR { }; enum SWAPCHAIN_ERROR { - SWAPCHAIN_INVALID_HANDLE, // Handle used that isn't currently valid - SWAPCHAIN_NULL_POINTER, // Pointer set to NULL, instead of being a valid pointer - SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, // Did not enable WSI extension, but called WSI function - SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, // Called vkDestroyDevice() before vkDestroySwapchainKHR() - SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE, // Called vkCreateSwapchainKHR() with a pCreateInfo->surface that wasn't supported - SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, // Called vkCreateSwapchainKHR() without calling a query - SWAPCHAIN_CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS, // Called vkCreateSwapchainKHR() with out-of-bounds imageExtent - SWAPCHAIN_CREATE_SWAP_EXTENTS_NO_MATCH_WIN, // Called vkCreateSwapchainKHR w/imageExtent that doesn't match window's extent - SWAPCHAIN_CREATE_SWAP_BAD_PRE_TRANSFORM, // Called vkCreateSwapchainKHR() with a non-supported preTransform - SWAPCHAIN_CREATE_SWAP_BAD_COMPOSITE_ALPHA, // Called vkCreateSwapchainKHR() with a non-supported compositeAlpha - SWAPCHAIN_CREATE_SWAP_BAD_IMG_ARRAY_LAYERS, // Called vkCreateSwapchainKHR() with a non-supported imageArrayLayers - SWAPCHAIN_CREATE_SWAP_BAD_IMG_USAGE_FLAGS, // Called vkCreateSwapchainKHR() with a non-supported imageUsageFlags - SWAPCHAIN_CREATE_SWAP_BAD_IMG_COLOR_SPACE, // Called vkCreateSwapchainKHR() with a non-supported imageColorSpace - SWAPCHAIN_CREATE_SWAP_BAD_IMG_FORMAT, // Called vkCreateSwapchainKHR() with a non-supported imageFormat - SWAPCHAIN_CREATE_SWAP_BAD_IMG_FMT_CLR_SP, // Called vkCreateSwapchainKHR() with a non-supported imageColorSpace - SWAPCHAIN_CREATE_SWAP_BAD_PRESENT_MODE, // Called vkCreateSwapchainKHR() with a non-supported presentMode - SWAPCHAIN_CREATE_SWAP_BAD_SHARING_MODE, // Called vkCreateSwapchainKHR() with a non-supported imageSharingMode - SWAPCHAIN_CREATE_SWAP_BAD_SHARING_VALUES, // Called vkCreateSwapchainKHR() with bad values when imageSharingMode is - // VK_SHARING_MODE_CONCURRENT + SWAPCHAIN_INVALID_HANDLE, // Handle used that isn't currently valid + SWAPCHAIN_NULL_POINTER, // Pointer set to NULL, instead of being a valid pointer + SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, // Did not enable WSI extension, but called WSI function + SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, // Called vkDestroyDevice() before vkDestroySwapchainKHR() + SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE, // Called vkCreateSwapchainKHR() with a pCreateInfo->surface that wasn't supported + SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, // Called vkCreateSwapchainKHR() without calling a query + SWAPCHAIN_CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS, // Called vkCreateSwapchainKHR() with out-of-bounds imageExtent + SWAPCHAIN_CREATE_SWAP_EXTENTS_NO_MATCH_WIN, // Called vkCreateSwapchainKHR w/imageExtent that doesn't match window's extent + SWAPCHAIN_CREATE_SWAP_BAD_PRE_TRANSFORM, // Called vkCreateSwapchainKHR() with a non-supported preTransform + SWAPCHAIN_CREATE_SWAP_BAD_COMPOSITE_ALPHA, // Called vkCreateSwapchainKHR() with a non-supported compositeAlpha + SWAPCHAIN_CREATE_SWAP_BAD_IMG_ARRAY_LAYERS, // Called vkCreateSwapchainKHR() with a non-supported imageArrayLayers + SWAPCHAIN_CREATE_SWAP_BAD_IMG_USAGE_FLAGS, // Called vkCreateSwapchainKHR() with a non-supported imageUsageFlags + SWAPCHAIN_CREATE_SWAP_BAD_IMG_COLOR_SPACE, // Called vkCreateSwapchainKHR() with a non-supported imageColorSpace + SWAPCHAIN_CREATE_SWAP_BAD_IMG_FORMAT, // Called vkCreateSwapchainKHR() with a non-supported imageFormat + SWAPCHAIN_CREATE_SWAP_BAD_IMG_FMT_CLR_SP, // Called vkCreateSwapchainKHR() with a non-supported imageColorSpace + SWAPCHAIN_CREATE_SWAP_BAD_PRESENT_MODE, // Called vkCreateSwapchainKHR() with a non-supported presentMode + SWAPCHAIN_CREATE_SWAP_BAD_SHARING_MODE, // Called vkCreateSwapchainKHR() with a non-supported imageSharingMode + SWAPCHAIN_CREATE_SWAP_BAD_SHARING_VALUES, // Called vkCreateSwapchainKHR() with bad values when imageSharingMode is + // VK_SHARING_MODE_CONCURRENT SWAPCHAIN_BAD_BOOL, // VkBool32 that doesn't have value of VK_TRUE or VK_FALSE (e.g. is a non-zero form of true) SWAPCHAIN_PRIOR_COUNT, // Query must be called first to get value of pCount, then called second time SWAPCHAIN_INVALID_COUNT, // Second time a query called, the pCount value didn't match first time diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index c63d4528b..bc5a554f6 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -43,7 +43,7 @@ namespace cvdescriptorset { class DescriptorSetLayout; class DescriptorSet; -} +} // namespace cvdescriptorset struct GLOBAL_CB_NODE; @@ -87,10 +87,10 @@ template <> struct hash<VK_OBJECT> { size_t operator()(VK_OBJECT obj) const NOEXCEPT { return hash<uint64_t>()(obj.handle) ^ hash<uint32_t>()(obj.type); } }; -} +} // namespace std class PHYS_DEV_PROPERTIES_NODE { -public: + public: VkPhysicalDeviceProperties properties; std::vector<VkQueueFamilyProperties> queue_family_properties; }; @@ -157,7 +157,7 @@ struct hash<MEM_BINDING> { return intermediate ^ hash<uint64_t>()(mb.size); } }; -} +} // namespace std // Superclass for bindable object state (currently images and buffers) class BINDABLE : public BASE_NODE { @@ -219,7 +219,7 @@ class BUFFER_STATE : public BINDABLE { ~BUFFER_STATE() { if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { - delete [] createInfo.pQueueFamilyIndices; + delete[] createInfo.pQueueFamilyIndices; createInfo.pQueueFamilyIndices = nullptr; } }; @@ -244,12 +244,25 @@ class IMAGE_STATE : public BINDABLE { public: VkImage image; VkImageCreateInfo createInfo; - bool valid; // If this is a swapchain image backing memory track valid here as it doesn't have DEVICE_MEM_INFO - bool acquired; // If this is a swapchain image, has it been acquired by the app. - bool shared_presentable; // True for a front-buffered swapchain image - bool layout_locked; // A front-buffered image that has been presented can never have layout transitioned + bool valid; // If this is a swapchain image backing memory track valid here as it doesn't have DEVICE_MEM_INFO + bool acquired; // If this is a swapchain image, has it been acquired by the app. + bool shared_presentable; // True for a front-buffered swapchain image + bool layout_locked; // A front-buffered image that has been presented can never have layout transitioned + bool get_sparse_reqs_called; // Track if GetImageSparseMemoryRequirements() has been called for this image + bool sparse_metadata_required; // Track if sparse metadata aspect is required for this image + bool sparse_metadata_bound; // Track if sparse metadata aspect is bound to this image + std::vector<VkSparseImageMemoryRequirements> sparse_requirements; IMAGE_STATE(VkImage img, const VkImageCreateInfo *pCreateInfo) - : image(img), createInfo(*pCreateInfo), valid(false), acquired(false), shared_presentable(false), layout_locked(false) { + : image(img), + createInfo(*pCreateInfo), + valid(false), + acquired(false), + shared_presentable(false), + layout_locked(false), + get_sparse_reqs_called(false), + sparse_metadata_required(false), + sparse_metadata_bound(false), + sparse_requirements{} { if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { uint32_t *pQueueFamilyIndices = new uint32_t[createInfo.queueFamilyIndexCount]; for (uint32_t i = 0; i < createInfo.queueFamilyIndexCount; i++) { @@ -267,7 +280,7 @@ class IMAGE_STATE : public BINDABLE { ~IMAGE_STATE() { if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { - delete [] createInfo.pQueueFamilyIndices; + delete[] createInfo.pQueueFamilyIndices; createInfo.pQueueFamilyIndices = nullptr; } }; @@ -439,11 +452,11 @@ enum CMD_TYPE { }; enum CB_STATE { - CB_NEW, // Newly created CB w/o any cmds - CB_RECORDING, // BeginCB has been called on this CB - CB_RECORDED, // EndCB has been called on this CB - CB_INVALID_COMPLETE, // had a complete recording, but was since invalidated - CB_INVALID_INCOMPLETE, // fouled before recording was completed + CB_NEW, // Newly created CB w/o any cmds + CB_RECORDING, // BeginCB has been called on this CB + CB_RECORDED, // EndCB has been called on this CB + CB_INVALID_COMPLETE, // had a complete recording, but was since invalidated + CB_INVALID_INCOMPLETE, // fouled before recording was completed }; // CB Status -- used to track status of various bindings on cmd buffer objects @@ -473,7 +486,6 @@ struct TEMPLATE_STATE { : desc_update_template(update_template), create_info(*pCreateInfo) {} }; - struct QueryObject { VkQueryPool pool; uint32_t index; @@ -490,7 +502,7 @@ struct hash<QueryObject> { return hash<uint64_t>()((uint64_t)(query.pool)) ^ hash<uint32_t>()(query.index); } }; -} +} // namespace std struct DRAW_DATA { std::vector<VkBuffer> buffers; }; @@ -522,7 +534,7 @@ struct hash<ImageSubresourcePair> { return hashVal; } }; -} +} // namespace std // Store layouts and pushconstants for PipelineLayout struct PIPELINE_LAYOUT_NODE { @@ -655,15 +667,15 @@ struct GLOBAL_CB_NODE : public BASE_NODE { VkCommandBufferAllocateInfo createInfo = {}; VkCommandBufferBeginInfo beginInfo; VkCommandBufferInheritanceInfo inheritanceInfo; - VkDevice device; // device this CB belongs to + VkDevice device; // device this CB belongs to bool hasDrawCmd; - CB_STATE state; // Track cmd buffer update state - uint64_t submitCount; // Number of times CB has been submitted + CB_STATE state; // Track cmd buffer update state + uint64_t submitCount; // Number of times CB has been submitted typedef uint64_t ImageLayoutUpdateCount; ImageLayoutUpdateCount image_layout_change_count; // The sequence number for changes to image layout (for cached validation) - CBStatusFlags status; // Track status of various bindings on cmd buffer - CBStatusFlags static_status; // All state bits provided by current graphics pipeline - // rather than dynamic state + CBStatusFlags status; // Track status of various bindings on cmd buffer + CBStatusFlags static_status; // All state bits provided by current graphics pipeline + // rather than dynamic state // Currently storing "lastBound" objects on per-CB basis // long-term may want to create caches of "lastBound" states and could have // each individual CMD_NODE referencing its own "lastBound" state @@ -773,7 +785,7 @@ struct CHECK_DISABLED { bool destroy_query_pool; bool get_query_pool_results; bool destroy_buffer; - bool shader_validation; // Skip validation for shaders + bool shader_validation; // Skip validation for shaders void SetAll(bool value) { std::fill(&command_buffer_state, &shader_validation + 1, value); } }; @@ -784,7 +796,7 @@ struct MT_FB_ATTACHMENT_INFO { }; class FRAMEBUFFER_STATE : public BASE_NODE { -public: + public: VkFramebuffer framebuffer; safe_VkFramebufferCreateInfo createInfo; std::shared_ptr<RENDER_PASS_STATE> rp_state; @@ -836,7 +848,8 @@ bool ClearMemoryObjectBindings(layer_data *dev_data, uint64_t handle, VulkanObje bool ValidateCmdQueueFlags(layer_data *dev_data, const GLOBAL_CB_NODE *cb_node, const char *caller_name, VkQueueFlags flags, UNIQUE_VALIDATION_ERROR_CODE error_code); bool ValidateCmd(layer_data *my_data, const GLOBAL_CB_NODE *pCB, const CMD_TYPE cmd, const char *caller_name); -bool insideRenderPass(const layer_data *my_data, const GLOBAL_CB_NODE *pCB, const char *apiName, UNIQUE_VALIDATION_ERROR_CODE msgCode); +bool insideRenderPass(const layer_data *my_data, const GLOBAL_CB_NODE *pCB, const char *apiName, + UNIQUE_VALIDATION_ERROR_CODE msgCode); void SetImageMemoryValid(layer_data *dev_data, IMAGE_STATE *image_state, bool valid); bool outsideRenderPass(const layer_data *my_data, GLOBAL_CB_NODE *pCB, const char *apiName, UNIQUE_VALIDATION_ERROR_CODE msgCode); void SetLayout(GLOBAL_CB_NODE *pCB, ImageSubresourcePair imgpair, const IMAGE_CMD_BUF_LAYOUT_NODE &node); @@ -865,6 +878,6 @@ std::unordered_map<VkBuffer, std::unique_ptr<BUFFER_STATE>> *GetBufferMap(layer_ std::unordered_map<VkBufferView, std::unique_ptr<BUFFER_VIEW_STATE>> *GetBufferViewMap(layer_data *device_data); std::unordered_map<VkImageView, std::unique_ptr<IMAGE_VIEW_STATE>> *GetImageViewMap(layer_data *device_data); const DeviceExtensions *GetDeviceExtensions(const layer_data *); -} +} // namespace core_validation #endif // CORE_VALIDATION_TYPES_H_ diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 95f81c76c..9294dde98 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -333,8 +333,9 @@ bool cvdescriptorset::DescriptorSetLayout::VerifyUpdateConsistency(uint32_t curr if (!IsNextBindingConsistent(current_binding++)) { std::stringstream error_str; error_str << "Attempting " << type << " descriptor set " << set << " binding #" << orig_binding << " with #" - << update_count << " descriptors being updated but this update oversteps the bounds of this binding and the " - "next binding is not consistent with current binding so this update is invalid."; + << update_count + << " descriptors being updated but this update oversteps the bounds of this binding and the next binding is " + "not consistent with current binding so this update is invalid."; *error_msg = error_str.str(); return false; } @@ -564,8 +565,8 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::map<uint32_t, caller, VALIDATION_ERROR_046002b0, &hit_error); if (hit_error) { *error = - "Image layout specified at vkUpdateDescriptorSets() time doesn't match actual image layout at " - "time descriptor is used. See previous error callback for specific details."; + "Image layout specified at vkUpdateDescriptorSets() time doesn't match actual image layout at time " + "descriptor is used. See previous error callback for specific details."; return false; } } @@ -668,7 +669,6 @@ bool cvdescriptorset::DescriptorSet::ValidateCopyUpdate(const debug_report_data std::string *error_msg) { // Verify dst layout still valid if (p_layout_->IsDestroyed()) { - // TODO: Update to "cannot copy to dst descriptor set with destroyed descriptor set layout" VUID when present *error_code = VALIDATION_ERROR_03207601; string_sprintf(error_msg, "Cannot call vkUpdateDescriptorSets() to perform copy update on descriptor set dstSet 0x%" PRIxLEAST64 @@ -679,7 +679,6 @@ bool cvdescriptorset::DescriptorSet::ValidateCopyUpdate(const debug_report_data // Verify src layout still valid if (src_set->p_layout_->IsDestroyed()) { - // TODO: Update to "cannot copy from src descriptor set with destroyed descriptor set layout" VUID when present *error_code = VALIDATION_ERROR_0322d201; string_sprintf( error_msg, @@ -944,8 +943,9 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout // Only Color bit must be set if ((aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != VK_IMAGE_ASPECT_COLOR_BIT) { std::stringstream error_str; - error_str << "ImageView (" << image_view << ") uses layout VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL but does " - "not have VK_IMAGE_ASPECT_COLOR_BIT set."; + error_str + << "ImageView (" << image_view + << ") uses layout VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL but does not have VK_IMAGE_ASPECT_COLOR_BIT set."; *error_msg = error_str.str(); return false; } @@ -1030,23 +1030,22 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout // TODO : Need to create custom enum error codes for these cases if (image_node->shared_presentable) { if (VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR != image_layout) { - error_str - << "ImageView (" << image_view - << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type with a front-buffered image is being updated with " - "layout " - << string_VkImageLayout(image_layout) - << " but according to spec section 13.1 Descriptor Types, 'Front-buffered images that report support " - "for " - "VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT must be in the VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout.'"; + error_str << "ImageView (" << image_view + << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type with a front-buffered image is being updated with " + "layout " + << string_VkImageLayout(image_layout) + << " but according to spec section 13.1 Descriptor Types, 'Front-buffered images that report " + "support for VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT must be in the " + "VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout.'"; *error_msg = error_str.str(); return false; } } else if (VK_IMAGE_LAYOUT_GENERAL != image_layout) { - error_str - << "ImageView (" << image_view << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type is being updated with layout " - << string_VkImageLayout(image_layout) - << " but according to spec section 13.1 Descriptor Types, 'Load and store operations on storage images can " - "only be done on images in VK_IMAGE_LAYOUT_GENERAL layout.'"; + error_str << "ImageView (" << image_view + << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type is being updated with layout " + << string_VkImageLayout(image_layout) + << " but according to spec section 13.1 Descriptor Types, 'Load and store operations on storage " + "images can only be done on images in VK_IMAGE_LAYOUT_GENERAL layout.'"; *error_msg = error_str.str(); return false; } @@ -1377,7 +1376,6 @@ bool cvdescriptorset::DescriptorSet::ValidateWriteUpdate(const debug_report_data UNIQUE_VALIDATION_ERROR_CODE *error_code, std::string *error_msg) { // Verify dst layout still valid if (p_layout_->IsDestroyed()) { - // TODO: Update to "cannot write descriptor set with destroyed descriptor set layout" VUID when present *error_code = VALIDATION_ERROR_15c00280; string_sprintf(error_msg, "Cannot call vkUpdateDescriptorSets() to perform write update on descriptor set 0x%" PRIxLEAST64 diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h index 016230a8b..ac5bede47 100644 --- a/layers/descriptor_sets.h +++ b/layers/descriptor_sets.h @@ -461,5 +461,5 @@ class PrefilterBindRequestMap { PrefilterBindRequestMap(DescriptorSet &ds, const BindingReqMap &in_map, GLOBAL_CB_NODE *cb_state, PIPELINE_STATE *); const BindingReqMap &Map() const { return (filtered_map_) ? *filtered_map_ : orig_map_; } }; -} +} // namespace cvdescriptorset #endif // CORE_VALIDATION_DESCRIPTOR_SETS_H_ diff --git a/layers/object_tracker_utils.cpp b/layers/object_tracker_utils.cpp index 501083b22..957f347e0 100644 --- a/layers/object_tracker_utils.cpp +++ b/layers/object_tracker_utils.cpp @@ -210,31 +210,29 @@ bool ValidateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, Vk return skip; } -template<typename DispObj> +template <typename DispObj> static bool ValidateDescriptorWrite(DispObj disp, VkWriteDescriptorSet const *desc, bool isPush) { bool skip = false; if (!isPush && desc->dstSet) { - skip |= ValidateObject(disp, desc->dstSet, kVulkanObjectTypeDescriptorSet, false, - VALIDATION_ERROR_15c00280, VALIDATION_ERROR_15c00009); + skip |= ValidateObject(disp, desc->dstSet, kVulkanObjectTypeDescriptorSet, false, VALIDATION_ERROR_15c00280, + VALIDATION_ERROR_15c00009); } if ((desc->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { for (uint32_t idx2 = 0; idx2 < desc->descriptorCount; ++idx2) { - skip |= ValidateObject(disp, desc->pTexelBufferView[idx2], kVulkanObjectTypeBufferView, - false, VALIDATION_ERROR_15c00286, VALIDATION_ERROR_15c00009); + skip |= ValidateObject(disp, desc->pTexelBufferView[idx2], kVulkanObjectTypeBufferView, false, + VALIDATION_ERROR_15c00286, VALIDATION_ERROR_15c00009); } } if ((desc->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || - (desc->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || - (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || + (desc->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || (desc->descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { for (uint32_t idx3 = 0; idx3 < desc->descriptorCount; ++idx3) { - skip |= - ValidateObject(disp, desc->pImageInfo[idx3].imageView, kVulkanObjectTypeImageView, - false, VALIDATION_ERROR_15c0028c, VALIDATION_ERROR_04600009); + skip |= ValidateObject(disp, desc->pImageInfo[idx3].imageView, kVulkanObjectTypeImageView, false, + VALIDATION_ERROR_15c0028c, VALIDATION_ERROR_04600009); } } @@ -244,9 +242,8 @@ static bool ValidateDescriptorWrite(DispObj disp, VkWriteDescriptorSet const *de (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { for (uint32_t idx4 = 0; idx4 < desc->descriptorCount; ++idx4) { if (desc->pBufferInfo[idx4].buffer) { - skip |= - ValidateObject(disp, desc->pBufferInfo[idx4].buffer, kVulkanObjectTypeBuffer, - false, VALIDATION_ERROR_04401a01, VALIDATION_ERROR_UNDEFINED); + skip |= ValidateObject(disp, desc->pBufferInfo[idx4].buffer, kVulkanObjectTypeBuffer, false, + VALIDATION_ERROR_04401a01, VALIDATION_ERROR_UNDEFINED); } } } @@ -372,7 +369,6 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati iit = instance_data->object_map[kVulkanObjectTypeDevice].begin(); } - instance_data->object_map[kVulkanObjectTypeDevice].clear(); VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); @@ -406,7 +402,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCall std::unique_lock<std::mutex> lock(global_lock); layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); ValidateObject(device, device, kVulkanObjectTypeDevice, true, VALIDATION_ERROR_24a05601, VALIDATION_ERROR_UNDEFINED); - DestroyObject(device_data->instance, device, kVulkanObjectTypeDevice, pAllocator, VALIDATION_ERROR_24a002f6, VALIDATION_ERROR_24a002f8); + DestroyObject(device_data->instance, device, kVulkanObjectTypeDevice, pAllocator, VALIDATION_ERROR_24a002f6, + VALIDATION_ERROR_24a002f8); // Report any remaining objects associated with this VkDevice object in LL ReportUndestroyedObjects(device, VALIDATION_ERROR_24a002f4); diff --git a/layers/parameter_name.h b/layers/parameter_name.h index 6459b5e57..05a1d89e0 100644 --- a/layers/parameter_name.h +++ b/layers/parameter_name.h @@ -61,43 +61,43 @@ class ParameterName { ParameterName(const char *source) : source_(source) { assert(IsValid()); } /** - * Construct a ParameterName object from a std::string object, without formatting. - * - * @param source Paramater name string without format specifiers. - * - * @pre The source string must not contain the %i format specifier. - */ + * Construct a ParameterName object from a std::string object, without formatting. + * + * @param source Paramater name string without format specifiers. + * + * @pre The source string must not contain the %i format specifier. + */ ParameterName(const std::string &source) : source_(source) { assert(IsValid()); } /** - * Construct a ParameterName object from a std::string object, without formatting. - * - * @param source Paramater name string without format specifiers. - * - * @pre The source string must not contain the %i format specifier. - */ + * Construct a ParameterName object from a std::string object, without formatting. + * + * @param source Paramater name string without format specifiers. + * + * @pre The source string must not contain the %i format specifier. + */ ParameterName(const std::string &&source) : source_(std::move(source)) { assert(IsValid()); } /** - * Construct a ParameterName object from a std::string object, with formatting. - * - * @param source Paramater name string with format specifiers. - * @param args Array index values to be used for formatting. - * - * @pre The number of %i format specifiers contained by the source string must match the number of elements contained - * by the index vector. - */ + * Construct a ParameterName object from a std::string object, with formatting. + * + * @param source Paramater name string with format specifiers. + * @param args Array index values to be used for formatting. + * + * @pre The number of %i format specifiers contained by the source string must match the number of elements contained + * by the index vector. + */ ParameterName(const std::string &source, const IndexVector &args) : source_(source), args_(args) { assert(IsValid()); } /** - * Construct a ParameterName object from a std::string object, with formatting. - * - * @param source Paramater name string with format specifiers. - * @param args Array index values to be used for formatting. - * - * @pre The number of %i format specifiers contained by the source string must match the number of elements contained - * by the index vector. - */ + * Construct a ParameterName object from a std::string object, with formatting. + * + * @param source Paramater name string with format specifiers. + * @param args Array index values to be used for formatting. + * + * @pre The number of %i format specifiers contained by the source string must match the number of elements contained + * by the index vector. + */ ParameterName(const std::string &&source, const IndexVector &&args) : source_(std::move(source)), args_(std::move(args)) { assert(IsValid()); } diff --git a/layers/parameter_validation.h b/layers/parameter_validation.h index e3c5d8f99..82e95eb6b 100644 --- a/layers/parameter_validation.h +++ b/layers/parameter_validation.h @@ -36,13 +36,12 @@ #include "vk_validation_error_messages.h" #include "vk_extension_helper.h" - #include "parameter_name.h" namespace parameter_validation { extern const uint32_t GeneratedHeaderVersion; -extern const std::unordered_map<std::string, void*> name_to_funcptr_map; +extern const std::unordered_map<std::string, void *> name_to_funcptr_map; extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits; extern const VkColorComponentFlags AllVkColorComponentFlagBits; @@ -153,17 +152,17 @@ struct LogMiscParams { }; /** -* Validate a minimum value. -* -* Verify that the specified value is greater than the specified lower bound. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param parameter_name Name of parameter being validated. -* @param value Value to validate. -* @param lower_bound Lower bound value to use for validation. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate a minimum value. + * + * Verify that the specified value is greater than the specified lower bound. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param parameter_name Name of parameter being validated. + * @param value Value to validate. + * @param lower_bound Lower bound value to use for validation. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName ¶meter_name, const UNIQUE_VALIDATION_ERROR_CODE vuid, const LogMiscParams &misc) { @@ -201,8 +200,8 @@ static bool validate_required_pointer(debug_report_data *report_data, const char bool skip_call = false; if (value == NULL) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - vuid, LayerName, "%s: required parameter %s specified as NULL. %s", apiName, + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, vuid, + LayerName, "%s: required parameter %s specified as NULL. %s", apiName, parameterName.get_name().c_str(), validation_error_map[vuid]); } @@ -235,14 +234,14 @@ bool validate_array(debug_report_data *report_data, const char *apiName, const P // Count parameters not tagged as optional cannot be 0 if (countRequired && (count == 0)) { skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - count_required_vuid, LayerName, "%s: parameter %s must be greater than 0. %s", apiName, + count_required_vuid, LayerName, "%s: parameter %s must be greater than 0. %s", apiName, countName.get_name().c_str(), validation_error_map[count_required_vuid]); } // Array parameters not tagged as optional cannot be NULL, unless the count is 0 if ((array == NULL) && arrayRequired && (count != 0)) { skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - array_required_vuid, LayerName, "%s: required parameter %s specified as NULL. %s", apiName, + array_required_vuid, LayerName, "%s: required parameter %s specified as NULL. %s", apiName, arrayName.get_name().c_str(), validation_error_map[array_required_vuid]); } @@ -250,25 +249,25 @@ bool validate_array(debug_report_data *report_data, const char *apiName, const P } /** -* Validate pointer to array count and pointer to array. -* -* Verify that required count and array parameters are not NULL. If count -* is not NULL and its value is not optional, verify that it is not 0. If the -* array parameter is NULL, and it is not optional, verify that count is 0. -* The array parameter will typically be optional for this case (where count is -* a pointer), allowing the caller to retrieve the available count. -* -* @param report_data debug_report_data object for routing validation messages. -* @param apiName Name of API call being validated. -* @param countName Name of count parameter. -* @param arrayName Name of array parameter. -* @param count Pointer to the number of elements in the array. -* @param array Array to validate. -* @param countPtrRequired The 'count' parameter may not be NULL when true. -* @param countValueRequired The '*count' value may not be 0 when true. -* @param arrayRequired The 'array' parameter may not be NULL when true. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate pointer to array count and pointer to array. + * + * Verify that required count and array parameters are not NULL. If count + * is not NULL and its value is not optional, verify that it is not 0. If the + * array parameter is NULL, and it is not optional, verify that count is 0. + * The array parameter will typically be optional for this case (where count is + * a pointer), allowing the caller to retrieve the available count. + * + * @param report_data debug_report_data object for routing validation messages. + * @param apiName Name of API call being validated. + * @param countName Name of count parameter. + * @param arrayName Name of array parameter. + * @param count Pointer to the number of elements in the array. + * @param array Array to validate. + * @param countPtrRequired The 'count' parameter may not be NULL when true. + * @param countValueRequired The '*count' value may not be 0 when true. + * @param arrayRequired The 'array' parameter may not be NULL when true. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> bool validate_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T *count, const void *array, bool countPtrRequired, @@ -412,16 +411,16 @@ bool validate_struct_type_array(debug_report_data *report_data, const char *apiN } /** -* Validate a Vulkan handle. -* -* Verify that the specified handle is not VK_NULL_HANDLE. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param parameter_name Name of struct parameter being validated. -* @param value Handle to validate. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate a Vulkan handle. + * + * Verify that the specified handle is not VK_NULL_HANDLE. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param parameter_name Name of struct parameter being validated. + * @param value Handle to validate. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> bool validate_required_handle(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, T value) { bool skip_call = false; @@ -436,27 +435,27 @@ bool validate_required_handle(debug_report_data *report_data, const char *api_na } /** -* Validate an array of Vulkan handles. -* -* Verify that required count and array parameters are not NULL. If count -* is not NULL and its value is not optional, verify that it is not 0. -* If the array contains 1 or more handles, verify that no handle is set to -* VK_NULL_HANDLE. -* -* @note This function is only intended to validate arrays of handles when none -* of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles -* that are allowed to contain VK_NULL_HANDLE, use validate_array() instead. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param count_name Name of count parameter. -* @param array_name Name of array parameter. -* @param count Number of elements in the array. -* @param array Array to validate. -* @param count_required The 'count' parameter may not be 0 when true. -* @param array_required The 'array' parameter may not be NULL when true. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate an array of Vulkan handles. + * + * Verify that required count and array parameters are not NULL. If count + * is not NULL and its value is not optional, verify that it is not 0. + * If the array contains 1 or more handles, verify that no handle is set to + * VK_NULL_HANDLE. + * + * @note This function is only intended to validate arrays of handles when none + * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles + * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param count_name Name of count parameter. + * @param array_name Name of array parameter. + * @param count Number of elements in the array. + * @param array Array to validate. + * @param count_required The 'count' parameter may not be 0 when true. + * @param array_required The 'array' parameter may not be NULL when true. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> bool validate_handle_array(debug_report_data *report_data, const char *api_name, const ParameterName &count_name, const ParameterName &array_name, uint32_t count, const T *array, bool count_required, @@ -548,10 +547,9 @@ static bool validate_struct_pnext(debug_report_data *report_data, const char *ap std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check; const char disclaimer[] = - "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It " - "is possible that you are using a struct from a private extension or an extension that was added " - "to a later version of the Vulkan header, in which case your use of %s is perfectly valid but " - "is not guaranteed to work correctly with validation enabled"; + "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that you are " + "using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which " + "case your use of %s is perfectly valid but is not guaranteed to work correctly with validation enabled"; // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext. // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms. @@ -619,16 +617,16 @@ static bool validate_struct_pnext(debug_report_data *report_data, const char *ap } /** -* Validate a VkBool32 value. -* -* Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE. -* -* @param report_data debug_report_data object for routing validation messages. -* @param apiName Name of API call being validated. -* @param parameterName Name of parameter being validated. -* @param value Boolean value to validate. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate a VkBool32 value. + * + * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE. + * + * @param report_data debug_report_data object for routing validation messages. + * @param apiName Name of API call being validated. + * @param parameterName Name of parameter being validated. + * @param value Boolean value to validate. + * @return Boolean value indicating that the call should be skipped. + */ static bool validate_bool32(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, VkBool32 value) { bool skip_call = false; @@ -643,23 +641,23 @@ static bool validate_bool32(debug_report_data *report_data, const char *apiName, } /** -* Validate a Vulkan enumeration value. -* -* Generate a warning if an enumeration token value does not fall within the core enumeration -* begin and end token values, and was not added to the enumeration by an extension. Extension -* provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification, -* with 1,000,000,000 as the base token value. -* -* @note This function does not expect to process enumerations defining bitmask flag bits. -* -* @param report_data debug_report_data object for routing validation messages. -* @param apiName Name of API call being validated. -* @param parameterName Name of parameter being validated. -* @param enumName Name of the enumeration being validated. -* @param valid_values The list of valid values for the enumeration. -* @param value Enumeration value to validate. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate a Vulkan enumeration value. + * + * Generate a warning if an enumeration token value does not fall within the core enumeration + * begin and end token values, and was not added to the enumeration by an extension. Extension + * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification, + * with 1,000,000,000 as the base token value. + * + * @note This function does not expect to process enumerations defining bitmask flag bits. + * + * @param report_data debug_report_data object for routing validation messages. + * @param apiName Name of API call being validated. + * @param parameterName Name of parameter being validated. + * @param enumName Name of the enumeration being validated. + * @param valid_values The list of valid values for the enumeration. + * @param value Enumeration value to validate. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> bool validate_ranged_enum(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, const char *enumName, const std::vector<T> &valid_values, T value, UNIQUE_VALIDATION_ERROR_CODE vuid) { @@ -668,8 +666,8 @@ bool validate_ranged_enum(debug_report_data *report_data, const char *apiName, c if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, vuid, LayerName, - "%s: value of %s (%d) does not fall within the begin..end range of the core %s " - "enumeration tokens and is not an extension added token. %s", + "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is " + "not an extension added token. %s", apiName, parameterName.get_name().c_str(), value, enumName, validation_error_map[vuid]); } @@ -677,27 +675,27 @@ bool validate_ranged_enum(debug_report_data *report_data, const char *apiName, c } /** -* Validate an array of Vulkan enumeration value. -* -* Process all enumeration token values in the specified array and generate a warning if a value -* does not fall within the core enumeration begin and end token values, and was not added to -* the enumeration by an extension. Extension provided enumerations use the equation specified -* in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value. -* -* @note This function does not expect to process enumerations defining bitmask flag bits. -* -* @param report_data debug_report_data object for routing validation messages. -* @param apiName Name of API call being validated. -* @param countName Name of count parameter. -* @param arrayName Name of array parameter. -* @param enumName Name of the enumeration being validated. -* @param valid_values The list of valid values for the enumeration. -* @param count Number of enumeration values in the array. -* @param array Array of enumeration values to validate. -* @param countRequired The 'count' parameter may not be 0 when true. -* @param arrayRequired The 'array' parameter may not be NULL when true. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate an array of Vulkan enumeration value. + * + * Process all enumeration token values in the specified array and generate a warning if a value + * does not fall within the core enumeration begin and end token values, and was not added to + * the enumeration by an extension. Extension provided enumerations use the equation specified + * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value. + * + * @note This function does not expect to process enumerations defining bitmask flag bits. + * + * @param report_data debug_report_data object for routing validation messages. + * @param apiName Name of API call being validated. + * @param countName Name of count parameter. + * @param arrayName Name of array parameter. + * @param enumName Name of the enumeration being validated. + * @param valid_values The list of valid values for the enumeration. + * @param count Number of enumeration values in the array. + * @param array Array of enumeration values to validate. + * @param countRequired The 'count' parameter may not be 0 when true. + * @param arrayRequired The 'array' parameter may not be NULL when true. + * @return Boolean value indicating that the call should be skipped. + */ template <typename T> static bool validate_ranged_enum_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const char *enumName, const std::vector<T> &valid_values, @@ -723,47 +721,46 @@ static bool validate_ranged_enum_array(debug_report_data *report_data, const cha } /** -* Verify that a reserved VkFlags value is zero. -* -* Verify that the specified value is zero, to check VkFlags values that are reserved for -* future use. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param parameter_name Name of parameter being validated. -* @param value Value to validate. -* @return Boolean value indicating that the call should be skipped. -*/ + * Verify that a reserved VkFlags value is zero. + * + * Verify that the specified value is zero, to check VkFlags values that are reserved for + * future use. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param parameter_name Name of parameter being validated. + * @param value Value to validate. + * @return Boolean value indicating that the call should be skipped. + */ static bool validate_reserved_flags(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, VkFlags value, UNIQUE_VALIDATION_ERROR_CODE vuid) { bool skip_call = false; if (value != 0) { - skip_call |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - vuid, LayerName, "%s: parameter %s must be 0. %s", api_name, parameter_name.get_name().c_str(), - validation_error_map[vuid]); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, vuid, + LayerName, "%s: parameter %s must be 0. %s", api_name, parameter_name.get_name().c_str(), + validation_error_map[vuid]); } return skip_call; } /** -* Validate a Vulkan bitmask value. -* -* Generate a warning if a value with a VkFlags derived type does not contain valid flag bits -* for that type. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param parameter_name Name of parameter being validated. -* @param flag_bits_name Name of the VkFlags type being validated. -* @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated. -* @param value VkFlags value to validate. -* @param flags_required The 'value' parameter may not be 0 when true. -* @param singleFlag The 'value' parameter may not contain more than one bit from all_flags. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate a Vulkan bitmask value. + * + * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits + * for that type. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param parameter_name Name of parameter being validated. + * @param flag_bits_name Name of the VkFlags type being validated. + * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated. + * @param value VkFlags value to validate. + * @param flags_required The 'value' parameter may not be 0 when true. + * @param singleFlag The 'value' parameter may not contain more than one bit from all_flags. + * @return Boolean value indicating that the call should be skipped. + */ static bool validate_flags(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, const char *flag_bits_name, VkFlags all_flags, VkFlags value, bool flags_required, bool singleFlag, UNIQUE_VALIDATION_ERROR_CODE vuid) { @@ -772,8 +769,8 @@ static bool validate_flags(debug_report_data *report_data, const char *api_name, if (value == 0) { if (flags_required) { skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - vuid, LayerName, "%s: value of %s must not be 0. %s", api_name, - parameter_name.get_name().c_str(), validation_error_map[vuid]); + vuid, LayerName, "%s: value of %s must not be 0. %s", api_name, parameter_name.get_name().c_str(), + validation_error_map[vuid]); } } else if ((value & (~all_flags)) != 0) { skip_call |= @@ -791,23 +788,23 @@ static bool validate_flags(debug_report_data *report_data, const char *api_name, } /** -* Validate an array of Vulkan bitmask values. -* -* Generate a warning if a value with a VkFlags derived type does not contain valid flag bits -* for that type. -* -* @param report_data debug_report_data object for routing validation messages. -* @param api_name Name of API call being validated. -* @param count_name Name of parameter being validated. -* @param array_name Name of parameter being validated. -* @param flag_bits_name Name of the VkFlags type being validated. -* @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated. -* @param count Number of VkFlags values in the array. -* @param array Array of VkFlags value to validate. -* @param count_required The 'count' parameter may not be 0 when true. -* @param array_required The 'array' parameter may not be NULL when true. -* @return Boolean value indicating that the call should be skipped. -*/ + * Validate an array of Vulkan bitmask values. + * + * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits + * for that type. + * + * @param report_data debug_report_data object for routing validation messages. + * @param api_name Name of API call being validated. + * @param count_name Name of parameter being validated. + * @param array_name Name of parameter being validated. + * @param flag_bits_name Name of the VkFlags type being validated. + * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated. + * @param count Number of VkFlags values in the array. + * @param array Array of VkFlags value to validate. + * @param count_required The 'count' parameter may not be 0 when true. + * @param array_required The 'array' parameter may not be NULL when true. + * @return Boolean value indicating that the call should be skipped. + */ static bool validate_flags_array(debug_report_data *report_data, const char *api_name, const ParameterName &count_name, const ParameterName &array_name, const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array, bool count_required, bool array_required) { @@ -840,14 +837,14 @@ static bool validate_flags_array(debug_report_data *report_data, const char *api } /** -* Get VkResult code description. -* -* Returns a string describing the specified VkResult code. The description is based on the language in the Vulkan API -* specification. -* -* @param value VkResult code to process. -* @return String describing the specified VkResult code. -*/ + * Get VkResult code description. + * + * Returns a string describing the specified VkResult code. The description is based on the language in the Vulkan API + * specification. + * + * @param value VkResult code to process. + * @return String describing the specified VkResult code. + */ static std::string get_result_description(VkResult result) { // clang-format off switch (result) { @@ -887,15 +884,15 @@ static std::string get_result_description(VkResult result) { } /** -* Validate return code. -* -* Print a message describing the reason for failure when an error code is returned. -* -* @param report_data debug_report_data object for routing validation messages. -* @param apiName Name of API call being validated. -* @param ignore vector of VkResult return codes to be ignored -* @param value VkResult value to validate. -*/ + * Validate return code. + * + * Print a message describing the reason for failure when an error code is returned. + * + * @param report_data debug_report_data object for routing validation messages. + * @param apiName Name of API call being validated. + * @param ignore vector of VkResult return codes to be ignored + * @param value VkResult value to validate. + */ static void validate_result(debug_report_data *report_data, const char *apiName, std::vector<VkResult> const &ignore, VkResult result) { if (result < 0 && result != VK_ERROR_VALIDATION_FAILED_EXT) { diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp index 2c29d711c..65df05d1c 100644 --- a/layers/parameter_validation_utils.cpp +++ b/layers/parameter_validation_utils.cpp @@ -140,12 +140,12 @@ static bool ValidateDeviceQueueFamily(layer_data *device_data, uint32_t queue_fa "%s: %s is VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family index value. %s", cmd_name, parameter_name, vu_note); } else if (device_data->queueFamilyIndexMap.find(queue_family) == device_data->queueFamilyIndexMap.end()) { - skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - HandleToUint64(device_data->device), __LINE__, error_code, LayerName, - "%s: %s (= %" PRIu32 - ") is not one of the queue families given via VkDeviceQueueCreateInfo structures when " - "the device was created. %s", - cmd_name, parameter_name, queue_family, vu_note); + skip |= log_msg( + device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + HandleToUint64(device_data->device), __LINE__, error_code, LayerName, + "%s: %s (= %" PRIu32 + ") is not one of the queue families given via VkDeviceQueueCreateInfo structures when the device was created. %s", + cmd_name, parameter_name, queue_family, vu_note); } return skip; @@ -376,16 +376,15 @@ static bool ValidateDeviceCreateInfo(instance_layer_data *instance_data, VkPhysi VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, VALIDATION_ERROR_06c002fa, LayerName, "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 - "].queueFamilyIndex is " - "VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family index value. %s", + "].queueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family " + "index value. %s", i, validation_error_map[VALIDATION_ERROR_06c002fa]); } else if (set.count(requested_queue_family)) { skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__, VALIDATION_ERROR_056002e8, LayerName, "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex (=%" PRIu32 - ") is " - "not unique within pCreateInfo->pQueueCreateInfos array. %s", + ") is not unique within pCreateInfo->pQueueCreateInfos array. %s", i, requested_queue_family, validation_error_map[VALIDATION_ERROR_056002e8]); } else { set.insert(requested_queue_family); @@ -516,8 +515,8 @@ bool pv_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t qu skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, HandleToUint64(device), __LINE__, VALIDATION_ERROR_29600302, LayerName, "vkGetDeviceQueue: queueIndex (=%" PRIu32 - ") is not less than the number of queues requested from " - "queueFamilyIndex (=%" PRIu32 ") when the device was created (i.e. is not less than %" PRIu32 "). %s", + ") is not less than the number of queues requested from queueFamilyIndex (=%" PRIu32 + ") when the device was created (i.e. is not less than %" PRIu32 "). %s", queueIndex, queueFamilyIndex, queue_data->second, validation_error_map[VALIDATION_ERROR_29600302]); } return skip; @@ -558,9 +557,9 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryP ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_11c00630, LayerName, - "vkCreateQueryPool(): if pCreateInfo->queryType is " - "VK_QUERY_TYPE_PIPELINE_STATISTICS, pCreateInfo->pipelineStatistics must be " - "a valid combination of VkQueryPipelineStatisticFlagBits values. %s", + "vkCreateQueryPool(): if pCreateInfo->queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, " + "pCreateInfo->pipelineStatistics must be a valid combination of VkQueryPipelineStatisticFlagBits " + "values. %s", validation_error_map[VALIDATION_ERROR_11c00630]); } } @@ -716,19 +715,18 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con if ((device_data->physical_device_features.textureCompressionASTC_LDR == false) && FormatIsCompressed_ASTC_LDR(pCreateInfo->format)) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - DEVICE_FEATURE, LayerName, - "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionASTC_LDR feature is " - "not enabled: ASTC formats cannot be used to create images.", - string_VkFormat(pCreateInfo->format)); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + DEVICE_FEATURE, LayerName, + "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionASTC_LDR feature " + "is not enabled: ASTC formats cannot be used to create images.", + string_VkFormat(pCreateInfo->format)); } if ((device_data->physical_device_features.textureCompressionBC == false) && FormatIsCompressed_BC(pCreateInfo->format)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, DEVICE_FEATURE, LayerName, - "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionBC feature is " - "not enabled: BC compressed formats cannot be used to create images.", + "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionBC feature is not " + "enabled: BC compressed formats cannot be used to create images.", string_VkFormat(pCreateInfo->format)); } @@ -784,8 +782,8 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && (pCreateInfo->extent.height != 1) && (pCreateInfo->extent.depth != 1)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_09e00778, LayerName, - "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both " - "pCreateInfo->extent.height and pCreateInfo->extent.depth must be 1. %s", + "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both pCreateInfo->extent.height and " + "pCreateInfo->extent.depth must be 1. %s", validation_error_map[VALIDATION_ERROR_09e00778]); } @@ -796,9 +794,9 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con (pCreateInfo->extent.width != pCreateInfo->extent.height)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_09e00774, LayerName, - "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and " - "pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, " - "pCreateInfo->extent.width and pCreateInfo->extent.height must be equal. %s", + "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and pCreateInfo->flags contains " + "VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, pCreateInfo->extent.width and pCreateInfo->extent.height " + "must be equal. %s", validation_error_map[VALIDATION_ERROR_09e00774]); } @@ -878,8 +876,8 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con if (VK_IMAGE_TILING_LINEAR == pCreateInfo->tiling) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, LayerName, - "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT " - "then image tiling of VK_IMAGE_TILING_LINEAR is not supported"); + "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then image " + "tiling of VK_IMAGE_TILING_LINEAR is not supported"); } // Sparse 1D image isn't valid @@ -914,36 +912,32 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con if (VK_IMAGE_TYPE_2D == pCreateInfo->imageType) { if ((VK_FALSE == device_data->physical_device_features.sparseResidency2Samples) && (VK_SAMPLE_COUNT_2_BIT == pCreateInfo->samples)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_09e0079a, LayerName, - "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if corresponding " - "feature is not enabled on the device. %s", - validation_error_map[VALIDATION_ERROR_09e0079a]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_09e0079a, LayerName, + "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if " + "corresponding feature is not enabled on the device. %s", + validation_error_map[VALIDATION_ERROR_09e0079a]); } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency4Samples) && (VK_SAMPLE_COUNT_4_BIT == pCreateInfo->samples)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_09e0079c, LayerName, - "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if corresponding " - "feature is not enabled on the device. %s", - validation_error_map[VALIDATION_ERROR_09e0079c]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_09e0079c, LayerName, + "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if " + "corresponding feature is not enabled on the device. %s", + validation_error_map[VALIDATION_ERROR_09e0079c]); } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency8Samples) && (VK_SAMPLE_COUNT_8_BIT == pCreateInfo->samples)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_09e0079e, LayerName, - "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if corresponding " - "feature is not enabled on the device. %s", - validation_error_map[VALIDATION_ERROR_09e0079e]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_09e0079e, LayerName, + "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if " + "corresponding feature is not enabled on the device. %s", + validation_error_map[VALIDATION_ERROR_09e0079e]); } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency16Samples) && (VK_SAMPLE_COUNT_16_BIT == pCreateInfo->samples)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_09e007a0, LayerName, - "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if corresponding " - "feature is not enabled on the device. %s", - validation_error_map[VALIDATION_ERROR_09e007a0]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_09e007a0, LayerName, + "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if " + "corresponding feature is not enabled on the device. %s", + validation_error_map[VALIDATION_ERROR_09e007a0]); } } } @@ -1286,8 +1280,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, __LINE__, EXTENSION_NOT_ENABLED, LayerName, "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 - "].pDynamicState->pDynamicStates " - "contains VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, but " + "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, but " "VK_NV_clip_space_w_scaling extension is not enabled.", i); } @@ -1296,8 +1289,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, __LINE__, EXTENSION_NOT_ENABLED, LayerName, "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 - "].pDynamicState->pDynamicStates " - "contains VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, but " + "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, but " "VK_EXT_discard_rectangles extension is not enabled.", i); } @@ -1306,8 +1298,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, __LINE__, EXTENSION_NOT_ENABLED, LayerName, "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 - "].pDynamicState->pDynamicStates " - "contains VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, but " + "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, but " "VK_EXT_sample_locations extension is not enabled.", i); } @@ -1324,8 +1315,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache LvlTypeMap<VkPipelineCoverageToColorStateCreateInfoNV>::kSType, LvlTypeMap<VkPipelineSampleLocationsStateCreateInfoEXT>::kSType}; const char *valid_struct_names = - "VkPipelineCoverageModulationStateCreateInfoNV, " - "VkPipelineCoverageToColorStateCreateInfoNV, " + "VkPipelineCoverageModulationStateCreateInfoNV, VkPipelineCoverageToColorStateCreateInfoNV, " "VkPipelineSampleLocationsStateCreateInfoEXT"; skip |= validate_struct_pnext( report_data, "vkCreateGraphicsPipelines", @@ -1604,26 +1594,23 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { if (pCreateInfos[i].basePipelineIndex != -1) { if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_096005a8, LayerName, - "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be VK_NULL_HANDLE if " - "pCreateInfos->flags " - "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1. %s", - validation_error_map[VALIDATION_ERROR_096005a8]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_096005a8, LayerName, + "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be " + "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " + "and pCreateInfos->basePipelineIndex is not -1. %s", + validation_error_map[VALIDATION_ERROR_096005a8]); } } if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { if (pCreateInfos[i].basePipelineIndex != -1) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_096005aa, LayerName, - "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if " - "pCreateInfos->flags " - "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineHandle is not " - "VK_NULL_HANDLE. %s", - validation_error_map[VALIDATION_ERROR_096005aa]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_096005aa, LayerName, + "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if " + "pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and " + "pCreateInfos->basePipelineHandle is not VK_NULL_HANDLE. %s", + validation_error_map[VALIDATION_ERROR_096005aa]); } } } @@ -1631,12 +1618,11 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache if (pCreateInfos[i].pRasterizationState) { if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && (device_data->physical_device_features.fillModeNonSolid == false)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - DEVICE_FEATURE, LayerName, - "vkCreateGraphicsPipelines parameter, VkPolygonMode pCreateInfos->pRasterizationState->polygonMode cannot " - "be " - "VK_POLYGON_MODE_POINT or VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, DEVICE_FEATURE, LayerName, + "vkCreateGraphicsPipelines parameter, VkPolygonMode " + "pCreateInfos->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_POINT or " + "VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); } if (!has_dynamic_line_width && !device_data->physical_device_features.wideLines && @@ -1709,8 +1695,8 @@ bool pv_vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, if (pCreateInfo->unnormalizedCoordinates == VK_TRUE) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_12600868, LayerName, - "vkCreateSampler(): pCreateInfo->anisotropyEnable and pCreateInfo->unnormalizedCoordinates " - "must not both be VK_TRUE. %s", + "vkCreateSampler(): pCreateInfo->anisotropyEnable and pCreateInfo->unnormalizedCoordinates must " + "not both be VK_TRUE. %s", validation_error_map[VALIDATION_ERROR_12600868]); } } @@ -1748,12 +1734,11 @@ bool pv_vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, if (device_data->extensions.vk_img_filter_cubic) { if ((pCreateInfo->anisotropyEnable == VK_TRUE) && ((pCreateInfo->minFilter == VK_FILTER_CUBIC_IMG) || (pCreateInfo->magFilter == VK_FILTER_CUBIC_IMG))) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_12600872, LayerName, - "vkCreateSampler(): Anisotropic sampling must not be VK_TRUE when either minFilter or magFilter are " - "VK_FILTER_CUBIC_IMG. %s", - validation_error_map[VALIDATION_ERROR_12600872]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_12600872, LayerName, + "vkCreateSampler(): Anisotropic sampling must not be VK_TRUE when either minFilter or magFilter " + "are VK_FILTER_CUBIC_IMG. %s", + validation_error_map[VALIDATION_ERROR_12600872]); } } } @@ -1783,8 +1768,7 @@ bool pv_vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayout skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, REQUIRED_PARAMETER, LayerName, "vkCreateDescriptorSetLayout: required parameter " - "pCreateInfo->pBindings[%d].pImmutableSamplers[%d]" - " specified as VK_NULL_HANDLE", + "pCreateInfo->pBindings[%d].pImmutableSamplers[%d] specified as VK_NULL_HANDLE", i, descriptor_index); } } @@ -1793,12 +1777,12 @@ bool pv_vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayout // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values if ((pCreateInfo->pBindings[i].stageFlags != 0) && ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { - skip |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_04e00236, LayerName, - "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0, " - "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits values. %s", - i, i, validation_error_map[VALIDATION_ERROR_04e00236]); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_04e00236, LayerName, + "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0, " + "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits " + "values. %s", + i, i, validation_error_map[VALIDATION_ERROR_04e00236]); } } } @@ -2064,9 +2048,6 @@ bool pv_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, bool skip = false; layer_data *device_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); - skip |= validate_array(device_data->report_data, "vkCmdSetViewport", "viewportCount", "pViewports", viewportCount, pViewports, - true, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); - if (viewportCount > 0 && pViewports != nullptr) { const VkPhysicalDeviceLimits &limits = device_data->device_limits; for (uint32_t viewportIndex = 0; viewportIndex < viewportCount; ++viewportIndex) { @@ -2075,17 +2056,17 @@ bool pv_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, if (device_data->physical_device_features.multiViewport == false) { if (viewportCount != 1) { skip |= log_msg( - device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, DEVICE_FEATURE, LayerName, - "vkCmdSetViewport(): The multiViewport feature is not enabled, so viewportCount must be 1 but is %d.", - viewportCount); + device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + VALIDATION_ERROR_1e000992, __LINE__, DEVICE_FEATURE, LayerName, + "vkCmdSetViewport(): The multiViewport feature is not enabled, so viewportCount must be 1 but is %d. %s", + viewportCount, validation_error_map[VALIDATION_ERROR_1e000992]); } if (firstViewport != 0) { skip |= log_msg( - device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, DEVICE_FEATURE, LayerName, - "vkCmdSetViewport(): The multiViewport feature is not enabled, so firstViewport must be 0 but is %d.", - firstViewport); + device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + VALIDATION_ERROR_1e000990, __LINE__, DEVICE_FEATURE, LayerName, + "vkCmdSetViewport(): The multiViewport feature is not enabled, so firstViewport must be 0 but is %d. %s", + firstViewport, validation_error_map[VALIDATION_ERROR_1e000990]); } } @@ -2318,11 +2299,10 @@ bool pv_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer if (pRegions != nullptr) { if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - skip |= log_msg( - device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - UNRECOGNIZED_VALUE, LayerName, - "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " - "enumerator"); + skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, UNRECOGNIZED_VALUE, LayerName, + "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an " + "unrecognized enumerator"); } } return skip; @@ -2455,12 +2435,12 @@ bool pv_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pC if (pCreateInfo != nullptr) { if ((device_data->physical_device_features.textureCompressionETC2 == false) && FormatIsCompressed_ETC2_EAC(pCreateInfo->imageFormat)) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - DEVICE_FEATURE, LayerName, - "vkCreateSwapchainKHR(): Attempting to create swapchain VkImage with format %s. The " - "textureCompressionETC2 feature is not enabled: neither ETC2 nor EAC formats can be used to create " - "images.", - string_VkFormat(pCreateInfo->imageFormat)); + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + DEVICE_FEATURE, LayerName, + "vkCreateSwapchainKHR(): Attempting to create swapchain VkImage with format %s. The textureCompressionETC2 " + "feature is not enabled: neither ETC2 nor EAC formats can be used to create images.", + string_VkFormat(pCreateInfo->imageFormat)); } if ((device_data->physical_device_features.textureCompressionASTC_LDR == false) && @@ -2529,8 +2509,8 @@ bool pv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { if (present_regions->swapchainCount != pPresentInfo->swapchainCount) { skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, LayerName, - "QueuePresentKHR(): pPresentInfo->swapchainCount has a value of %i" - " but VkPresentRegionsKHR extension swapchainCount is %i. These values must be equal.", + "QueuePresentKHR(): pPresentInfo->swapchainCount has a value of %i but VkPresentRegionsKHR " + "extension swapchainCount is %i. These values must be equal.", pPresentInfo->swapchainCount, present_regions->swapchainCount); } skip |= validate_struct_pnext(device_data->report_data, "QueuePresentKHR", "pCreateInfo->pNext->pNext", NULL, @@ -2655,8 +2635,7 @@ bool pv_vkCmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_19e00350, LayerName, "vkCmdDispatchBaseKHX(): baseGroupX (%" PRIu32 ") + groupCountX (%" PRIu32 - ") exceeds device limit " - "maxComputeWorkGroupCount[0] (%" PRIu32 "). %s", + ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 "). %s", baseGroupX, groupCountX, limit, validation_error_map[VALIDATION_ERROR_19e00350]); } @@ -2671,8 +2650,7 @@ bool pv_vkCmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_19e00352, LayerName, "vkCmdDispatchBaseKHX(): baseGroupY (%" PRIu32 ") + groupCountY (%" PRIu32 - ") exceeds device limit " - "maxComputeWorkGroupCount[1] (%" PRIu32 "). %s", + ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 "). %s", baseGroupY, groupCountY, limit, validation_error_map[VALIDATION_ERROR_19e00352]); } @@ -2687,8 +2665,7 @@ bool pv_vkCmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_19e00354, LayerName, "vkCmdDispatchBaseKHX(): baseGroupZ (%" PRIu32 ") + groupCountZ (%" PRIu32 - ") exceeds device limit " - "maxComputeWorkGroupCount[2] (%" PRIu32 "). %s", + ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 "). %s", baseGroupZ, groupCountZ, limit, validation_error_map[VALIDATION_ERROR_19e00354]); } diff --git a/layers/shader_validation.cpp b/layers/shader_validation.cpp index 41885563f..aa3ec8a4b 100644 --- a/layers/shader_validation.cpp +++ b/layers/shader_validation.cpp @@ -314,27 +314,27 @@ static bool types_match(shader_module const *a, shader_module const *b, unsigned case spv::OpTypeMatrix: // Match on element type, count. return types_match(a, b, a_insn.word(2), b_insn.word(2), a_arrayed, b_arrayed, false) && - a_insn.word(3) == b_insn.word(3); + a_insn.word(3) == b_insn.word(3); case spv::OpTypeArray: // Match on element type, count. these all have the same layout. we don't get here if b_arrayed. This differs from // vector & matrix types in that the array size is the id of a constant instruction, * not a literal within OpTypeArray return types_match(a, b, a_insn.word(2), b_insn.word(2), a_arrayed, b_arrayed, false) && - get_constant_value(a, a_insn.word(3)) == get_constant_value(b, b_insn.word(3)); + get_constant_value(a, a_insn.word(3)) == get_constant_value(b, b_insn.word(3)); case spv::OpTypeStruct: // Match on all element types - { - if (a_insn.len() != b_insn.len()) { - return false; // Structs cannot match if member counts differ - } + { + if (a_insn.len() != b_insn.len()) { + return false; // Structs cannot match if member counts differ + } - for (unsigned i = 2; i < a_insn.len(); i++) { - if (!types_match(a, b, a_insn.word(i), b_insn.word(i), a_arrayed, b_arrayed, false)) { - return false; + for (unsigned i = 2; i < a_insn.len(); i++) { + if (!types_match(a, b, a_insn.word(i), b_insn.word(i), a_arrayed, b_arrayed, false)) { + return false; + } } - } - return true; - } + return true; + } default: // Remaining types are CLisms, or may not appear in the interfaces we are interested in. Just claim no match. return false; @@ -398,14 +398,10 @@ static unsigned get_locations_consumed_by_format(VkFormat format) { } static unsigned get_format_type(VkFormat fmt) { - if (FormatIsSInt(fmt)) - return FORMAT_TYPE_SINT; - if (FormatIsUInt(fmt)) - return FORMAT_TYPE_UINT; - if (FormatIsDepthAndStencil(fmt)) - return FORMAT_TYPE_FLOAT | FORMAT_TYPE_UINT; - if (fmt == VK_FORMAT_UNDEFINED) - return 0; + if (FormatIsSInt(fmt)) return FORMAT_TYPE_SINT; + if (FormatIsUInt(fmt)) return FORMAT_TYPE_UINT; + if (FormatIsDepthAndStencil(fmt)) return FORMAT_TYPE_FLOAT | FORMAT_TYPE_UINT; + if (fmt == VK_FORMAT_UNDEFINED) return 0; // everything else -- UNORM/SNORM/FLOAT/USCALED/SSCALED is all float in the shader. return FORMAT_TYPE_FLOAT; } @@ -504,7 +500,7 @@ static bool collect_interface_block_members(shader_module const *src, std::map<l auto component_it = member_components.find(member_index); unsigned component = component_it == member_components.end() ? 0 : component_it->second; bool is_relaxed_precision = member_relaxed_precision.find(member_index) != member_relaxed_precision.end(); - bool member_is_patch = is_patch || member_patch.count(member_index)>0; + bool member_is_patch = is_patch || member_patch.count(member_index) > 0; for (unsigned int offset = 0; offset < num_locations; offset++) { interface_var v = {}; @@ -591,7 +587,8 @@ static std::map<location_t, interface_var> collect_interface_by_location(shader_ bool is_patch = var_patch.find(id) != var_patch.end(); bool is_relaxed_precision = var_relaxed_precision.find(id) != var_relaxed_precision.end(); - if (builtin != -1) continue; + if (builtin != -1) + continue; else if (!collect_interface_block_members(src, &out, blocks, is_array_of_verts, id, type, is_patch, location)) { // A user-defined interface variable, with a location. Where a variable occupied multiple locations, emit // one result for each. @@ -684,8 +681,6 @@ static std::vector<std::pair<descriptor_slot_t, interface_var>> collect_interfac return out; } - - static bool validate_vi_consistency(debug_report_data const *report_data, VkPipelineVertexInputStateCreateInfo const *vi) { // Walk the binding descriptions, which describe the step rate and stride of each vertex buffer. Each binding should // be specified only once. @@ -975,11 +970,11 @@ static bool validate_push_constant_block_against_pipeline(debug_report_data cons found_range = true; if ((range.stageFlags & stage) == 0) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, SHADER_CHECKER_PUSH_CONSTANT_NOT_ACCESSIBLE_FROM_STAGE, "SC", - "Push constant range covering variable starting at " - "offset %u not accessible from stage %s", - offset, string_VkShaderStageFlagBits(stage)); + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, SHADER_CHECKER_PUSH_CONSTANT_NOT_ACCESSIBLE_FROM_STAGE, "SC", + "Push constant range covering variable starting at offset %u not accessible from stage %s", + offset, string_VkShaderStageFlagBits(stage)); } break; @@ -989,9 +984,7 @@ static bool validate_push_constant_block_against_pipeline(debug_report_data cons if (!found_range) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_PUSH_CONSTANT_OUT_OF_RANGE, "SC", - "Push constant range covering variable starting at " - "offset %u not declared in layout", - offset); + "Push constant range covering variable starting at offset %u not declared in layout", offset); } } } @@ -1028,12 +1021,11 @@ static bool validate_specialization_offsets(debug_report_data const *report_data if (spec->pMapEntries[i].offset + spec->pMapEntries[i].size > spec->dataSize) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0, __LINE__, VALIDATION_ERROR_1360060c, "SC", - "Specialization entry %u (for constant id %u) references memory outside provided " - "specialization data (bytes %u.." PRINTF_SIZE_T_SPECIFIER "; " PRINTF_SIZE_T_SPECIFIER - " bytes provided). %s.", - i, spec->pMapEntries[i].constantID, spec->pMapEntries[i].offset, - spec->pMapEntries[i].offset + spec->pMapEntries[i].size - 1, spec->dataSize, - validation_error_map[VALIDATION_ERROR_1360060c]); + "Specialization entry %u (for constant id %u) references memory outside provided specialization " + "data (bytes %u.." PRINTF_SIZE_T_SPECIFIER "; " PRINTF_SIZE_T_SPECIFIER " bytes provided). %s.", + i, spec->pMapEntries[i].constantID, spec->pMapEntries[i].offset, + spec->pMapEntries[i].offset + spec->pMapEntries[i].size - 1, spec->dataSize, + validation_error_map[VALIDATION_ERROR_1360060c]); } } } @@ -1063,10 +1055,10 @@ static bool descriptor_type_match(shader_module const *module, uint32_t type_id, if (insn.opcode() == spv::OpDecorate && insn.word(1) == type.word(1)) { if (insn.word(2) == spv::DecorationBlock) { return descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || - descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; + descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; } else if (insn.word(2) == spv::DecorationBufferBlock) { return descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER || - descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; + descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; } } } @@ -1105,7 +1097,7 @@ static bool descriptor_type_match(shader_module const *module, uint32_t type_id, } } else if (sampled == 1) { return descriptor_type == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE || - descriptor_type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + descriptor_type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; } else { return descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; } @@ -1121,9 +1113,7 @@ static bool require_feature(debug_report_data const *report_data, VkBool32 featu if (!feature) { if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC", - "Shader requires VkPhysicalDeviceFeatures::%s but is not " - "enabled on the device", - feature_name)) { + "Shader requires VkPhysicalDeviceFeatures::%s but is not enabled on the device", feature_name)) { return true; } } @@ -1134,9 +1124,7 @@ static bool require_feature(debug_report_data const *report_data, VkBool32 featu static bool require_extension(debug_report_data const *report_data, bool extension, char const *extension_name) { if (!extension) { if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC", - "Shader requires extension %s but is not " - "enabled on the device", + SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC", "Shader requires extension %s but is not enabled on the device", extension_name)) { return true; } @@ -1149,8 +1137,8 @@ static bool validate_shader_capabilities(layer_data *dev_data, shader_module con bool skip = false; auto report_data = GetReportData(dev_data); - auto const & enabledFeatures = GetEnabledFeatures(dev_data); - auto const & extensions = GetEnabledExtensions(dev_data); + auto const &enabledFeatures = GetEnabledFeatures(dev_data); + auto const &extensions = GetEnabledExtensions(dev_data); struct CapabilityInfo { char const *name; @@ -1284,7 +1272,7 @@ static uint32_t descriptor_type_to_reqs(shader_module const *module, uint32_t ty return arrayed ? DESCRIPTOR_REQ_VIEW_TYPE_1D_ARRAY : DESCRIPTOR_REQ_VIEW_TYPE_1D; case spv::Dim2D: return (msaa ? DESCRIPTOR_REQ_MULTI_SAMPLE : DESCRIPTOR_REQ_SINGLE_SAMPLE) | - (arrayed ? DESCRIPTOR_REQ_VIEW_TYPE_2D_ARRAY : DESCRIPTOR_REQ_VIEW_TYPE_2D); + (arrayed ? DESCRIPTOR_REQ_VIEW_TYPE_2D_ARRAY : DESCRIPTOR_REQ_VIEW_TYPE_2D); case spv::Dim3D: return DESCRIPTOR_REQ_VIEW_TYPE_3D; case spv::DimCube: @@ -1312,10 +1300,9 @@ static VkDescriptorSetLayoutBinding const *get_descriptor_binding(PIPELINE_LAYOU return pipelineLayout->set_layouts[slot.first]->GetDescriptorSetLayoutBindingPtrFromBinding(slot.second); } - -static bool validate_pipeline_shader_stage( - layer_data *dev_data, VkPipelineShaderStageCreateInfo const *pStage, PIPELINE_STATE *pipeline, - shader_module const **out_module, spirv_inst_iter *out_entrypoint) { +static bool validate_pipeline_shader_stage(layer_data *dev_data, VkPipelineShaderStageCreateInfo const *pStage, + PIPELINE_STATE *pipeline, shader_module const **out_module, + spirv_inst_iter *out_entrypoint) { bool skip = false; auto module = *out_module = GetShaderModuleState(dev_data, pStage->module); auto report_data = GetReportData(dev_data); @@ -1342,7 +1329,8 @@ static bool validate_pipeline_shader_stage( auto descriptor_uses = collect_interface_by_descriptor_slot(report_data, module, accessible_ids); skip |= validate_specialization_offsets(report_data, pStage); - skip |= validate_push_constant_usage(report_data, &pipeline->pipeline_layout.push_constant_ranges, module, accessible_ids, pStage->stage); + skip |= validate_push_constant_usage(report_data, &pipeline->pipeline_layout.push_constant_ranges, module, accessible_ids, + pStage->stage); // Validate descriptor use for (auto use : descriptor_uses) { @@ -1362,18 +1350,14 @@ static bool validate_pipeline_shader_stage( } else if (~binding->stageFlags & pStage->stage) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0, __LINE__, SHADER_CHECKER_DESCRIPTOR_NOT_ACCESSIBLE_FROM_STAGE, "SC", - "Shader uses descriptor slot %u.%u (used " - "as type `%s`) but descriptor not " - "accessible from stage %s", + "Shader uses descriptor slot %u.%u (used as type `%s`) but descriptor not accessible from stage %s", use.first.first, use.first.second, describe_type(module, use.second.type_id).c_str(), string_VkShaderStageFlagBits(pStage->stage)); } else if (!descriptor_type_match(module, use.second.type_id, binding->descriptorType, required_descriptor_count)) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_DESCRIPTOR_TYPE_MISMATCH, "SC", - "Type mismatch on descriptor slot " - "%u.%u (used as type `%s`) but " - "descriptor of type %s", - use.first.first, use.first.second, describe_type(module, use.second.type_id).c_str(), + "Type mismatch on descriptor slot %u.%u (used as type `%s`) but descriptor of type %s", use.first.first, + use.first.second, describe_type(module, use.second.type_id).c_str(), string_VkDescriptorType(binding->descriptorType)); } else if (binding->descriptorCount < required_descriptor_count) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, @@ -1394,8 +1378,8 @@ static bool validate_pipeline_shader_stage( for (auto use : input_attachment_uses) { auto input_attachments = rpci->pSubpasses[subpass].pInputAttachments; auto index = (input_attachments && use.first < rpci->pSubpasses[subpass].inputAttachmentCount) - ? input_attachments[use.first].attachment - : VK_ATTACHMENT_UNUSED; + ? input_attachments[use.first].attachment + : VK_ATTACHMENT_UNUSED; if (index == VK_ATTACHMENT_UNUSED) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, @@ -1462,8 +1446,7 @@ static bool validate_interface_between_stages(debug_report_data const *report_da if (a_it->second.is_patch != b_it->second.is_patch) { skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0, __LINE__, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC", - "Decoration mismatch on location %u.%u: is per-%s in %s stage but " - "per-%s in %s stage", + "Decoration mismatch on location %u.%u: is per-%s in %s stage but per-%s in %s stage", a_first.first, a_first.second, a_it->second.is_patch ? "patch" : "vertex", producer_stage->name, b_it->second.is_patch ? "patch" : "vertex", consumer_stage->name); } @@ -1534,8 +1517,8 @@ bool validate_and_capture_pipeline_shader_state(layer_data *dev_data, PIPELINE_S } if (shaders[fragment_stage] && shaders[fragment_stage]->has_valid_spirv) { - skip |= validate_fs_outputs_against_render_pass(report_data, shaders[fragment_stage], entrypoints[fragment_stage], - pipeline, pCreateInfo->subpass); + skip |= validate_fs_outputs_against_render_pass(report_data, shaders[fragment_stage], entrypoints[fragment_stage], pipeline, + pCreateInfo->subpass); } return skip; @@ -1550,12 +1533,9 @@ bool validate_compute_pipeline(layer_data *dev_data, PIPELINE_STATE *pipeline) { return validate_pipeline_shader_stage(dev_data, &pCreateInfo->stage, pipeline, &module, &entrypoint); } -uint32_t ValidationCache::MakeShaderHash(VkShaderModuleCreateInfo const *smci) { - return XXH32(smci->pCode, smci->codeSize, 0); -} +uint32_t ValidationCache::MakeShaderHash(VkShaderModuleCreateInfo const *smci) { return XXH32(smci->pCode, smci->codeSize, 0); } -static ValidationCache *GetValidationCacheInfo( - VkShaderModuleCreateInfo const *pCreateInfo) { +static ValidationCache *GetValidationCacheInfo(VkShaderModuleCreateInfo const *pCreateInfo) { while ((pCreateInfo = (VkShaderModuleCreateInfo const *)pCreateInfo->pNext) != nullptr) { if (pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT) return (ValidationCache *)((VkShaderModuleValidationCacheCreateInfoEXT const *)pCreateInfo)->validationCache; @@ -1576,8 +1556,8 @@ bool PreCallValidateCreateShaderModule(layer_data *dev_data, VkShaderModuleCreat auto have_glsl_shader = GetEnabledExtensions(dev_data)->vk_nv_glsl_shader; if (!have_glsl_shader && (pCreateInfo->codeSize % 4)) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - __LINE__, VALIDATION_ERROR_12a00ac0, "SC", + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_12a00ac0, "SC", "SPIR-V module not valid: Codesize must be a multiple of 4 but is " PRINTF_SIZE_T_SPECIFIER ". %s", pCreateInfo->codeSize, validation_error_map[VALIDATION_ERROR_12a00ac0]); } else { @@ -1585,22 +1565,21 @@ bool PreCallValidateCreateShaderModule(layer_data *dev_data, VkShaderModuleCreat uint32_t hash = 0; if (cache) { hash = ValidationCache::MakeShaderHash(pCreateInfo); - if (cache->Contains(hash)) - return false; + if (cache->Contains(hash)) return false; } // Use SPIRV-Tools validator to try and catch any issues with the module itself spv_context ctx = spvContextCreate(SPV_ENV_VULKAN_1_0); - spv_const_binary_t binary{ pCreateInfo->pCode, pCreateInfo->codeSize / sizeof(uint32_t) }; + spv_const_binary_t binary{pCreateInfo->pCode, pCreateInfo->codeSize / sizeof(uint32_t)}; spv_diagnostic diag = nullptr; spv_valid = spvValidate(ctx, &binary, &diag); if (spv_valid != SPV_SUCCESS) { if (!have_glsl_shader || (pCreateInfo->pCode[0] == spv::MagicNumber)) { - skip |= log_msg(report_data, - spv_valid == SPV_WARNING ? VK_DEBUG_REPORT_WARNING_BIT_EXT : VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_INCONSISTENT_SPIRV, "SC", - "SPIR-V module not valid: %s", diag && diag->error ? diag->error : "(no error text)"); + skip |= + log_msg(report_data, spv_valid == SPV_WARNING ? VK_DEBUG_REPORT_WARNING_BIT_EXT : VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, SHADER_CHECKER_INCONSISTENT_SPIRV, "SC", + "SPIR-V module not valid: %s", diag && diag->error ? diag->error : "(no error text)"); } } else { if (cache) { diff --git a/layers/shader_validation.h b/layers/shader_validation.h index 2f10dcab4..10d97655a 100644 --- a/layers/shader_validation.h +++ b/layers/shader_validation.h @@ -110,7 +110,7 @@ class ValidationCache { std::unordered_set<uint32_t> good_shader_hashes; ValidationCache() {} -public: + public: static VkValidationCacheEXT Create(VkValidationCacheCreateInfoEXT const *pCreateInfo) { auto cache = new ValidationCache(); cache->Load(pCreateInfo); @@ -120,29 +120,24 @@ public: void Load(VkValidationCacheCreateInfoEXT const *pCreateInfo) { const auto headerSize = 2 * sizeof(uint32_t) + VK_UUID_SIZE; auto size = headerSize; - if (!pCreateInfo->pInitialData || pCreateInfo->initialDataSize < size) - return; + if (!pCreateInfo->pInitialData || pCreateInfo->initialDataSize < size) return; uint32_t const *data = (uint32_t const *)pCreateInfo->pInitialData; - if (data[0] != size) - return; - if (data[1] != VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT) - return; + if (data[0] != size) return; + if (data[1] != VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT) return; uint8_t expected_uuid[VK_UUID_SIZE]; Sha1ToVkUuid(SPIRV_TOOLS_COMMIT_ID, expected_uuid); - if (memcmp(&data[2], expected_uuid, VK_UUID_SIZE) != 0) - return; // different version + if (memcmp(&data[2], expected_uuid, VK_UUID_SIZE) != 0) return; // different version - data = (uint32_t const*)(reinterpret_cast<uint8_t const *>(data) + headerSize); + data = (uint32_t const *)(reinterpret_cast<uint8_t const *>(data) + headerSize); - for (;size < pCreateInfo->initialDataSize; - data++, size += sizeof(uint32_t)) { + for (; size < pCreateInfo->initialDataSize; data++, size += sizeof(uint32_t)) { good_shader_hashes.insert(*data); } } void Write(size_t *pDataSize, void *pData) { - const auto headerSize = 2*sizeof(uint32_t) + VK_UUID_SIZE; // 4 bytes for header size + 4 bytes for version number + UUID + const auto headerSize = 2 * sizeof(uint32_t) + VK_UUID_SIZE; // 4 bytes for header size + 4 bytes for version number + UUID if (!pData) { *pDataSize = headerSize + good_shader_hashes.size() * sizeof(uint32_t); return; @@ -150,7 +145,7 @@ public: if (*pDataSize < headerSize) { *pDataSize = 0; - return; // Too small for even the header! + return; // Too small for even the header! } uint32_t *out = (uint32_t *)pData; @@ -159,11 +154,10 @@ public: // Write the header *out++ = headerSize; *out++ = VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT; - Sha1ToVkUuid(SPIRV_TOOLS_COMMIT_ID, reinterpret_cast<uint8_t*>(out)); - out = (uint32_t*)(reinterpret_cast<uint8_t*>(out) + VK_UUID_SIZE); + Sha1ToVkUuid(SPIRV_TOOLS_COMMIT_ID, reinterpret_cast<uint8_t *>(out)); + out = (uint32_t *)(reinterpret_cast<uint8_t *>(out) + VK_UUID_SIZE); - for (auto it = good_shader_hashes.begin(); - it != good_shader_hashes.end() && actualSize < *pDataSize; + for (auto it = good_shader_hashes.begin(); it != good_shader_hashes.end() && actualSize < *pDataSize; it++, out++, actualSize += sizeof(uint32_t)) { *out = *it; } @@ -173,32 +167,28 @@ public: void Merge(ValidationCache const *other) { good_shader_hashes.reserve(good_shader_hashes.size() + other->good_shader_hashes.size()); - for (auto h : other->good_shader_hashes) - good_shader_hashes.insert(h); + for (auto h : other->good_shader_hashes) good_shader_hashes.insert(h); } static uint32_t MakeShaderHash(VkShaderModuleCreateInfo const *smci); - bool Contains(uint32_t hash) { - return good_shader_hashes.count(hash) != 0; - } - - void Insert(uint32_t hash) { - good_shader_hashes.insert(hash); - } -private: - void Sha1ToVkUuid(const char* sha1_str, uint8_t uuid[VK_UUID_SIZE]) { - // Convert sha1_str from a hex string to binary. We only need VK_UUID_BYTES of - // output, so pad with zeroes if the input string is shorter than that, and truncate - // if it's longer. - char padded_sha1_str[2 * VK_UUID_SIZE + 1] = {}; - strncpy(padded_sha1_str, sha1_str, 2 * VK_UUID_SIZE + 1); - char byte_str[3] = {}; - for (uint32_t i = 0; i < VK_UUID_SIZE; ++i) { - byte_str[0] = padded_sha1_str[2 * i + 0]; - byte_str[1] = padded_sha1_str[2 * i + 1]; - uuid[i] = static_cast<uint8_t>(strtol(byte_str, NULL, 16)); - } + bool Contains(uint32_t hash) { return good_shader_hashes.count(hash) != 0; } + + void Insert(uint32_t hash) { good_shader_hashes.insert(hash); } + + private: + void Sha1ToVkUuid(const char *sha1_str, uint8_t uuid[VK_UUID_SIZE]) { + // Convert sha1_str from a hex string to binary. We only need VK_UUID_BYTES of + // output, so pad with zeroes if the input string is shorter than that, and truncate + // if it's longer. + char padded_sha1_str[2 * VK_UUID_SIZE + 1] = {}; + strncpy(padded_sha1_str, sha1_str, 2 * VK_UUID_SIZE + 1); + char byte_str[3] = {}; + for (uint32_t i = 0; i < VK_UUID_SIZE; ++i) { + byte_str[0] = padded_sha1_str[2 * i + 0]; + byte_str[1] = padded_sha1_str[2 * i + 1]; + uuid[i] = static_cast<uint8_t>(strtol(byte_str, NULL, 16)); + } } }; @@ -207,4 +197,4 @@ bool validate_compute_pipeline(layer_data *dev_data, PIPELINE_STATE *pPipeline); typedef std::pair<unsigned, unsigned> descriptor_slot_t; bool PreCallValidateCreateShaderModule(layer_data *dev_data, VkShaderModuleCreateInfo const *pCreateInfo, bool *spirv_valid); -#endif //VULKAN_SHADER_VALIDATION_H +#endif // VULKAN_SHADER_VALIDATION_H diff --git a/layers/threading.cpp b/layers/threading.cpp index b3e2a17ce..d27d75f3c 100644 --- a/layers/threading.cpp +++ b/layers/threading.cpp @@ -200,7 +200,8 @@ static const VkExtensionProperties threading_extensions[] = { static const VkLayerProperties layerProps = { "VK_LAYER_GOOGLE_threading", VK_LAYER_API_VERSION, // specVersion - 1, "Google Validation Layer", + 1, + "Google Validation Layer", }; VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { diff --git a/layers/threading.h b/layers/threading.h index 9d6a6546b..950d77cf8 100644 --- a/layers/threading.h +++ b/layers/threading.h @@ -303,12 +303,14 @@ struct layer_data { c_VkShaderModule("VkShaderModule", VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT), c_VkDebugReportCallbackEXT("VkDebugReportCallbackEXT", VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT), c_VkObjectTableNVX("VkObjectTableNVX", VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT), - c_VkIndirectCommandsLayoutNVX("VkIndirectCommandsLayoutNVX", VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT), + c_VkIndirectCommandsLayoutNVX("VkIndirectCommandsLayoutNVX", + VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT), c_VkDisplayKHR("VkDisplayKHR", VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT), c_VkDisplayModeKHR("VkDisplayModeKHR", VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT), c_VkSurfaceKHR("VkSurfaceKHR", VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT), c_VkSwapchainKHR("VkSwapchainKHR", VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT), - c_VkDescriptorUpdateTemplateKHR("VkDescriptorUpdateTemplateKHR", VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT), + c_VkDescriptorUpdateTemplateKHR("VkDescriptorUpdateTemplateKHR", + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT), c_VkSamplerYcbcrConversionKHR("VkSamplerYcbcrConversionKHR", VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT) #else // DISTINCT_NONDISPATCHABLE_HANDLES c_uint64_t("NON_DISPATCHABLE_HANDLE", VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT) diff --git a/layers/unique_objects.cpp b/layers/unique_objects.cpp index 699f8ee9d..18786f4cd 100644 --- a/layers/unique_objects.cpp +++ b/layers/unique_objects.cpp @@ -71,8 +71,8 @@ static void InstanceExtensionWhitelist(const VkInstanceCreateInfo *pCreateInfo, if (!white_list(pCreateInfo->ppEnabledExtensionNames[i], kInstanceExtensionNames)) { log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_UNDEFINED, "UniqueObjects", - "Instance Extension %s is not supported by this layer. Using this extension may adversely affect " - "validation results and/or produce undefined behavior.", + "Instance Extension %s is not supported by this layer. Using this extension may adversely affect validation " + "results and/or produce undefined behavior.", pCreateInfo->ppEnabledExtensionNames[i]); } } @@ -87,8 +87,8 @@ static void DeviceExtensionWhitelist(const VkDeviceCreateInfo *pCreateInfo, VkDe if (!white_list(pCreateInfo->ppEnabledExtensionNames[i], kDeviceExtensionNames)) { log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_UNDEFINED, "UniqueObjects", - "Device Extension %s is not supported by this layer. Using this extension may adversely affect " - "validation results and/or produce undefined behavior.", + "Device Extension %s is not supported by this layer. Using this extension may adversely affect validation " + "results and/or produce undefined behavior.", pCreateInfo->ppEnabledExtensionNames[i]); } } @@ -118,9 +118,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreat layer_init_instance_dispatch_table(*pInstance, &instance_data->dispatch_table, fpGetInstanceProcAddr); instance_data->instance = *pInstance; - instance_data->report_data = - debug_report_create_instance(&instance_data->dispatch_table, *pInstance, pCreateInfo->enabledExtensionCount, - pCreateInfo->ppEnabledExtensionNames); + instance_data->report_data = debug_report_create_instance( + &instance_data->dispatch_table, *pInstance, pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames); // Set up temporary debug callbacks to output messages at CreateInstance-time if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &instance_data->num_tmp_callbacks, &instance_data->tmp_dbg_create_infos, @@ -270,7 +269,6 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance return table.GetInstanceProcAddr(instance, funcName); } - VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) { instance_layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); VkLayerInstanceDispatchTable *disp_table = &instance_data->dispatch_table; @@ -306,8 +304,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin pipelineCache = Unwrap(device_data, pipelineCache); } - VkResult result = device_data->dispatch_table.CreateComputePipelines( - device, pipelineCache, createInfoCount, local_pCreateInfos->ptr(), pAllocator, pPipelines); + VkResult result = device_data->dispatch_table.CreateComputePipelines(device, pipelineCache, createInfoCount, + local_pCreateInfos->ptr(), pAllocator, pPipelines); delete[] local_pCreateInfos; { std::lock_guard<std::mutex> lock(global_lock); @@ -354,7 +352,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli if (pCreateInfos[idx0].pStages) { for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) { if (pCreateInfos[idx0].pStages[idx1].module) { - local_pCreateInfos[idx0].pStages[idx1].module = Unwrap(device_data, pCreateInfos[idx0].pStages[idx1].module); + local_pCreateInfos[idx0].pStages[idx1].module = + Unwrap(device_data, pCreateInfos[idx0].pStages[idx1].module); } } } @@ -368,8 +367,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli pipelineCache = Unwrap(device_data, pipelineCache); } - VkResult result = device_data->dispatch_table.CreateGraphicsPipelines( - device, pipelineCache, createInfoCount, local_pCreateInfos->ptr(), pAllocator, pPipelines); + VkResult result = device_data->dispatch_table.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, + local_pCreateInfos->ptr(), pAllocator, pPipelines); delete[] local_pCreateInfos; { std::lock_guard<std::mutex> lock(global_lock); @@ -443,8 +442,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapc local_pCreateInfo->surface = Unwrap(my_map_data->instance_data, pCreateInfo->surface); } - VkResult result = my_map_data->dispatch_table.CreateSwapchainKHR( - device, local_pCreateInfo->ptr(), pAllocator, pSwapchain); + VkResult result = my_map_data->dispatch_table.CreateSwapchainKHR(device, local_pCreateInfo->ptr(), pAllocator, pSwapchain); if (local_pCreateInfo) { delete local_pCreateInfo; } @@ -476,8 +474,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32 } } } - VkResult result = dev_data->dispatch_table.CreateSharedSwapchainsKHR( - device, swapchainCount, local_pCreateInfos->ptr(), pAllocator, pSwapchains); + VkResult result = dev_data->dispatch_table.CreateSharedSwapchainsKHR(device, swapchainCount, local_pCreateInfos->ptr(), + pAllocator, pSwapchains); if (local_pCreateInfos) delete[] local_pCreateInfos; if (VK_SUCCESS == result) { std::lock_guard<std::mutex> lock(global_lock); @@ -560,8 +558,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(VkDevice device } } } - VkResult result = dev_data->dispatch_table.CreateDescriptorUpdateTemplateKHR( - device, local_create_info->ptr(), pAllocator, pDescriptorUpdateTemplate); + VkResult result = dev_data->dispatch_table.CreateDescriptorUpdateTemplateKHR(device, local_create_info->ptr(), pAllocator, + pDescriptorUpdateTemplate); if (VK_SUCCESS == result) { std::lock_guard<std::mutex> lock(global_lock); *pDescriptorUpdateTemplate = WrapNew(dev_data, *pDescriptorUpdateTemplate); @@ -680,8 +678,7 @@ VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR(VkDevice device, V descriptorUpdateTemplate = (VkDescriptorUpdateTemplateKHR)dev_data->unique_id_mapping[template_handle]; unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(dev_data, template_handle, pData); } - dev_data->dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, - unwrapped_buffer); + dev_data->dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, unwrapped_buffer); free(unwrapped_buffer); } @@ -698,7 +695,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer c unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(dev_data, template_handle, pData); } dev_data->dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, - unwrapped_buffer); + unwrapped_buffer); free(unwrapped_buffer); } @@ -707,8 +704,8 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalD VkDisplayPropertiesKHR *pProperties) { instance_layer_data *my_map_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); - VkResult result = my_map_data->dispatch_table.GetPhysicalDeviceDisplayPropertiesKHR( - physicalDevice, pPropertyCount, pProperties); + VkResult result = + my_map_data->dispatch_table.GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { std::lock_guard<std::mutex> lock(global_lock); for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { @@ -721,8 +718,8 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalD VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { instance_layer_data *my_map_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); - VkResult result = my_map_data->dispatch_table.GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, - pDisplayCount, pDisplays); + VkResult result = + my_map_data->dispatch_table.GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); if (VK_SUCCESS == result) { if ((*pDisplayCount > 0) && pDisplays) { std::lock_guard<std::mutex> lock(global_lock); @@ -745,8 +742,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice phys display = Unwrap(my_map_data, display); } - VkResult result = my_map_data->dispatch_table.GetDisplayModePropertiesKHR( - physicalDevice, display, pPropertyCount, pProperties); + VkResult result = my_map_data->dispatch_table.GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); if (result == VK_SUCCESS && pProperties) { std::lock_guard<std::mutex> lock(global_lock); for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { @@ -763,8 +759,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice p std::lock_guard<std::mutex> lock(global_lock); mode = Unwrap(dev_data, mode); } - VkResult result = - dev_data->dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); + VkResult result = dev_data->dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); return result; } #endif diff --git a/layers/unique_objects.h b/layers/unique_objects.h index e604e915e..d8d339355 100644 --- a/layers/unique_objects.h +++ b/layers/unique_objects.h @@ -109,10 +109,9 @@ bool ContainsExtStruct(const T *target, VkStructureType ext_type) { return false; } - /* Unwrap a handle. */ // must hold lock! -template<typename HandleType, typename MapType> +template <typename HandleType, typename MapType> HandleType Unwrap(MapType *layer_data, HandleType wrappedHandle) { // TODO: don't use operator[] here. return (HandleType)layer_data->unique_id_mapping[reinterpret_cast<uint64_t const &>(wrappedHandle)]; @@ -120,7 +119,7 @@ HandleType Unwrap(MapType *layer_data, HandleType wrappedHandle) { /* Wrap a newly created handle with a new unique ID, and return the new ID. */ // must hold lock! -template<typename HandleType, typename MapType> +template <typename HandleType, typename MapType> HandleType WrapNew(MapType *layer_data, HandleType newlyCreatedHandle) { auto unique_id = global_unique_id++; layer_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t const &>(newlyCreatedHandle); diff --git a/layers/vk_format_utils.cpp b/layers/vk_format_utils.cpp index 93481e85a..83029fe7f 100644 --- a/layers/vk_format_utils.cpp +++ b/layers/vk_format_utils.cpp @@ -351,9 +351,7 @@ VK_LAYER_EXPORT bool FormatIsCompressed_PVRTC(VkFormat format) { // Return true if format is compressed VK_LAYER_EXPORT bool FormatIsCompressed(VkFormat format) { - return (FormatIsCompressed_ASTC_LDR(format) || - FormatIsCompressed_BC(format) || - FormatIsCompressed_ETC2_EAC(format) || + return (FormatIsCompressed_ASTC_LDR(format) || FormatIsCompressed_BC(format) || FormatIsCompressed_ETC2_EAC(format) || FormatIsCompressed_PVRTC(format)); } diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h index 9a5f549a8..559b5a45a 100644 --- a/layers/vk_layer_logging.h +++ b/layers/vk_layer_logging.h @@ -36,7 +36,6 @@ #include <unordered_map> #include <vector> - typedef struct _debug_report_data { VkLayerDbgFunctionNode *debug_callback_list; VkLayerDbgFunctionNode *default_debug_callback_list; @@ -236,8 +235,8 @@ static inline PFN_vkVoidFunction debug_report_get_instance_proc_addr(debug_repor // then allocates an array that can hold that many structs, as well as that // many VkDebugReportCallbackEXT handles. It then copies each // VkDebugReportCallbackCreateInfoEXT, and initializes each handle. -static VkResult layer_copy_tmp_callbacks(const void *pChain, uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos, - VkDebugReportCallbackEXT **callbacks) { +static inline VkResult layer_copy_tmp_callbacks(const void *pChain, uint32_t *num_callbacks, + VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks) { uint32_t n = *num_callbacks = 0; const void *pNext = pChain; @@ -281,15 +280,15 @@ static VkResult layer_copy_tmp_callbacks(const void *pChain, uint32_t *num_callb } // This utility frees the arrays allocated by layer_copy_tmp_callbacks() -static void layer_free_tmp_callbacks(VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks) { +static inline void layer_free_tmp_callbacks(VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks) { free(infos); free(callbacks); } // This utility enables all of the VkDebugReportCallbackCreateInfoEXT structs // that were copied by layer_copy_tmp_callbacks() -static VkResult layer_enable_tmp_callbacks(debug_report_data *debug_data, uint32_t num_callbacks, - VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks) { +static inline VkResult layer_enable_tmp_callbacks(debug_report_data *debug_data, uint32_t num_callbacks, + VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks) { VkResult rtn = VK_SUCCESS; for (uint32_t i = 0; i < num_callbacks; i++) { rtn = layer_create_msg_callback(debug_data, false, &infos[i], NULL, &callbacks[i]); @@ -305,8 +304,8 @@ static VkResult layer_enable_tmp_callbacks(debug_report_data *debug_data, uint32 // This utility disables all of the VkDebugReportCallbackCreateInfoEXT structs // that were copied by layer_copy_tmp_callbacks() -static void layer_disable_tmp_callbacks(debug_report_data *debug_data, uint32_t num_callbacks, - VkDebugReportCallbackEXT *callbacks) { +static inline void layer_disable_tmp_callbacks(debug_report_data *debug_data, uint32_t num_callbacks, + VkDebugReportCallbackEXT *callbacks) { for (uint32_t i = 0; i < num_callbacks; i++) { layer_destroy_msg_callback(debug_data, callbacks[i], NULL); } @@ -324,9 +323,9 @@ static inline bool will_log_msg(debug_report_data *debug_data, VkFlags msgFlags) return true; } #ifndef WIN32 -static int string_sprintf(std::string *output, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +static inline int string_sprintf(std::string *output, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #endif -static int string_sprintf(std::string *output, const char *fmt, ...) { +static inline int string_sprintf(std::string *output, const char *fmt, ...) { std::string &formatted = *output; va_list argptr; va_start(argptr, fmt); @@ -418,8 +417,8 @@ static inline VKAPI_ATTR VkBool32 VKAPI_CALL win32_debug_output_msg(VkFlags msgF } static inline VKAPI_ATTR VkBool32 VKAPI_CALL DebugBreakCallback(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, - uint64_t srcObject, size_t location, int32_t msgCode, - const char *pLayerPrefix, const char *pMsg, void *pUserData) { + uint64_t srcObject, size_t location, int32_t msgCode, + const char *pLayerPrefix, const char *pMsg, void *pUserData) { #ifdef WIN32 DebugBreak(); #else @@ -429,7 +428,6 @@ static inline VKAPI_ATTR VkBool32 VKAPI_CALL DebugBreakCallback(VkFlags msgFlags return false; } - // TODO: Could be autogenerated for the specific handles for extra type safety... template <typename HANDLE_T> static inline uint64_t HandleToUint64(HANDLE_T *h) { diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp index 367c0bf17..d788daf76 100644 --- a/layers/vk_layer_utils.cpp +++ b/layers/vk_layer_utils.cpp @@ -146,5 +146,4 @@ VK_LAYER_EXPORT void layer_debug_actions(debug_report_data *report_data, std::ve layer_create_msg_callback(report_data, default_layer_callback, &dbgCreateInfo, pAllocator, &callback); logging_callback.push_back(callback); } - } diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index c58171629..c33c9387f 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -2545,8 +2545,8 @@ VALIDATION_ERROR_1de08403~^~Y~^~Unknown~^~vkCmdSetStencilWriteMask~^~VUID-vkCmdS VALIDATION_ERROR_1e00098a~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-None-01221~^~core~^~The spec valid usage text states 'The currently bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_VIEWPORT dynamic state enabled' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-None-01221)~^~ VALIDATION_ERROR_1e00098c~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01222~^~core~^~The spec valid usage text states 'firstViewport must be less than VkPhysicalDeviceLimits::maxViewports' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01222)~^~ VALIDATION_ERROR_1e00098e~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01223~^~core~^~The spec valid usage text states 'The sum of firstViewport and viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01223)~^~ -VALIDATION_ERROR_1e000990~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01224~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, firstViewport must be 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01224)~^~ -VALIDATION_ERROR_1e000992~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-viewportCount-01225~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, viewportCount must be 1' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-viewportCount-01225)~^~ +VALIDATION_ERROR_1e000990~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01224~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, firstViewport must be 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01224)~^~ +VALIDATION_ERROR_1e000992~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-viewportCount-01225~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, viewportCount must be 1' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-viewportCount-01225)~^~ VALIDATION_ERROR_1e000994~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-pViewports-01226~^~core~^~The spec valid usage text states 'pViewports must be a valid pointer to an array of viewportCount valid VkViewport structures' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-pViewports-01226)~^~ VALIDATION_ERROR_1e002401~^~Y~^~None~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-commandBuffer-parameter~^~core~^~The spec valid usage text states 'commandBuffer must be a valid VkCommandBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-commandBuffer-parameter)~^~implicit VALIDATION_ERROR_1e002413~^~Y~^~None~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-commandBuffer-recording~^~core~^~The spec valid usage text states 'commandBuffer must be in the recording state' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-commandBuffer-recording)~^~implicit diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index dba7254ac..c074e946e 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -149,6 +149,12 @@ if (WIN32) endif() endforeach() + if (ENABLE_WIN10_ONECORE) + # Note When linking your app or driver to OneCore.lib, be sure to remove any links to non-umbrella libs (such as kernel32.lib). + set(CMAKE_CXX_STANDARD_LIBRARIES " ") # space is intentional + set(CMAKE_C_STANDARD_LIBRARIES ${CMAKE_CXX_STANDARD_LIBRARIES}) + endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") # Build dev_ext_trampoline.c with -O2 to allow tail-call optimization. # Build other C files with normal options @@ -180,10 +186,16 @@ if (WIN32) # Suppress conflicting libs warning for debug builds. set_target_properties(${API_LOWERCASE}-${MAJOR} PROPERTIES LINK_FLAGS_DEBUG /ignore:4098) set_target_properties(VKstatic.${MAJOR} PROPERTIES OUTPUT_NAME VKstatic.${MAJOR}) - target_link_libraries(${API_LOWERCASE}-${MAJOR} shlwapi Cfgmgr32) + + if (ENABLE_WIN10_ONECORE) + target_link_libraries(${API_LOWERCASE}-${MAJOR} OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB) + set_target_properties(${API_LOWERCASE}-${MAJOR} PROPERTIES LINK_FLAGS "/NODEFAULTLIB") + else() + target_link_libraries(${API_LOWERCASE}-${MAJOR} Cfgmgr32) + endif() + add_dependencies(${API_LOWERCASE}-${MAJOR} generate_helper_files loader_gen_files loader_asm_gen_files) - target_link_libraries(VKstatic.${MAJOR} shlwapi) if (CMAKE_GENERATOR MATCHES "^Visual Studio.*") file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${API_LOWERCASE}-${MAJOR}.dll COPY_SRC_PATH) file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../demos/$<CONFIGURATION>/ COPY_DST_PATH) diff --git a/loader/loader.c b/loader/loader.c index f1bc58976..9fc764d2d 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -408,6 +408,57 @@ VKAPI_ATTR VkResult VKAPI_CALL vkSetDeviceDispatch(VkDevice device, void *object } #if defined(_WIN32) + +// Append the JSON path data to the list and allocate/grow the list if it's not large enough. +// Function returns true if filename was appended to reg_data list. +// Caller should free reg_data. +static bool loaderAddJsonEntry(const struct loader_instance *inst, + char **reg_data, // list of JSON files + PDWORD total_size, // size of reg_data + LPCTSTR key_name, // key name - used for debug prints - i.e. VulkanDriverName + DWORD key_type, // key data type + LPSTR json_path, // JSON string to add to the list reg_data + DWORD json_size, // size in bytes of json_path + VkResult *result) { + if (NULL == *reg_data) { + *reg_data = loader_instance_heap_alloc(inst, *total_size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == *reg_data) { + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loaderAddJsonEntry: Failed to allocate space for registry data for key %s", json_path); + *result = VK_ERROR_OUT_OF_HOST_MEMORY; + return false; + } + *reg_data[0] = '\0'; + } else if (strlen(*reg_data) + json_size + 1 > *total_size) { + void *new_ptr = + loader_instance_heap_realloc(inst, *reg_data, *total_size, *total_size * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == new_ptr) { + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loaderAddJsonEntry: Failed to reallocate space for registry value of size %d for key %s", *total_size * 2, + json_path); + *result = VK_ERROR_OUT_OF_HOST_MEMORY; + return false; + } + *reg_data = new_ptr; + *total_size *= 2; + } + + for (char *curr_filename = json_path; curr_filename[0] != '\0'; curr_filename += strlen(curr_filename) + 1) { + if (strlen(*reg_data) == 0) { + (void)snprintf(*reg_data, json_size + 1, "%s", curr_filename); + } else { + (void)snprintf(*reg_data + strlen(*reg_data), json_size + 2, "%c%s", PATH_SEPARATOR, curr_filename); + } + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "%s: Located json file \"%s\" from PnP registry: %s", __FUNCTION__, + curr_filename, key_name); + + if (key_type == REG_SZ) { + break; + } + } + return true; +} + // Find the list of registry files (names VulkanDriverName/VulkanDriverNameWow) in hkr. // // This function looks for filename in given device handle, filename is then added to return list @@ -485,43 +536,7 @@ bool loaderGetDeviceRegistryEntry(const struct loader_instance *inst, char **reg goto out; } - if (NULL == *reg_data) { - *reg_data = loader_instance_heap_alloc(inst, *total_size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == *reg_data) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetDeviceRegistryEntry: Failed to allocate space for registry data for key %s", manifest_path); - *result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - *reg_data[0] = '\0'; - } else if (strlen(*reg_data) + requiredSize + 1 > *total_size) { - void *new_ptr = loader_instance_heap_realloc(inst, *reg_data, *total_size, *total_size * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == new_ptr) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetDeviceRegistryEntry: Failed to reallocate space for registry value of size %d for key %s", - *total_size * 2, manifest_path); - *result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - *reg_data = new_ptr; - *total_size *= 2; - } - - for (char *curr_filename = manifest_path; curr_filename[0] != '\0'; curr_filename += strlen(curr_filename) + 1) { - if (strlen(*reg_data) == 0) { - (void)snprintf(*reg_data, requiredSize + 1, "%s", curr_filename); - } else { - (void)snprintf(*reg_data + strlen(*reg_data), requiredSize + 2, "%c%s", PATH_SEPARATOR, curr_filename); - } - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "%s: Located json file \"%s\" from PnP registry: %s", __FUNCTION__, curr_filename, value_name); - - if (data_type == REG_SZ) { - break; - } - } - found = true; + found = loaderAddJsonEntry(inst, reg_data, total_size, value_name, data_type, manifest_path, requiredSize, result); out: if (manifest_path != NULL) { @@ -543,15 +558,15 @@ out: // *reg_data contains a string list of filenames as pointer. // When done using the returned string list, the caller should free the pointer. VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char **reg_data, PDWORD reg_data_size, LPCTSTR value_name) { - static const char* softwareComponentGUID = "{5c4c3332-344d-483c-8739-259e934c9cc8}"; - static const char* displayGUID = "{4d36e968-e325-11ce-bfc1-08002be10318}"; + static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}"; + static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}"; const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; - - char childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {} + + wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {} ULONG childGuidSize = sizeof(childGuid); DEVINST devID = 0, childID = 0; - char *pDeviceNames = NULL; + wchar_t *pDeviceNames = NULL; ULONG deviceNamesSize = 0; VkResult result = VK_SUCCESS; bool found = false; @@ -563,28 +578,27 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char * // if after obtaining the DeviceNameSize, new device is added start over do { - CM_Get_Device_ID_List_Size(&deviceNamesSize, displayGUID, flags); + CM_Get_Device_ID_List_SizeW(&deviceNamesSize, displayGUID, flags); if (pDeviceNames != NULL) { loader_instance_heap_free(inst, pDeviceNames); } - pDeviceNames = loader_instance_heap_alloc(inst, deviceNamesSize, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + pDeviceNames = loader_instance_heap_alloc(inst, deviceNamesSize * sizeof(wchar_t), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (pDeviceNames == NULL) { loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetDeviceRegistryFiles: Failed to allocate space for display device names."); result = VK_ERROR_OUT_OF_HOST_MEMORY; return result; } - } while (CM_Get_Device_ID_List(displayGUID, pDeviceNames, deviceNamesSize, flags) == CR_BUFFER_SMALL); - - if (pDeviceNames) { + } while (CM_Get_Device_ID_ListW(displayGUID, pDeviceNames, deviceNamesSize, flags) == CR_BUFFER_SMALL); - for (char *deviceName = pDeviceNames; *deviceName; deviceName += strlen(deviceName) + 1) { - CONFIGRET status = CM_Locate_DevNode(&devID, deviceName, CM_LOCATE_DEVNODE_NORMAL); + if (pDeviceNames) { + for (wchar_t *deviceName = pDeviceNames; *deviceName; deviceName += wcslen(deviceName) + 1) { + CONFIGRET status = CM_Locate_DevNodeW(&devID, deviceName, CM_LOCATE_DEVNODE_NORMAL); if (CR_SUCCESS != status) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetRegistryFiles: failed to open DevNode %s", deviceName); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetDeviceRegistryFiles: failed to open DevNode %s", + deviceName); continue; } ULONG ulStatus, ulProblem; @@ -592,19 +606,18 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char * if (CR_SUCCESS != status) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetRegistryFiles: failed to probe device status %s", deviceName); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetDeviceRegistryFiles: failed to probe device status %s", + deviceName); continue; } if ((ulStatus & DN_HAS_PROBLEM) && (ulProblem == CM_PROB_NEED_RESTART || ulProblem == DN_NEED_RESTART)) { loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "loaderGetRegistryFiles: device %s is pending reboot, skipping ...", deviceName); + "loaderGetDeviceRegistryFiles: device %s is pending reboot, skipping ...", deviceName); continue; } - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "loaderGetRegistryFiles: opening device %s", deviceName); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "loaderGetDeviceRegistryFiles: opening device %s", deviceName); if (loaderGetDeviceRegistryEntry(inst, reg_data, reg_data_size, devID, value_name, &result)) { found = true; @@ -617,29 +630,29 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char * status = CM_Get_Child(&childID, devID, 0); if (status != CR_SUCCESS) { loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "loaderGetRegistryFiles: unable to open child-device error:%d", status); + "loaderGetDeviceRegistryFiles: unable to open child-device error:%d", status); continue; } do { - char buffer[MAX_DEVICE_ID_LEN]; - CM_Get_Device_ID(childID, buffer, MAX_DEVICE_ID_LEN, 0); + wchar_t buffer[MAX_DEVICE_ID_LEN]; + CM_Get_Device_IDW(childID, buffer, MAX_DEVICE_ID_LEN, 0); loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "loaderGetRegistryFiles: Opening child device %d - %s", childID, buffer); + "loaderGetDeviceRegistryFiles: Opening child device %d - %s", childID, buffer); - status = CM_Get_DevNode_Registry_Property(childID, CM_DRP_CLASSGUID, NULL, &childGuid, &childGuidSize, 0); + status = CM_Get_DevNode_Registry_PropertyW(childID, CM_DRP_CLASSGUID, NULL, &childGuid, &childGuidSize, 0); if (status != CR_SUCCESS) { loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetRegistryFiles: unable to obtain GUID for:%d error:%d", childID, status); + "loaderGetDeviceRegistryFiles: unable to obtain GUID for:%d error:%d", childID, status); result = VK_ERROR_INITIALIZATION_FAILED; continue; } - if (strcmp(childGuid, softwareComponentGUID) != 0) { + if (wcscmp(childGuid, softwareComponentGUID) != 0) { loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "loaderGetRegistryFiles: GUID for %d is not SoftwareComponent skipping", childID); + "loaderGetDeviceRegistryFiles: GUID for %d is not SoftwareComponent skipping", childID); continue; } @@ -733,11 +746,37 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Located json file \"%s\" from registry \"%s\\%s\"", name, hive == DEFAULT_VK_REGISTRY_HIVE ? DEFAULT_VK_REGISTRY_HIVE_STR : SECONDARY_VK_REGISTRY_HIVE_STR, location); if (strlen(*reg_data) == 0) { + // The list is emtpy. Add the first entry. (void)snprintf(*reg_data, name_size + 1, "%s", name); + found = true; } else { - (void)snprintf(*reg_data + strlen(*reg_data), name_size + 2, "%c%s", PATH_SEPARATOR, name); + // At this point the reg_data variable contains other JSON paths, likely from the PNP/device section + // of the registry that we want to have precendence over this non-device specific section of the registry. + // To make sure we avoid enumerating old JSON files/drivers that might be present in the non-device specific + // area of the registry when a newer device specific JSON file is present, do a check before adding. + // Find the file name, without path, of the JSON file found in the non-device specific registry location. + // If the same JSON file name is already found in the list, don't add it again. + bool foundDuplicate = false; + char *pLastSlashName = strrchr(name, '\\'); + if (pLastSlashName != NULL) { + char *foundMatch = strstr(*reg_data, pLastSlashName + 1); + if (foundMatch != NULL) { + foundDuplicate = true; + } + } + + if (foundDuplicate == false) { + // Add the new entry to the list. + (void)snprintf(*reg_data + strlen(*reg_data), name_size + 2, "%c%s", PATH_SEPARATOR, name); + found = true; + } else { + loader_log( + inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, + "Skipping adding of json file \"%s\" from registry \"%s\\%s\" to the list due to duplication", name, + hive == DEFAULT_VK_REGISTRY_HIVE ? DEFAULT_VK_REGISTRY_HIVE_STR : SECONDARY_VK_REGISTRY_HIVE_STR, + location); + } } - found = true; } name_size = 2048; } @@ -3063,6 +3102,7 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co DWORD reg_size = 4096; + // These calls look at the PNP/Device section of the registry. if (!strncmp(loc, DEFAULT_VK_DRIVERS_INFO, sizeof(DEFAULT_VK_DRIVERS_INFO))) { regHKR_result = loaderGetDeviceRegistryFiles(inst, ®, ®_size, LoaderPnpDriverRegistry()); } else if (!strncmp(loc, DEFAULT_VK_ELAYERS_INFO, sizeof(DEFAULT_VK_ELAYERS_INFO))) { @@ -3071,6 +3111,7 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co regHKR_result = loaderGetDeviceRegistryFiles(inst, ®, ®_size, LoaderPnpILayerRegistry()); } + // This call looks into the Khronos non-device specific section of the registry. VkResult reg_result = loaderGetRegistryFiles(inst, loc, is_layer, ®, ®_size); if ((VK_SUCCESS != reg_result && VK_SUCCESS != regHKR_result) || NULL == reg) { @@ -3631,7 +3672,8 @@ void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_l VkResult local_res = loader_add_layer_properties(inst, instance_layers, json, (implicit == 1), file_str); cJSON_Delete(json); - if (VK_SUCCESS != local_res) { + // If the error is anything other than out of memory we still want to try to load the other layers + if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { goto out; } } diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 40de844eb..505cb1e28 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -222,7 +222,15 @@ static bool loader_platform_file_exists(const char *path) { return true; } -static bool loader_platform_is_path_absolute(const char *path) { return !PathIsRelative(path); } +static bool loader_platform_is_path_absolute(const char *path) { + if (!path || !*path) { + return false; + } + if (*path == DIRECTORY_SYMBOL || path[1] == ':') { + return true; + } + return false; +} // WIN32 runtime doesn't have dirname(). static inline char *loader_platform_dirname(char *path) { @@ -273,7 +281,7 @@ typedef HMODULE loader_platform_dl_handle; static loader_platform_dl_handle loader_platform_open_library(const char *lib_path) { // Try loading the library the original way first. loader_platform_dl_handle lib_handle = LoadLibrary(lib_path); - if (lib_handle == NULL && GetLastError() == ERROR_MOD_NOT_FOUND && PathFileExists(lib_path)) { + if (lib_handle == NULL && GetLastError() == ERROR_MOD_NOT_FOUND) { // If that failed, then try loading it with broader search folders. lib_handle = LoadLibraryEx(lib_path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); } diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index 8ca1ade9d..71b57e432 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -422,6 +422,7 @@ class VkLayerTest : public VkRenderFramework { InitFramework(myDbgFunc, m_errorMonitor); InitState(features, flags); } + protected: ErrorMonitor *m_errorMonitor; @@ -937,11 +938,9 @@ struct OneOffDescriptorSet { for (const auto &b : bindings) sizes.push_back({b.descriptorType, std::max(1u, b.descriptorCount)}); VkDescriptorPoolCreateInfo dspci = { - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, nullptr, - 0, 1, uint32_t(sizes.size()), sizes.data() }; + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, nullptr, 0, 1, uint32_t(sizes.size()), sizes.data()}; err = vkCreateDescriptorPool(device_->handle(), &dspci, nullptr, &pool_); - if (err != VK_SUCCESS) - return; + if (err != VK_SUCCESS) return; VkDescriptorSetAllocateInfo alloc_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, nullptr, pool_, 1, &layout_.handle()}; @@ -1229,9 +1228,7 @@ class ExtensionChain { // ******************************************************************************************************************** // ******************************************************************************************************************** TEST_F(VkLayerTest, RequiredParameter) { - TEST_DESCRIPTION( - "Specify VK_NULL_HANDLE, NULL, and 0 for required handle, " - "pointer, array, and array count parameters"); + TEST_DESCRIPTION("Specify VK_NULL_HANDLE, NULL, and 0 for required handle, pointer, array, and array count parameters"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -1249,14 +1246,14 @@ TEST_F(VkLayerTest, RequiredParameter) { vkGetPhysicalDeviceQueueFamilyProperties(gpu(), NULL, NULL); m_errorMonitor->VerifyFound(); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "parameter viewportCount must be greater than 0"); + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_1e030a1b); // Specify 0 for a required array count // Expected to trigger an error with parameter_validation::validate_array VkViewport view_port = {}; m_commandBuffer->SetViewport(0, 0, &view_port); m_errorMonitor->VerifyFound(); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "required parameter pViewports specified as NULL"); + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_1e03fa01); // Specify NULL for a required array // Expected to trigger an error with parameter_validation::validate_array m_commandBuffer->SetViewport(0, 1, NULL); @@ -1368,9 +1365,7 @@ TEST_F(VkLayerTest, DebugMarkerNameTest) { } TEST_F(VkLayerTest, InvalidStructSType) { - TEST_DESCRIPTION( - "Specify an invalid VkStructureType for a Vulkan " - "structure's sType field"); + TEST_DESCRIPTION("Specify an invalid VkStructureType for a Vulkan structure's sType field"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -1430,9 +1425,7 @@ TEST_F(VkLayerTest, UnrecognizedValueOutOfRange) { ASSERT_NO_FATAL_FAILURE(Init()); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "does not fall within the begin..end " - "range of the core VkFormat " - "enumeration tokens"); + "does not fall within the begin..end range of the core VkFormat enumeration tokens"); // Specify an invalid VkFormat value // Expected to trigger an error with // parameter_validation::validate_ranged_enum @@ -1679,9 +1672,7 @@ TEST_F(VkLayerTest, FillBufferAlignment) { } TEST_F(VkLayerTest, PSOPolygonModeInvalid) { - TEST_DESCRIPTION( - "Attempt to use a non-solid polygon fill mode in a " - "pipeline when this feature is not enabled."); + TEST_DESCRIPTION("Attempt to use a non-solid polygon fill mode in a pipeline when this feature is not enabled."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -1940,8 +1931,7 @@ TEST_F(VkLayerTest, SparseResidencyImageCreateUnsupportedSamples) { TEST_F(VkLayerTest, InvalidMemoryAliasing) { TEST_DESCRIPTION( - "Create a buffer and image, allocate memory, and bind the " - "buffer and image to memory such that they will alias."); + "Create a buffer and image, allocate memory, and bind the buffer and image to memory such that they will alias."); VkResult err; bool pass; ASSERT_NO_FATAL_FAILURE(Init()); @@ -2304,8 +2294,7 @@ TEST_F(VkLayerTest, SubmitSignaledFence) { vk_testing::Fence testFence; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "submitted in SIGNALED state. Fences " - "must be reset before being submitted"); + "submitted in SIGNALED state. Fences must be reset before being submitted"); VkFenceCreateInfo fenceInfo = {}; fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; @@ -2341,9 +2330,8 @@ TEST_F(VkLayerTest, SubmitSignaledFence) { TEST_F(VkLayerTest, InvalidUsageBits) { TEST_DESCRIPTION( - "Specify wrong usage for image then create conflicting view of image " - "Initialize buffer with wrong usage then perform copy expecting errors " - "from both the image and the buffer (2 calls)"); + "Specify wrong usage for image then create conflicting view of image Initialize buffer with wrong usage then perform copy " + "expecting errors from both the image and the buffer (2 calls)"); ASSERT_NO_FATAL_FAILURE(Init()); auto format = FindSupportedDepthStencilFormat(gpu()); @@ -2441,9 +2429,7 @@ TEST_F(VkLayerTest, LeakAnObject) { } TEST_F(VkLayerTest, InvalidCommandPoolConsistency) { - TEST_DESCRIPTION( - "Allocate command buffers from one command pool and " - "attempt to delete them from another."); + TEST_DESCRIPTION("Allocate command buffers from one command pool and attempt to delete them from another."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "FreeCommandBuffers is attempting to free Command Buffer"); @@ -2479,9 +2465,7 @@ TEST_F(VkLayerTest, InvalidCommandPoolConsistency) { TEST_F(VkLayerTest, InvalidDescriptorPoolConsistency) { VkResult err; - TEST_DESCRIPTION( - "Allocate descriptor sets from one DS pool and " - "attempt to delete them from another."); + TEST_DESCRIPTION("Allocate descriptor sets from one DS pool and attempt to delete them from another."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "FreeDescriptorSets is attempting to free descriptorSet"); @@ -2534,8 +2518,8 @@ TEST_F(VkLayerTest, CreateUnknownObject) { TEST_F(VkLayerTest, UseObjectWithWrongDevice) { TEST_DESCRIPTION( - "Try to destroy a render pass object using a device other than the one it was created on. " - "This should generate a distinct error from the invalid handle error."); + "Try to destroy a render pass object using a device other than the one it was created on. This should generate a distinct " + "error from the invalid handle error."); // Create first device and renderpass ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -2590,9 +2574,7 @@ TEST_F(VkLayerTest, PipelineNotBound) { TEST_F(VkLayerTest, BindImageInvalidMemoryType) { VkResult err; - TEST_DESCRIPTION( - "Test validation check for an invalid memory type index " - "during bind[Buffer|Image]Memory time"); + TEST_DESCRIPTION("Test validation check for an invalid memory type index during bind[Buffer|Image]Memory time"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -3507,8 +3489,8 @@ TEST_F(VkLayerTest, BlitImageFilters) { m_errorMonitor->VerifyFound(); } - if (cubic_support && - !ImageFormatAndFeaturesSupported(gpu(), fmt, VK_IMAGE_TILING_OPTIMAL, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG)) { + if (cubic_support && !ImageFormatAndFeaturesSupported(gpu(), fmt, VK_IMAGE_TILING_OPTIMAL, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG)) { // Invalid filter CUBIC_IMG m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_184001d8); vkCmdBlitImage(m_commandBuffer->handle(), src3D.image(), src3D.Layout(), dst2D.image(), dst2D.Layout(), 1, &blitRegion, @@ -3693,7 +3675,7 @@ TEST_F(VkLayerTest, BlitImageOffsets) { VkFormat fmt = VK_FORMAT_R8G8B8A8_UNORM; if (!ImageFormatAndFeaturesSupported(gpu(), fmt, VK_IMAGE_TILING_OPTIMAL, - VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT)) { + VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT)) { printf(" No blit feature bits - BlitImageOffsets skipped.\n"); return; } @@ -3839,7 +3821,7 @@ TEST_F(VkLayerTest, MiscBlitImageTests) { VkFormat f_depth = VK_FORMAT_D32_SFLOAT; // Need feature ..BLIT_SRC_BIT but not ..BLIT_DST_BIT if (!ImageFormatAndFeaturesSupported(gpu(), f_color, VK_IMAGE_TILING_OPTIMAL, - VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT) || + VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT) || !ImageFormatAndFeaturesSupported(gpu(), f_depth, VK_IMAGE_TILING_OPTIMAL, VK_FORMAT_FEATURE_BLIT_SRC_BIT) || ImageFormatAndFeaturesSupported(gpu(), f_depth, VK_IMAGE_TILING_OPTIMAL, VK_FORMAT_FEATURE_BLIT_DST_BIT)) { printf(" Requested format features unavailable - MiscBlitImageTests skipped.\n"); @@ -4119,9 +4101,8 @@ TEST_F(VkLayerTest, DSImageTransferGranularityTests) { TEST_F(VkLayerTest, MismatchedQueueFamiliesOnSubmit) { TEST_DESCRIPTION( - "Submit command buffer created using one queue family and " - "attempt to submit them on a queue created in a different " - "queue family."); + "Submit command buffer created using one queue family and attempt to submit them on a queue created in a different queue " + "family."); ASSERT_NO_FATAL_FAILURE(Init()); // assumes it initializes all queue families on vkCreateDevice @@ -4244,7 +4225,8 @@ TEST_F(VkLayerTest, RenderPassPipelineSubpassMismatch) { rp, fb, {{ - 0, 0, + 0, + 0, }, {32, 32}}, 0, @@ -5003,15 +4985,12 @@ TEST_F(VkPositiveLayerTest, SecondaryCommandBufferBarrier) { } TEST_F(VkLayerTest, RenderPassInvalidRenderArea) { - TEST_DESCRIPTION( - "Generate INVALID_RENDER_AREA error by beginning renderpass" - "with extent outside of framebuffer"); + TEST_DESCRIPTION("Generate INVALID_RENDER_AREA error by beginning renderpass with extent outside of framebuffer"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "Cannot execute a render pass with renderArea " - "not within the bound of the framebuffer."); + "Cannot execute a render pass with renderArea not within the bound of the framebuffer."); // Framebuffer for render target is 256x256, exceed that for INVALID_RENDER_AREA m_renderPassBeginInfo.renderArea.extent.width = 257; @@ -5023,16 +5002,15 @@ TEST_F(VkLayerTest, RenderPassInvalidRenderArea) { TEST_F(VkLayerTest, DisabledIndependentBlend) { TEST_DESCRIPTION( - "Generate INDEPENDENT_BLEND by disabling independent " - "blend and then specifying different blend states for two " + "Generate INDEPENDENT_BLEND by disabling independent blend and then specifying different blend states for two " "attachements"); VkPhysicalDeviceFeatures features = {}; features.independentBlend = VK_FALSE; ASSERT_NO_FATAL_FAILURE(Init(&features)); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "Invalid Pipeline CreateInfo: If independent blend feature not " - "enabled, all elements of pAttachments must be identical"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "Invalid Pipeline CreateInfo: If independent blend feature not enabled, all elements of pAttachments must be identical"); VkDescriptorSetObj descriptorSet(m_device); descriptorSet.AppendDummy(); @@ -5087,8 +5065,7 @@ TEST_F(VkLayerTest, DisabledIndependentBlend) { // Is the Pipeline compatible with the expectations of the Renderpass/subpasses? TEST_F(VkLayerTest, PipelineRenderpassCompatibility) { TEST_DESCRIPTION( - "Create a graphics pipeline that is incompatible with the requirements " - "of its contained Renderpass/subpasses."); + "Create a graphics pipeline that is incompatible with the requirements of its contained Renderpass/subpasses."); ASSERT_NO_FATAL_FAILURE(Init()); VkDescriptorSetObj ds_obj(m_device); @@ -5120,8 +5097,8 @@ TEST_F(VkLayerTest, PipelineRenderpassCompatibility) { TEST_F(VkLayerTest, CreateRenderPassAttachments) { TEST_DESCRIPTION( - "Ensure that CreateRenderPass produces the expected validation errors " - "when a subpass's attachments violate the valid usage conditions."); + "Ensure that CreateRenderPass produces the expected validation errors when a subpass's attachments violate the valid usage " + "conditions."); ASSERT_NO_FATAL_FAILURE(Init()); @@ -5154,11 +5131,13 @@ TEST_F(VkLayerTest, CreateRenderPassAttachments) { {0, VK_IMAGE_LAYOUT_GENERAL}, }; std::vector<VkAttachmentReference> color = { - {1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, {2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + {1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + {2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, }; VkAttachmentReference depth = {3, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}; std::vector<VkAttachmentReference> resolve = { - {4, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, {VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + {4, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + {VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, }; std::vector<uint32_t> preserve = {5}; @@ -5574,8 +5553,7 @@ TEST_F(VkLayerTest, FramebufferCreateErrors) { TEST_F(VkLayerTest, DynamicDepthBiasNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Depth Bias dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Depth Bias dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic depth bias @@ -5586,8 +5564,7 @@ TEST_F(VkLayerTest, DynamicDepthBiasNotBound) { TEST_F(VkLayerTest, DynamicLineWidthNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Line Width dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Line Width dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic line width @@ -5598,8 +5575,7 @@ TEST_F(VkLayerTest, DynamicLineWidthNotBound) { TEST_F(VkLayerTest, DynamicViewportNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Viewport dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Viewport dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic viewport state @@ -5610,9 +5586,7 @@ TEST_F(VkLayerTest, DynamicViewportNotBound) { } TEST_F(VkLayerTest, DynamicScissorNotBound) { - TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Scissor dynamic " - "state is required but not correctly bound."); + TEST_DESCRIPTION("Run a simple draw calls to validate failure when Scissor dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic scissor state @@ -5624,8 +5598,7 @@ TEST_F(VkLayerTest, DynamicScissorNotBound) { TEST_F(VkLayerTest, DynamicBlendConstantsNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Blend Constants " - "dynamic state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Blend Constants dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic blend constant state @@ -5637,8 +5610,7 @@ TEST_F(VkLayerTest, DynamicBlendConstantsNotBound) { TEST_F(VkLayerTest, DynamicDepthBoundsNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Depth Bounds dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Depth Bounds dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); if (!m_device->phy().features().depthBounds) { @@ -5654,8 +5626,7 @@ TEST_F(VkLayerTest, DynamicDepthBoundsNotBound) { TEST_F(VkLayerTest, DynamicStencilReadNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Stencil Read dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Stencil Read dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic stencil read mask @@ -5667,8 +5638,7 @@ TEST_F(VkLayerTest, DynamicStencilReadNotBound) { TEST_F(VkLayerTest, DynamicStencilWriteNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Stencil Write dynamic" - " state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Stencil Write dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic stencil write mask @@ -5680,8 +5650,7 @@ TEST_F(VkLayerTest, DynamicStencilWriteNotBound) { TEST_F(VkLayerTest, DynamicStencilRefNotBound) { TEST_DESCRIPTION( - "Run a simple draw calls to validate failure when Stencil Ref dynamic " - "state is required but not correctly bound."); + "Run a simple draw calls to validate failure when Stencil Ref dynamic state is required but not correctly bound."); ASSERT_NO_FATAL_FAILURE(Init()); // Dynamic stencil reference @@ -5703,8 +5672,7 @@ TEST_F(VkLayerTest, IndexBufferNotBound) { TEST_F(VkLayerTest, CommandBufferTwoSubmits) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "was begun w/ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT set, but has " - "been submitted"); + "was begun w/ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT set, but has been submitted"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitViewport()); @@ -5923,9 +5891,9 @@ TEST_F(VkLayerTest, InvalidDescriptorSetLayout) { TEST_F(VkLayerTest, WriteDescriptorSetIntegrityCheck) { TEST_DESCRIPTION( "This test verifies some requirements of chapter 13.2.3 of the Vulkan Spec " - "1) A uniform buffer update must have a valid buffer index." - "2) When using an array of descriptors in a single WriteDescriptor," - " the descriptor types and stageflags must all be the same." + "1) A uniform buffer update must have a valid buffer index. " + "2) When using an array of descriptors in a single WriteDescriptor, the descriptor types and stageflags " + "must all be the same. " "3) Immutable Sampler state must match across descriptors"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_15c00288); @@ -6064,8 +6032,8 @@ TEST_F(VkLayerTest, WriteDescriptorSetIntegrityCheck) { TEST_F(VkLayerTest, WriteDescriptorSetConsecutiveUpdates) { TEST_DESCRIPTION( - "Verifies that updates rolling over to next descriptor work correctly by destroying buffer" - "from consecutive update known to be used in descriptor set and verifying that error is flagged."); + "Verifies that updates rolling over to next descriptor work correctly by destroying buffer from consecutive update known " + "to be used in descriptor set and verifying that error is flagged."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitViewport()); @@ -6702,9 +6670,7 @@ TEST_F(VkLayerTest, CreatePipelineLayoutExcessDescriptorsOverall) { } TEST_F(VkLayerTest, InvalidCmdBufferBufferDestroyed) { - TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a buffer dependency being destroyed."); + TEST_DESCRIPTION("Attempt to draw with a command buffer that is invalid due to a buffer dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); VkBuffer buffer; @@ -6901,9 +6867,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { } TEST_F(VkLayerTest, InvalidCmdBufferImageDestroyed) { - TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to an image dependency being destroyed."); + TEST_DESCRIPTION("Attempt to draw with a command buffer that is invalid due to an image dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); VkImage image; @@ -6972,8 +6936,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferImageDestroyed) { TEST_F(VkLayerTest, InvalidCmdBufferFramebufferImageDestroyed) { TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a framebuffer image dependency being destroyed."); + "Attempt to draw with a command buffer that is invalid due to a framebuffer image dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); VkFormatProperties format_properties; VkResult err = VK_SUCCESS; @@ -7243,6 +7206,8 @@ TEST_F(VkLayerTest, RenderPassInUseDestroyedSignaled) { // Wait for queue to complete so we can safely destroy rp vkQueueWaitIdle(m_device->m_queue); + m_errorMonitor->SetUnexpectedError("If renderPass is not VK_NULL_HANDLE, renderPass must be a valid VkRenderPass handle"); + m_errorMonitor->SetUnexpectedError("Was it created? Has it already been destroyed?"); vkDestroyRenderPass(m_device->device(), rp, nullptr); } @@ -7365,9 +7330,7 @@ TEST_F(VkLayerTest, BufferMemoryNotBound) { } TEST_F(VkLayerTest, InvalidCmdBufferEventDestroyed) { - TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to an event dependency being destroyed."); + TEST_DESCRIPTION("Attempt to draw with a command buffer that is invalid due to an event dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); VkEvent event; @@ -7394,9 +7357,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferEventDestroyed) { } TEST_F(VkLayerTest, InvalidCmdBufferQueryPoolDestroyed) { - TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a query pool dependency being destroyed."); + TEST_DESCRIPTION("Attempt to draw with a command buffer that is invalid due to a query pool dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); VkQueryPool query_pool; @@ -7425,9 +7386,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferQueryPoolDestroyed) { } TEST_F(VkLayerTest, InvalidCmdBufferPipelineDestroyed) { - TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a pipeline dependency being destroyed."); + TEST_DESCRIPTION("Attempt to draw with a command buffer that is invalid due to a pipeline dependency being destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -7542,9 +7501,8 @@ TEST_F(VkPositiveLayerTest, DestroyPipelineRenderPass) { TEST_F(VkLayerTest, InvalidCmdBufferDescriptorSetBufferDestroyed) { TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a bound descriptor set with a buffer dependency " - "being destroyed."); + "Attempt to draw with a command buffer that is invalid due to a bound descriptor set with a buffer dependency being " + "destroyed."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -7686,12 +7644,9 @@ TEST_F(VkLayerTest, InvalidCmdBufferDescriptorSetBufferDestroyed) { TEST_F(VkLayerTest, InvalidCmdBufferDescriptorSetImageSamplerDestroyed) { TEST_DESCRIPTION( - "Attempt to draw with a command buffer that is invalid " - "due to a bound descriptor sets with a combined image " - "sampler having their image, sampler, and descriptor set " - "each respectively destroyed and then attempting to " - "submit associated cmd buffers. Attempt to destroy a " - "DescriptorSet that is in use."); + "Attempt to draw with a command buffer that is invalid due to a bound descriptor sets with a combined image sampler having " + "their image, sampler, and descriptor set each respectively destroyed and then attempting to submit associated cmd " + "buffers. Attempt to destroy a DescriptorSet that is in use."); ASSERT_NO_FATAL_FAILURE(Init(nullptr, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT)); ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -8912,9 +8867,7 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { // 3. Dynamic offset oversteps buffer being updated VkResult err; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - " requires 1 dynamicOffsets, but only " - "0 dynamicOffsets are left in " - "pDynamicOffsets "); + " requires 1 dynamicOffsets, but only 0 dynamicOffsets are left in pDynamicOffsets "); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitViewport()); @@ -9016,10 +8969,9 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { &descriptorSet, 2, pDynOff); m_errorMonitor->VerifyFound(); // Finally cause error due to dynamicOffset being too big - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - " dynamic offset 512 combined with " - "offset 0 and range 1024 that " - "oversteps the buffer size of 1024"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + " dynamic offset 512 combined with offset 0 and range 1024 that oversteps the buffer size of 1024"); // Create PSO to be used for draw-time errors below char const *vsSource = "#version 450\n" @@ -9063,9 +9015,7 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { } TEST_F(VkLayerTest, DescriptorBufferUpdateNoMemoryBound) { - TEST_DESCRIPTION( - "Attempt to update a descriptor with a non-sparse buffer " - "that doesn't have memory bound"); + TEST_DESCRIPTION("Attempt to update a descriptor with a non-sparse buffer that doesn't have memory bound"); VkResult err; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " used with no memory bound. Memory should be bound by calling vkBindBufferMemory()."); @@ -9166,36 +9116,18 @@ TEST_F(VkLayerTest, InvalidPushConstants) { const uint32_t too_big = m_device->props.limits.maxPushConstantsSize + 0x4; const std::array<PipelineLayoutTestCase, 10> range_tests = {{ - {{VK_SHADER_STAGE_VERTEX_BIT, 0, 0}, - "vkCreatePipelineLayout() call has push constants index 0 with " - "size 0."}, - {{VK_SHADER_STAGE_VERTEX_BIT, 0, 1}, - "vkCreatePipelineLayout() call has push constants index 0 with " - "size 1."}, - {{VK_SHADER_STAGE_VERTEX_BIT, 4, 1}, - "vkCreatePipelineLayout() call has push constants index 0 with " - "size 1."}, - {{VK_SHADER_STAGE_VERTEX_BIT, 4, 0}, - "vkCreatePipelineLayout() call has push constants index 0 with " - "size 0."}, - {{VK_SHADER_STAGE_VERTEX_BIT, 1, 4}, - "vkCreatePipelineLayout() call has push constants index 0 with " - "offset 1. Offset must"}, - {{VK_SHADER_STAGE_VERTEX_BIT, 0, too_big}, - "vkCreatePipelineLayout() call has push constants index 0 " - "with offset "}, - {{VK_SHADER_STAGE_VERTEX_BIT, too_big, too_big}, - "vkCreatePipelineLayout() call has push constants " - "index 0 with offset "}, - {{VK_SHADER_STAGE_VERTEX_BIT, too_big, 4}, - "vkCreatePipelineLayout() call has push constants index 0 " - "with offset "}, + {{VK_SHADER_STAGE_VERTEX_BIT, 0, 0}, "vkCreatePipelineLayout() call has push constants index 0 with size 0."}, + {{VK_SHADER_STAGE_VERTEX_BIT, 0, 1}, "vkCreatePipelineLayout() call has push constants index 0 with size 1."}, + {{VK_SHADER_STAGE_VERTEX_BIT, 4, 1}, "vkCreatePipelineLayout() call has push constants index 0 with size 1."}, + {{VK_SHADER_STAGE_VERTEX_BIT, 4, 0}, "vkCreatePipelineLayout() call has push constants index 0 with size 0."}, + {{VK_SHADER_STAGE_VERTEX_BIT, 1, 4}, "vkCreatePipelineLayout() call has push constants index 0 with offset 1. Offset must"}, + {{VK_SHADER_STAGE_VERTEX_BIT, 0, too_big}, "vkCreatePipelineLayout() call has push constants index 0 with offset "}, + {{VK_SHADER_STAGE_VERTEX_BIT, too_big, too_big}, "vkCreatePipelineLayout() call has push constants index 0 with offset "}, + {{VK_SHADER_STAGE_VERTEX_BIT, too_big, 4}, "vkCreatePipelineLayout() call has push constants index 0 with offset "}, {{VK_SHADER_STAGE_VERTEX_BIT, 0xFFFFFFF0, 0x00000020}, - "vkCreatePipelineLayout() call has push " - "constants index 0 with offset "}, + "vkCreatePipelineLayout() call has push constants index 0 with offset "}, {{VK_SHADER_STAGE_VERTEX_BIT, 0x00000020, 0xFFFFFFF0}, - "vkCreatePipelineLayout() call has push " - "constants index 0 with offset "}, + "vkCreatePipelineLayout() call has push constants index 0 with offset "}, }}; // Check for invalid offset and size @@ -9680,7 +9612,7 @@ TEST_F(VkLayerTest, InvalidPipelineCreateState) { VkResult err; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "Invalid Pipeline CreateInfo State: Vertex Shader required"); + "Invalid Pipeline CreateInfo State: Vertex Shader required"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -9781,7 +9713,7 @@ TEST_F(VkLayerTest, InvalidPipelineCreateState) { } TEST_F(VkLayerTest, InvalidPipelineSampleRateFeatureDisable) { - //Enable sample shading in pipeline when the feature is disabled. + // Enable sample shading in pipeline when the feature is disabled. ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); // Disable sampleRateShading here @@ -9798,7 +9730,7 @@ TEST_F(VkLayerTest, InvalidPipelineSampleRateFeatureDisable) { } TEST_F(VkLayerTest, InvalidPipelineSampleRateFeatureEnable) { - //Enable sample shading in pipeline when the feature is disabled. + // Enable sample shading in pipeline when the feature is disabled. ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); // Require sampleRateShading here @@ -10292,7 +10224,6 @@ TEST_F(VkLayerTest, DynViewportAndScissorUndefinedDrawState) { &m_scissors[0]); // Forgetting to set needed 0th scissor (PSO scissorCount == 1) m_commandBuffer->Draw(1, 0, 0, 0); m_errorMonitor->VerifyFound(); - } TEST_F(VkLayerTest, PSOLineWidthInvalid) { @@ -10341,7 +10272,7 @@ TEST_F(VkLayerTest, PSOLineWidthInvalid) { VkGraphicsPipelineCreateInfo gp_ci = {}; gp_ci.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; - gp_ci.stageCount = sizeof(shader_state_cis)/sizeof(VkPipelineShaderStageCreateInfo); + gp_ci.stageCount = sizeof(shader_state_cis) / sizeof(VkPipelineShaderStageCreateInfo); gp_ci.pStages = shader_state_cis; gp_ci.pVertexInputState = &vi_state_ci; gp_ci.pInputAssemblyState = &ia_state_ci; @@ -10881,9 +10812,8 @@ TEST_F(VkLayerTest, RenderPassWithinRenderPass) { TEST_F(VkLayerTest, RenderPassClearOpMismatch) { TEST_DESCRIPTION( - "Begin a renderPass where clearValueCount is less than" - "the number of renderPass attachments that use loadOp" - "VK_ATTACHMENT_LOAD_OP_CLEAR."); + "Begin a renderPass where clearValueCount is less than the number of renderPass attachments that use " + "loadOpVK_ATTACHMENT_LOAD_OP_CLEAR."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -11248,7 +11178,8 @@ TEST_F(VkLayerTest, ClearDepthStencilImageErrors) { m_commandBuffer->begin(); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_18a00012); - vkCmdClearDepthStencilImage(m_commandBuffer->handle(), dst_image_bad_usage.handle(), VK_IMAGE_LAYOUT_GENERAL, &clear_value, 1, &range); + vkCmdClearDepthStencilImage(m_commandBuffer->handle(), dst_image_bad_usage.handle(), VK_IMAGE_LAYOUT_GENERAL, &clear_value, 1, + &range); m_errorMonitor->VerifyFound(); // Fix usage for next test case @@ -11267,9 +11198,7 @@ TEST_F(VkLayerTest, ClearColorAttachmentsOutsideRenderPass) { // Call CmdClearAttachmentss outside of an active RenderPass m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "vkCmdClearAttachments(): This call " - "must be issued inside an active " - "render pass"); + "vkCmdClearAttachments(): This call must be issued inside an active render pass"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -11291,13 +11220,10 @@ TEST_F(VkLayerTest, ClearColorAttachmentsOutsideRenderPass) { } TEST_F(VkLayerTest, RenderPassExcessiveNextSubpass) { - TEST_DESCRIPTION( - "Test that an error is produced when CmdNextSubpass is " - "called too many times in a renderpass instance"); + TEST_DESCRIPTION("Test that an error is produced when CmdNextSubpass is called too many times in a renderpass instance"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "vkCmdNextSubpass(): Attempted to advance " - "beyond final subpass"); + "vkCmdNextSubpass(): Attempted to advance beyond final subpass"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -11314,13 +11240,10 @@ TEST_F(VkLayerTest, RenderPassExcessiveNextSubpass) { } TEST_F(VkLayerTest, RenderPassEndedBeforeFinalSubpass) { - TEST_DESCRIPTION( - "Test that an error is produced when CmdEndRenderPass is " - "called before the final subpass has been reached"); + TEST_DESCRIPTION("Test that an error is produced when CmdEndRenderPass is called before the final subpass has been reached"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "vkCmdEndRenderPass(): Called before reaching " - "final subpass"); + "vkCmdEndRenderPass(): Called before reaching final subpass"); ASSERT_NO_FATAL_FAILURE(Init()); VkSubpassDescription sd[2] = {{0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 0, nullptr, nullptr, nullptr, 0, nullptr}, @@ -11926,6 +11849,9 @@ TEST_F(VkLayerTest, ImageBarrierWithBadRange) { m_commandBuffer->begin(); + // Nested scope here confuses clang-format, somehow + // clang-format off + // try for vkCmdPipelineBarrier { // Try baseMipLevel >= image.mipLevels with VK_REMAINING_MIP_LEVELS @@ -12118,6 +12044,7 @@ TEST_F(VkLayerTest, ImageBarrierWithBadRange) { vkDestroyEvent(m_device->handle(), event, nullptr); } +// clang-format on } TEST_F(VkLayerTest, ValidationCacheTestBadMerge) { @@ -12311,9 +12238,7 @@ TEST_F(VkLayerTest, InvalidQueueFamilyIndex) { } TEST_F(VkLayerTest, ExecuteCommandsPrimaryCB) { - TEST_DESCRIPTION( - "Attempt vkCmdExecuteCommands with a primary command buffer" - " (should only be secondary)"); + TEST_DESCRIPTION("Attempt vkCmdExecuteCommands with a primary command buffer (should only be secondary)"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -12335,9 +12260,7 @@ TEST_F(VkLayerTest, ExecuteCommandsPrimaryCB) { } TEST_F(VkLayerTest, DSUsageBitsErrors) { - TEST_DESCRIPTION( - "Attempt to update descriptor sets for images and buffers " - "that do not have correct usage bits sets."); + TEST_DESCRIPTION("Attempt to update descriptor sets for images and buffers that do not have correct usage bits sets."); ASSERT_NO_FATAL_FAILURE(Init()); std::array<VkDescriptorPoolSize, VK_DESCRIPTOR_TYPE_RANGE_SIZE> ds_type_count; @@ -12440,8 +12363,7 @@ TEST_F(VkLayerTest, DSUsageBitsErrors) { TEST_F(VkLayerTest, DSBufferInfoErrors) { TEST_DESCRIPTION( - "Attempt to update buffer descriptor set that has incorrect " - "parameters in VkDescriptorBufferInfo struct. This includes:\n" + "Attempt to update buffer descriptor set that has incorrect parameters in VkDescriptorBufferInfo struct. This includes:\n" "1. offset value greater than or equal to buffer size\n" "2. range value of 0\n" "3. range value greater than buffer (size - offset)"); @@ -12630,9 +12552,7 @@ TEST_F(VkLayerTest, DSBufferLimitErrors) { TEST_F(VkLayerTest, DSAspectBitsErrors) { // TODO : Initially only catching case where DEPTH & STENCIL aspect bits // are set, but could expand this test to hit more cases. - TEST_DESCRIPTION( - "Attempt to update descriptor sets for images " - "that do not have correct aspect bits sets."); + TEST_DESCRIPTION("Attempt to update descriptor sets for images that do not have correct aspect bits sets."); VkResult err; ASSERT_NO_FATAL_FAILURE(Init()); @@ -12708,9 +12628,7 @@ TEST_F(VkLayerTest, DSAspectBitsErrors) { descriptor_write.pImageInfo = &img_info; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT; descriptor_write.dstSet = ds.set_; - const char *error_msg = - " please only set either VK_IMAGE_ASPECT_DEPTH_BIT " - "or VK_IMAGE_ASPECT_STENCIL_BIT "; + const char *error_msg = " please only set either VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT "; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, error_msg); vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL); @@ -12725,9 +12643,9 @@ TEST_F(VkLayerTest, DSTypeMismatch) { // Create DS w/ layout of one type and attempt Update w/ mis-matched type VkResult err; - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - " binding #0 with type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER but update " - "type is VK_DESCRIPTOR_TYPE_SAMPLER"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + " binding #0 with type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER but update type is VK_DESCRIPTOR_TYPE_SAMPLER"); ASSERT_NO_FATAL_FAILURE(Init()); OneOffDescriptorSet ds(m_device, { @@ -12977,9 +12895,7 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { VkResult err; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - " binding #1 with type " - "VK_DESCRIPTOR_TYPE_SAMPLER. Types do " - "not match."); + " binding #1 with type VK_DESCRIPTOR_TYPE_SAMPLER. Types do not match."); ASSERT_NO_FATAL_FAILURE(Init()); OneOffDescriptorSet ds(m_device, { @@ -13032,10 +12948,8 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { // Now perform a copy update that fails due to binding out of bounds m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - " binding#1 with offset index of 1 plus " - "update array offset of 0 and update of " - "5 descriptors oversteps total number " - "of descriptors in set: 2."); + " binding#1 with offset index of 1 plus update array offset of 0 and update of 5 " + "descriptors oversteps total number of descriptors in set: 2."); memset(©_ds_update, 0, sizeof(VkCopyDescriptorSet)); copy_ds_update.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; @@ -13137,9 +13051,8 @@ TEST_F(VkLayerTest, NumSamplesMismatch) { TEST_F(VkLayerTest, RenderPassIncompatible) { TEST_DESCRIPTION( - "Hit RenderPass incompatible cases. " - "Initial case is drawing with an active renderpass that's " - "not compatible with the bound pipeline state object's creation renderpass"); + "Hit RenderPass incompatible cases. Initial case is drawing with an active renderpass that's not compatible with the bound " + "pipeline state object's creation renderpass"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -13244,8 +13157,7 @@ TEST_F(VkLayerTest, NumBlendAttachMismatch) { TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { TEST_DESCRIPTION( - "Attempt to bind a slice of a 3D texture in a descriptor set. " - "This is explicitly disallowed by KHR_maintenance1 to keep " + "Attempt to bind a slice of a 3D texture in a descriptor set. This is explicitly disallowed by KHR_maintenance1 to keep " "things simple for drivers."); ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); if (DeviceExtensionSupported(gpu(), nullptr, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { @@ -13262,27 +13174,35 @@ TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, }); - VkImageCreateInfo ici = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, nullptr, - VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR, - VK_IMAGE_TYPE_3D, VK_FORMAT_R8G8B8A8_UNORM, - { 32, 32, 32 }, 1, 1, - VK_SAMPLE_COUNT_1_BIT, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_SAMPLED_BIT, - VK_SHARING_MODE_EXCLUSIVE, 0, nullptr, VK_IMAGE_LAYOUT_UNDEFINED }; + VkImageCreateInfo ici = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, + nullptr, + VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR, + VK_IMAGE_TYPE_3D, + VK_FORMAT_R8G8B8A8_UNORM, + {32, 32, 32}, + 1, + 1, + VK_SAMPLE_COUNT_1_BIT, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_SAMPLED_BIT, + VK_SHARING_MODE_EXCLUSIVE, + 0, + nullptr, + VK_IMAGE_LAYOUT_UNDEFINED}; VkImageObj image(m_device); image.init(&ici); ASSERT_TRUE(image.initialized()); - VkImageViewCreateInfo ivci = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, nullptr, - 0, image.handle(), VK_IMAGE_VIEW_TYPE_2D, + VkImageViewCreateInfo ivci = { + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, + nullptr, + 0, + image.handle(), + VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM, - { VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY - }, - { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }, + {VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_IDENTITY}, + {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, }; VkImageView view; err = vkCreateImageView(m_device->device(), &ivci, nullptr, &view); @@ -13291,9 +13211,9 @@ TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { // Meat of the test. m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_046002ae); - VkDescriptorImageInfo dii = { VK_NULL_HANDLE, view, VK_IMAGE_LAYOUT_GENERAL }; - VkWriteDescriptorSet write = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, - set.set_, 0, 0, 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, &dii, nullptr, nullptr }; + VkDescriptorImageInfo dii = {VK_NULL_HANDLE, view, VK_IMAGE_LAYOUT_GENERAL}; + VkWriteDescriptorSet write = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, set.set_, 0, 0, 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, &dii, nullptr, nullptr}; vkUpdateDescriptorSets(m_device->device(), 1, &write, 0, nullptr); m_errorMonitor->VerifyFound(); @@ -13302,9 +13222,7 @@ TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { } TEST_F(VkLayerTest, MissingClearAttachment) { - TEST_DESCRIPTION( - "Points to a wrong colorAttachment index in a VkClearAttachment " - "structure passed to vkCmdClearAttachments"); + TEST_DESCRIPTION("Points to a wrong colorAttachment index in a VkClearAttachment structure passed to vkCmdClearAttachments"); ASSERT_NO_FATAL_FAILURE(Init()); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_1860001e); @@ -13312,6 +13230,50 @@ TEST_F(VkLayerTest, MissingClearAttachment) { m_errorMonitor->VerifyFound(); } +TEST_F(VkPositiveLayerTest, ConfirmNoVLErrorWhenVkCmdClearAttachmentsCalledInSecondaryCB) { + TEST_DESCRIPTION( + "This test is to verify that when vkCmdClearAttachments is called by a secondary commandbuffer, the validation layers do " + "not throw an error if the primary commandbuffer begins a renderpass before executing the secondary commandbuffer."); + + ASSERT_NO_FATAL_FAILURE(Init()); + ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); + + VkCommandBufferObj secondary(m_device, m_commandPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY); + + VkCommandBufferBeginInfo info = {}; + VkCommandBufferInheritanceInfo hinfo = {}; + info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT; + info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + info.pInheritanceInfo = &hinfo; + hinfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO; + hinfo.pNext = NULL; + hinfo.renderPass = renderPass(); + hinfo.subpass = 0; + hinfo.framebuffer = m_framebuffer; + hinfo.occlusionQueryEnable = VK_FALSE; + hinfo.queryFlags = 0; + hinfo.pipelineStatistics = 0; + + secondary.begin(&info); + VkClearAttachment color_attachment; + color_attachment.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + color_attachment.clearValue.color.float32[0] = 0.0; + color_attachment.clearValue.color.float32[1] = 0.0; + color_attachment.clearValue.color.float32[2] = 0.0; + color_attachment.clearValue.color.float32[3] = 0.0; + color_attachment.colorAttachment = 0; + VkClearRect clear_rect = {{{0, 0}, {(uint32_t)m_width, (uint32_t)m_height}}, 0, 1}; + vkCmdClearAttachments(secondary.handle(), 1, &color_attachment, 1, &clear_rect); + m_errorMonitor->VerifyNotFound(); + secondary.end(); + + m_commandBuffer->begin(); + vkCmdBeginRenderPass(m_commandBuffer->handle(), &m_renderPassBeginInfo, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS); + vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle()); + vkCmdEndRenderPass(m_commandBuffer->handle()); + m_commandBuffer->end(); +} + TEST_F(VkLayerTest, CmdClearAttachmentTests) { TEST_DESCRIPTION("Various tests for validating usage of vkCmdClearAttachments"); @@ -13435,9 +13397,7 @@ TEST_F(VkLayerTest, VtxBufferBadIndex) { } TEST_F(VkLayerTest, MismatchCountQueueCreateRequestedFeature) { - TEST_DESCRIPTION( - "Use an invalid count in a vkEnumeratePhysicalDevices call." - "Use invalid Queue Family Index in vkCreateDevice"); + TEST_DESCRIPTION("Use an invalid count in a vkEnumeratePhysicalDevices call.Use invalid Queue Family Index in vkCreateDevice"); ASSERT_NO_FATAL_FAILURE(Init()); // The following test fails with recent NVidia drivers. @@ -13533,12 +13493,10 @@ TEST_F(VkLayerTest, InvalidQueryPoolCreate) { } TEST_F(VkLayerTest, UnclosedQuery) { - TEST_DESCRIPTION( - "End a command buffer with a query still in progress."); + TEST_DESCRIPTION("End a command buffer with a query still in progress."); const char *invalid_query = "Ending command buffer with in progress query: queryPool 0x"; - ASSERT_NO_FATAL_FAILURE(Init()); VkEvent event; @@ -13571,28 +13529,14 @@ TEST_F(VkLayerTest, UnclosedQuery) { TEST_F(VkLayerTest, VertexBufferInvalid) { TEST_DESCRIPTION( - "Submit a command buffer using deleted vertex buffer, " - "delete a buffer twice, use an invalid offset for each " - "buffer type, and attempt to bind a null buffer"); - - const char *deleted_buffer_in_command_buffer = - "Cannot submit cmd buffer " - "using deleted buffer "; - const char *invalid_offset_message = - "vkBindBufferMemory(): " - "memoryOffset is 0x"; - const char *invalid_storage_buffer_offset_message = - "vkBindBufferMemory(): " - "storage memoryOffset " - "is 0x"; - const char *invalid_texel_buffer_offset_message = - "vkBindBufferMemory(): " - "texel memoryOffset " - "is 0x"; - const char *invalid_uniform_buffer_offset_message = - "vkBindBufferMemory(): " - "uniform memoryOffset " - "is 0x"; + "Submit a command buffer using deleted vertex buffer, delete a buffer twice, use an invalid offset for each buffer type, " + "and attempt to bind a null buffer"); + + const char *deleted_buffer_in_command_buffer = "Cannot submit cmd buffer using deleted buffer "; + const char *invalid_offset_message = "vkBindBufferMemory(): memoryOffset is 0x"; + const char *invalid_storage_buffer_offset_message = "vkBindBufferMemory(): storage memoryOffset is 0x"; + const char *invalid_texel_buffer_offset_message = "vkBindBufferMemory(): texel memoryOffset is 0x"; + const char *invalid_uniform_buffer_offset_message = "vkBindBufferMemory(): uniform memoryOffset is 0x"; ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitViewport()); @@ -13742,9 +13686,8 @@ TEST_F(VkLayerTest, BadVertexBufferOffset) { // INVALID_IMAGE_LAYOUT tests (one other case is hit by MapMemWithoutHostVisibleBit and not here) TEST_F(VkLayerTest, InvalidImageLayout) { TEST_DESCRIPTION( - "Hit all possible validation checks associated with the " - "DRAWSTATE_INVALID_IMAGE_LAYOUT enum. Generally these involve having" - "images in the wrong layout when they're copied or transitioned."); + "Hit all possible validation checks associated with the DRAWSTATE_INVALID_IMAGE_LAYOUT enum. Generally these involve " + "havingimages in the wrong layout when they're copied or transitioned."); // 3 in ValidateCmdBufImageLayouts // * -1 Attempt to submit cmd buf w/ deleted image // * -2 Cmd buf submit of image w/ layout not matching first use w/ subresource @@ -13860,16 +13803,16 @@ TEST_F(VkLayerTest, InvalidImageLayout) { m_errorMonitor->SetUnexpectedError("layout should be VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL instead of GENERAL."); m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_GENERAL, dst_image, VK_IMAGE_LAYOUT_GENERAL, 1, ©_region); // Now cause error due to src image layout changing - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that " - "doesn't match the actual current layout VK_IMAGE_LAYOUT_GENERAL."); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that doesn't match the actual current layout VK_IMAGE_LAYOUT_GENERAL."); m_errorMonitor->SetUnexpectedError("is VK_IMAGE_LAYOUT_UNDEFINED but can only be VK_IMAGE_LAYOUT"); m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_UNDEFINED, dst_image, VK_IMAGE_LAYOUT_GENERAL, 1, ©_region); m_errorMonitor->VerifyFound(); // Final src error is due to bad layout type - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "is VK_IMAGE_LAYOUT_UNDEFINED but can only be " - "VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL."); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "is VK_IMAGE_LAYOUT_UNDEFINED but can only be VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL."); m_errorMonitor->SetUnexpectedError( "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that doesn't match the actual current layout VK_IMAGE_LAYOUT_GENERAL."); m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_UNDEFINED, dst_image, VK_IMAGE_LAYOUT_GENERAL, 1, ©_region); @@ -13881,16 +13824,16 @@ TEST_F(VkLayerTest, InvalidImageLayout) { m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_GENERAL, dst_image, VK_IMAGE_LAYOUT_GENERAL, 1, ©_region); m_errorMonitor->VerifyFound(); // Now cause error due to src image layout changing - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that doesn't match " - "the actual current layout VK_IMAGE_LAYOUT_GENERAL."); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that doesn't match the actual current layout VK_IMAGE_LAYOUT_GENERAL."); m_errorMonitor->SetUnexpectedError( "is VK_IMAGE_LAYOUT_UNDEFINED but can only be VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL."); m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_GENERAL, dst_image, VK_IMAGE_LAYOUT_UNDEFINED, 1, ©_region); m_errorMonitor->VerifyFound(); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "is VK_IMAGE_LAYOUT_UNDEFINED but can only be VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL " - "or VK_IMAGE_LAYOUT_GENERAL."); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "is VK_IMAGE_LAYOUT_UNDEFINED but can only be VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL."); m_errorMonitor->SetUnexpectedError( "with specific layout VK_IMAGE_LAYOUT_UNDEFINED that doesn't match the actual current layout VK_IMAGE_LAYOUT_GENERAL."); m_commandBuffer->CopyImage(src_image, VK_IMAGE_LAYOUT_GENERAL, dst_image, VK_IMAGE_LAYOUT_UNDEFINED, 1, ©_region); @@ -14102,8 +14045,7 @@ TEST_F(VkLayerTest, InvalidStorageImageLayout) { TEST_F(VkLayerTest, NonSimultaneousSecondaryMarksPrimary) { ASSERT_NO_FATAL_FAILURE(Init()); const char *simultaneous_use_message = - "does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set and " - "will cause primary command buffer"; + "does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set and will cause primary command buffer"; VkCommandBufferObj secondary(m_device, m_commandPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY); @@ -14111,7 +14053,10 @@ TEST_F(VkLayerTest, NonSimultaneousSecondaryMarksPrimary) { secondary.end(); VkCommandBufferBeginInfo cbbi = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, nullptr, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, + nullptr, + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, + nullptr, }; m_commandBuffer->begin(&cbbi); @@ -14129,7 +14074,8 @@ TEST_F(VkLayerTest, SimultaneousUseSecondaryTwoExecutes) { VkCommandBufferObj secondary(m_device, m_commandPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY); VkCommandBufferInheritanceInfo inh = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, nullptr, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, + nullptr, }; VkCommandBufferBeginInfo cbbi = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, &inh}; @@ -14155,7 +14101,8 @@ TEST_F(VkLayerTest, SimultaneousUseSecondarySingleExecute) { VkCommandBufferObj secondary(m_device, m_commandPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY); VkCommandBufferInheritanceInfo inh = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, nullptr, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, + nullptr, }; VkCommandBufferBeginInfo cbbi = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, &inh}; @@ -14171,9 +14118,7 @@ TEST_F(VkLayerTest, SimultaneousUseSecondarySingleExecute) { } TEST_F(VkLayerTest, SimultaneousUseOneShot) { - TEST_DESCRIPTION( - "Submit the same command buffer twice in one submit looking for simultaneous use and one time submit" - "errors"); + TEST_DESCRIPTION("Submit the same command buffer twice in one submit looking for simultaneous use and one time submit errors"); const char *simultaneous_use_message = "is already in use and is not marked for simultaneous use"; const char *one_shot_message = "VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT set, but has been submitted"; ASSERT_NO_FATAL_FAILURE(Init()); @@ -14221,8 +14166,8 @@ TEST_F(VkLayerTest, SimultaneousUseOneShot) { TEST_F(VkLayerTest, StageMaskGsTsEnabled) { TEST_DESCRIPTION( - "Attempt to use a stageMask w/ geometry shader and tesselation shader bits enabled when those features are " - "disabled on the device."); + "Attempt to use a stageMask w/ geometry shader and tesselation shader bits enabled when those features are disabled on the " + "device."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -14300,10 +14245,8 @@ TEST_F(VkLayerTest, EventInUseDestroyedSignaled) { TEST_F(VkLayerTest, InUseDestroyedSignaled) { TEST_DESCRIPTION( - "Use vkCmdExecuteCommands with invalid state " - "in primary and secondary command buffers. " - "Delete objects that are inuse. Call VkQueueSubmit " - "with an event that has been deleted."); + "Use vkCmdExecuteCommands with invalid state in primary and secondary command buffers. Delete objects that are inuse. Call " + "VkQueueSubmit with an event that has been deleted."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -14724,7 +14667,10 @@ TEST_F(VkLayerTest, CreateImageViewFormatFeatureMismatch) { VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT}; // List of errors that will be thrown in order of tests run UNIQUE_VALIDATION_ERROR_CODE optimal_error_codes[] = { - VALIDATION_ERROR_0ac007ea, VALIDATION_ERROR_0ac007ec, VALIDATION_ERROR_0ac007ee, VALIDATION_ERROR_0ac007f0, + VALIDATION_ERROR_0ac007ea, + VALIDATION_ERROR_0ac007ec, + VALIDATION_ERROR_0ac007ee, + VALIDATION_ERROR_0ac007f0, }; VkFormatProperties formatProps; @@ -15279,17 +15225,14 @@ TEST_F(VkLayerTest, UpdateDestroyDescriptorSetLayout) { TEST_F(VkLayerTest, QueueForwardProgressFenceWait) { TEST_DESCRIPTION( - "Call VkQueueSubmit with a semaphore that is already " - "signaled but not waited on by the queue. Wait on a " - "fence that has not yet been submitted to a queue."); + "Call VkQueueSubmit with a semaphore that is already signaled but not waited on by the queue. Wait on a fence that has not " + "yet been submitted to a queue."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); const char *queue_forward_progress_message = " that has already been signaled but not waited on by queue 0x"; - const char *invalid_fence_wait_message = - " which has not been submitted on a Queue or during " - "acquire next image."; + const char *invalid_fence_wait_message = " which has not been submitted on a Queue or during acquire next image."; VkCommandBufferObj cb1(m_device, m_commandPool); cb1.begin(); @@ -15330,9 +15273,7 @@ TEST_F(VkLayerTest, QueueForwardProgressFenceWait) { TEST_F(VkLayerTest, FramebufferIncompatible) { TEST_DESCRIPTION( - "Bind a secondary command buffer with with a framebuffer " - "that does not match the framebuffer for the active " - "renderpass."); + "Bind a secondary command buffer with with a framebuffer that does not match the framebuffer for the active renderpass."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -15577,9 +15518,7 @@ TEST_F(VkLayerTest, InvalidSPIRVCodeSize) { } TEST_F(VkLayerTest, InvalidSPIRVMagic) { - TEST_DESCRIPTION( - "Test that an error is produced for a spirv module " - "with a bad magic number"); + TEST_DESCRIPTION("Test that an error is produced for a spirv module with a bad magic number"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Invalid SPIR-V magic number"); @@ -15605,9 +15544,7 @@ TEST_F(VkLayerTest, InvalidSPIRVMagic) { } TEST_F(VkLayerTest, CreatePipelineVertexOutputNotConsumed) { - TEST_DESCRIPTION( - "Test that a warning is produced for a vertex output that " - "is not consumed by the fragment stage"); + TEST_DESCRIPTION("Test that a warning is produced for a vertex output that is not consumed by the fragment stage"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, "not consumed by fragment shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -15663,7 +15600,7 @@ TEST_F(VkPositiveLayerTest, CreatePipelineComplexTypes) { "void main() {}"; char const *tcsSource = "#version 450\n" - "layout(vertices=3) out;" + "layout(vertices=3) out;\n" "struct S { int x; };\n" "layout(location=2) patch out B { S s; } b;\n" "void main() {\n" @@ -15810,7 +15747,10 @@ TEST_F(VkLayerTest, CreatePipelineCheckShaderBadSpecialization) { // Set up the info describing spec map and data const VkSpecializationInfo specialization_info = { - 1, &entry, 1 * sizeof(float), &data, + 1, + &entry, + 1 * sizeof(float), + &data, }; shader_stage_create_info[0].pSpecializationInfo = &specialization_info; @@ -15915,8 +15855,8 @@ TEST_F(VkLayerTest, CreatePipelineCheckShaderDescriptorNotAccessible) { TEST_F(VkLayerTest, CreatePipelineCheckShaderPushConstantNotAccessible) { TEST_DESCRIPTION( - "Create a graphics pipleine in which a push constant range containing a push constant block member is not " - "accessible from the current shader stage."); + "Create a graphics pipleine in which a push constant range containing a push constant block member is not accessible from " + "the current shader stage."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -16021,12 +15961,12 @@ TEST_F(VkLayerTest, CreateShaderModuleCheckBadCapability) { char const *vsSource = "#version 450\n" "\n" - "layout(xfb_buffer = 1) out;" + "layout(xfb_buffer = 1) out;\n" "void main(){\n" " gl_Position = vec4(1);\n" "}\n"; - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Capability value 53 is not allowed by Vulkan"); + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Capability TransformFeedback is not allowed by Vulkan"); std::vector<unsigned int> spv; VkShaderModuleCreateInfo module_create_info; @@ -16128,8 +16068,7 @@ TEST_F(VkPositiveLayerTest, CreatePipelineCheckShaderCapabilityExtension2of2) { TEST_F(VkLayerTest, CreatePipelineFragmentInputNotProvided) { TEST_DESCRIPTION( - "Test that an error is produced for a fragment shader input " - "which is not present in the outputs of the previous stage"); + "Test that an error is produced for a fragment shader input which is not present in the outputs of the previous stage"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "not written by vertex shader"); @@ -16170,8 +16109,7 @@ TEST_F(VkLayerTest, CreatePipelineFragmentInputNotProvided) { TEST_F(VkLayerTest, CreatePipelineFragmentInputNotProvidedInBlock) { TEST_DESCRIPTION( - "Test that an error is produced for a fragment shader input " - "within an interace block, which is not present in the outputs " + "Test that an error is produced for a fragment shader input within an interace block, which is not present in the outputs " "of the previous stage."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "not written by vertex shader"); @@ -16211,13 +16149,10 @@ TEST_F(VkLayerTest, CreatePipelineFragmentInputNotProvidedInBlock) { } TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatchArraySize) { - TEST_DESCRIPTION( - "Test that an error is produced for mismatched array sizes " - "across the vertex->fragment shader interface"); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "Type mismatch on location 0.0: 'ptr to " - "output arr[2] of float32' vs 'ptr to " - "input arr[1] of float32'"); + TEST_DESCRIPTION("Test that an error is produced for mismatched array sizes across the vertex->fragment shader interface"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "Type mismatch on location 0.0: 'ptr to output arr[2] of float32' vs 'ptr to input arr[1] of float32'"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -16257,9 +16192,7 @@ TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatchArraySize) { } TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatch) { - TEST_DESCRIPTION( - "Test that an error is produced for mismatched types across " - "the vertex->fragment shader interface"); + TEST_DESCRIPTION("Test that an error is produced for mismatched types across the vertex->fragment shader interface"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Type mismatch on location 0"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16301,9 +16234,8 @@ TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatch) { TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatchInBlock) { TEST_DESCRIPTION( - "Test that an error is produced for mismatched types across " - "the vertex->fragment shader interface, when the variable is contained within " - "an interface block"); + "Test that an error is produced for mismatched types across the vertex->fragment shader interface, when the variable is " + "contained within an interface block"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Type mismatch on location 0"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16345,9 +16277,8 @@ TEST_F(VkLayerTest, CreatePipelineVsFsTypeMismatchInBlock) { TEST_F(VkLayerTest, CreatePipelineVsFsMismatchByLocation) { TEST_DESCRIPTION( - "Test that an error is produced for location mismatches across " - "the vertex->fragment shader interface; This should manifest as a not-written/not-consumed " - "pair, but flushes out broken walking of the interfaces"); + "Test that an error is produced for location mismatches across the vertex->fragment shader interface; This should manifest " + "as a not-written/not-consumed pair, but flushes out broken walking of the interfaces"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "location 0.0 which is not written by vertex shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16389,9 +16320,8 @@ TEST_F(VkLayerTest, CreatePipelineVsFsMismatchByLocation) { TEST_F(VkLayerTest, CreatePipelineVsFsMismatchByComponent) { TEST_DESCRIPTION( - "Test that an error is produced for component mismatches across the " - "vertex->fragment shader interface. It's not enough to have the same set of locations in " - "use; matching is defined in terms of spirv variables."); + "Test that an error is produced for component mismatches across the vertex->fragment shader interface. It's not enough to " + "have the same set of locations in use; matching is defined in terms of spirv variables."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "location 0.1 which is not written by vertex shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16502,9 +16432,7 @@ TEST_F(VkLayerTest, CreatePipelineVsFsMismatchByPrecisionBlock) { } TEST_F(VkLayerTest, CreatePipelineAttribNotConsumed) { - TEST_DESCRIPTION( - "Test that a warning is produced for a vertex attribute which is " - "not consumed by the vertex shader"); + TEST_DESCRIPTION("Test that a warning is produced for a vertex attribute which is not consumed by the vertex shader"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, "location 0 not consumed by vertex shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16553,8 +16481,8 @@ TEST_F(VkLayerTest, CreatePipelineAttribNotConsumed) { TEST_F(VkLayerTest, CreatePipelineAttribLocationMismatch) { TEST_DESCRIPTION( - "Test that a warning is produced for a location mismatch on " - "vertex attributes. This flushes out bad behavior in the interface walker"); + "Test that a warning is produced for a location mismatch on vertex attributes. This flushes out bad behavior in the " + "interface walker"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, "location 0 not consumed by vertex shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -16604,9 +16532,7 @@ TEST_F(VkLayerTest, CreatePipelineAttribLocationMismatch) { } TEST_F(VkLayerTest, CreatePipelineAttribNotProvided) { - TEST_DESCRIPTION( - "Test that an error is produced for a vertex shader input which is not " - "provided by a vertex attribute"); + TEST_DESCRIPTION("Test that an error is produced for a vertex shader input which is not provided by a vertex attribute"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Vertex shader consumes input at location 0 but not provided"); @@ -16647,8 +16573,7 @@ TEST_F(VkLayerTest, CreatePipelineAttribNotProvided) { TEST_F(VkLayerTest, CreatePipelineAttribTypeMismatch) { TEST_DESCRIPTION( - "Test that an error is produced for a mismatch between the " - "fundamental type (float/int/uint) of an attribute and the " + "Test that an error is produced for a mismatch between the fundamental type (float/int/uint) of an attribute and the " "vertex shader input that consumes it"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "location 0 does not match vertex shader input type"); @@ -16698,9 +16623,7 @@ TEST_F(VkLayerTest, CreatePipelineAttribTypeMismatch) { } TEST_F(VkLayerTest, CreatePipelineDuplicateStage) { - TEST_DESCRIPTION( - "Test that an error is produced for a pipeline containing multiple " - "shaders for the same stage"); + TEST_DESCRIPTION("Test that an error is produced for a pipeline containing multiple shaders for the same stage"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Multiple shaders provided for stage VK_SHADER_STAGE_VERTEX_BIT"); @@ -16776,9 +16699,9 @@ TEST_F(VkLayerTest, CreatePipelineMissingEntrypoint) { } TEST_F(VkLayerTest, CreatePipelineDepthStencilRequired) { - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "pDepthStencilState is NULL when rasterization is enabled and subpass " - "uses a depth/stencil attachment"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "pDepthStencilState is NULL when rasterization is enabled and subpass uses a depth/stencil attachment"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -16808,18 +16731,31 @@ TEST_F(VkLayerTest, CreatePipelineDepthStencilRequired) { VkAttachmentDescription attachments[] = { { - 0, VK_FORMAT_B8G8R8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, - VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_UNDEFINED, + 0, + VK_FORMAT_B8G8R8A8_UNORM, + VK_SAMPLE_COUNT_1_BIT, + VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }, { - 0, VK_FORMAT_D16_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, - VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_UNDEFINED, + 0, + VK_FORMAT_D16_UNORM, + VK_SAMPLE_COUNT_1_BIT, + VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, }, }; VkAttachmentReference refs[] = { - {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, {1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}, + {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + {1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}, }; VkSubpassDescription subpass = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 1, &refs[0], nullptr, &refs[1], 0, nullptr}; VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, nullptr, 0, 2, attachments, 1, &subpass, 0, nullptr}; @@ -16836,12 +16772,11 @@ TEST_F(VkLayerTest, CreatePipelineDepthStencilRequired) { TEST_F(VkLayerTest, CreatePipelineTessPatchDecorationMismatch) { TEST_DESCRIPTION( - "Test that an error is produced for a variable output from " - "the TCS without the patch decoration, but consumed in the TES " + "Test that an error is produced for a variable output from the TCS without the patch decoration, but consumed in the TES " "with the decoration."); - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "is per-vertex in tessellation control shader stage " - "but per-patch in tessellation evaluation shader stage"); + m_errorMonitor->SetDesiredFailureMsg( + VK_DEBUG_REPORT_ERROR_BIT_EXT, + "is per-vertex in tessellation control shader stage but per-patch in tessellation evaluation shader stage"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -17041,8 +16976,7 @@ TEST_F(VkLayerTest, CreatePipelineTessErrors) { TEST_F(VkLayerTest, CreatePipelineAttribBindingConflict) { TEST_DESCRIPTION( - "Test that an error is produced for a vertex attribute setup where multiple " - "bindings provide the same location"); + "Test that an error is produced for a vertex attribute setup where multiple bindings provide the same location"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Duplicate vertex input binding descriptions for binding 0"); @@ -17094,8 +17028,8 @@ TEST_F(VkLayerTest, CreatePipelineAttribBindingConflict) { TEST_F(VkLayerTest, CreatePipelineFragmentOutputNotWritten) { TEST_DESCRIPTION( - "Test that an error is produced for a fragment shader which does not " - "provide an output for one of the pipeline's color attachments"); + "Test that an error is produced for a fragment shader which does not provide an output for one of the pipeline's color " + "attachments"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Attachment 0 not written by fragment shader"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -17134,23 +17068,23 @@ TEST_F(VkLayerTest, CreatePipelineFragmentOutputNotWritten) { TEST_F(VkPositiveLayerTest, CreatePipelineFragmentOutputNotWrittenButMasked) { TEST_DESCRIPTION( - "Test that no error is produced when the fragment shader fails to declare an output," - " but the corresponding attachment's write mask is 0."); + "Test that no error is produced when the fragment shader fails to declare an output, but the corresponding attachment's " + "write mask is 0."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); char const *vsSource = "#version 450\n" - "\n" - "void main(){\n" - " gl_Position = vec4(1);\n" - "}\n"; + "\n" + "void main(){\n" + " gl_Position = vec4(1);\n" + "}\n"; char const *fsSource = "#version 450\n" - "\n" - "void main(){\n" - "}\n"; + "\n" + "void main(){\n" + "}\n"; VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX_BIT, this); VkShaderObj fs(m_device, fsSource, VK_SHADER_STAGE_FRAGMENT_BIT, this); @@ -17174,8 +17108,7 @@ TEST_F(VkPositiveLayerTest, CreatePipelineFragmentOutputNotWrittenButMasked) { TEST_F(VkLayerTest, CreatePipelineFragmentOutputNotConsumed) { TEST_DESCRIPTION( - "Test that a warning is produced for a fragment shader which provides a spurious " - "output with no matching attachment"); + "Test that a warning is produced for a fragment shader which provides a spurious output with no matching attachment"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_WARNING_BIT_EXT, "fragment shader writes to output location 1 with no matching attachment"); @@ -17220,8 +17153,8 @@ TEST_F(VkLayerTest, CreatePipelineFragmentOutputNotConsumed) { TEST_F(VkLayerTest, CreatePipelineFragmentOutputTypeMismatch) { TEST_DESCRIPTION( - "Test that an error is produced for a mismatch between the fundamental " - "type of an fragment shader output variable, and the format of the corresponding attachment"); + "Test that an error is produced for a mismatch between the fundamental type of an fragment shader output variable, and the " + "format of the corresponding attachment"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "does not match fragment shader output type"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -17262,8 +17195,8 @@ TEST_F(VkLayerTest, CreatePipelineFragmentOutputTypeMismatch) { TEST_F(VkLayerTest, CreatePipelineUniformBlockNotProvided) { TEST_DESCRIPTION( - "Test that an error is produced for a shader consuming a uniform " - "block which has no corresponding binding in the pipeline layout"); + "Test that an error is produced for a shader consuming a uniform block which has no corresponding binding in the pipeline " + "layout"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "not declared in pipeline layout"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -17304,8 +17237,7 @@ TEST_F(VkLayerTest, CreatePipelineUniformBlockNotProvided) { TEST_F(VkLayerTest, CreatePipelinePushConstantsNotInLayout) { TEST_DESCRIPTION( - "Test that an error is produced for a shader consuming push constants " - "which are not provided in the pipeline layout"); + "Test that an error is produced for a shader consuming push constants which are not provided in the pipeline layout"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "not declared in layout"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -17347,8 +17279,8 @@ TEST_F(VkLayerTest, CreatePipelinePushConstantsNotInLayout) { TEST_F(VkLayerTest, CreatePipelineInputAttachmentMissing) { TEST_DESCRIPTION( - "Test that an error is produced for a shader consuming an input attachment " - "which is not included in the subpass description"); + "Test that an error is produced for a shader consuming an input attachment which is not included in the subpass " + "description"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "consumes input attachment index 0 but not provided in subpass"); @@ -17391,8 +17323,8 @@ TEST_F(VkLayerTest, CreatePipelineInputAttachmentMissing) { TEST_F(VkLayerTest, CreatePipelineInputAttachmentTypeMismatch) { TEST_DESCRIPTION( - "Test that an error is produced for a shader consuming an input attachment " - "with a format having a different fundamental type"); + "Test that an error is produced for a shader consuming an input attachment with a format having a different fundamental " + "type"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "input attachment 0 format of VK_FORMAT_R8G8B8A8_UINT does not match"); @@ -17435,10 +17367,12 @@ TEST_F(VkLayerTest, CreatePipelineInputAttachmentTypeMismatch) { VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL}, }; VkAttachmentReference color = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + 0, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }; VkAttachmentReference input = { - 1, VK_IMAGE_LAYOUT_GENERAL, + 1, + VK_IMAGE_LAYOUT_GENERAL, }; VkSubpassDescription sd = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 1, &input, 1, &color, nullptr, nullptr, 0, nullptr}; @@ -17458,8 +17392,8 @@ TEST_F(VkLayerTest, CreatePipelineInputAttachmentTypeMismatch) { TEST_F(VkLayerTest, CreatePipelineInputAttachmentMissingArray) { TEST_DESCRIPTION( - "Test that an error is produced for a shader consuming an input attachment " - "which is not included in the subpass description -- array case"); + "Test that an error is produced for a shader consuming an input attachment which is not included in the subpass " + "description -- array case"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "consumes input attachment index 0 but not provided in subpass"); @@ -17502,8 +17436,8 @@ TEST_F(VkLayerTest, CreatePipelineInputAttachmentMissingArray) { TEST_F(VkLayerTest, CreateComputePipelineMissingDescriptor) { TEST_DESCRIPTION( - "Test that an error is produced for a compute pipeline consuming a " - "descriptor which is not provided in the pipeline layout"); + "Test that an error is produced for a compute pipeline consuming a descriptor which is not provided in the pipeline " + "layout"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Shader uses descriptor slot 0.0"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -17542,9 +17476,7 @@ TEST_F(VkLayerTest, CreateComputePipelineMissingDescriptor) { } TEST_F(VkLayerTest, CreateComputePipelineDescriptorTypeMismatch) { - TEST_DESCRIPTION( - "Test that an error is produced for a pipeline consuming a " - "descriptor-backed resource of a mismatched type"); + TEST_DESCRIPTION("Test that an error is produced for a pipeline consuming a descriptor-backed resource of a mismatched type"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "but descriptor of type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER"); @@ -17586,8 +17518,7 @@ TEST_F(VkLayerTest, CreateComputePipelineDescriptorTypeMismatch) { TEST_F(VkLayerTest, DrawTimeImageViewTypeMismatchWithPipeline) { TEST_DESCRIPTION( - "Test that an error is produced when an image view type " - "does not match the dimensionality declared in the shader"); + "Test that an error is produced when an image view type does not match the dimensionality declared in the shader"); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "requires an image view of type VK_IMAGE_VIEW_TYPE_3D"); @@ -17646,8 +17577,8 @@ TEST_F(VkLayerTest, DrawTimeImageViewTypeMismatchWithPipeline) { TEST_F(VkLayerTest, DrawTimeImageMultisampleMismatchWithPipeline) { TEST_DESCRIPTION( - "Test that an error is produced when a multisampled images " - "are consumed via singlesample images types in the shader, or vice versa."); + "Test that an error is produced when a multisampled images are consumed via singlesample images types in the shader, or " + "vice versa."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "requires bound image to have multiple samples"); @@ -17674,7 +17605,7 @@ TEST_F(VkLayerTest, DrawTimeImageMultisampleMismatchWithPipeline) { pipe.AddShader(&fs); pipe.AddDefaultColorAttachment(); - VkTextureObj texture(m_device, nullptr); // THIS LINE CAUSES CRASH ON MALI + VkTextureObj texture(m_device, nullptr); // THIS LINE CAUSES CRASH ON MALI VkSamplerObj sampler(m_device); VkDescriptorSetObj descriptorSet(m_device); @@ -17775,9 +17706,7 @@ TEST_F(VkLayerTest, CreateImageMinLimitsViolation) { } TEST_F(VkLayerTest, AttachmentDescriptionUndefinedFormat) { - TEST_DESCRIPTION( - "Create a render pass with an attachment description " - "format set to VK_FORMAT_UNDEFINED"); + TEST_DESCRIPTION("Create a render pass with an attachment description format set to VK_FORMAT_UNDEFINED"); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -18385,7 +18314,7 @@ TEST_F(VkLayerTest, CreateImageViewInvalidSubresourceRange) { "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_2D_ARRAY, " "pCreateInfo->subresourceRange.layerCount must be >= 1"); // TODO: The test environment aborts the Vulkan call in parameter_validation layer before VALIDATION_ERROR_0ac00b92 test - //m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_0ac00b92); + // m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_0ac00b92); const VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 0}; VkImageViewCreateInfo img_view_info = img_view_info_template; img_view_info.subresourceRange = range; @@ -20703,9 +20632,7 @@ TEST_F(VkLayerTest, DepthStencilImageViewWithColorAspectBitError) { } TEST_F(VkLayerTest, ClearImageErrors) { - TEST_DESCRIPTION( - "Call ClearColorImage w/ a depth|stencil image and " - "ClearDepthStencilImage with a color image."); + TEST_DESCRIPTION("Call ClearColorImage w/ a depth|stencil image and ClearDepthStencilImage with a color image."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -20765,9 +20692,7 @@ TEST_F(VkLayerTest, ClearImageErrors) { m_errorMonitor->VerifyFound(); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "vkCmdClearColorImage called with " - "image created without " - "VK_IMAGE_USAGE_TRANSFER_DST_BIT"); + "vkCmdClearColorImage called with image created without VK_IMAGE_USAGE_TRANSFER_DST_BIT"); vkCmdClearColorImage(m_commandBuffer->handle(), color_image_no_transfer.handle(), VK_IMAGE_LAYOUT_GENERAL, &clear_color, 1, &color_range); @@ -20786,8 +20711,7 @@ TEST_F(VkLayerTest, ClearImageErrors) { TEST_F(VkLayerTest, CommandQueueFlags) { TEST_DESCRIPTION( - "Allocate a command buffer on a queue that does not support graphics and try to issue a " - "graphics-only command"); + "Allocate a command buffer on a queue that does not support graphics and try to issue a graphics-only command"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -20862,7 +20786,7 @@ TEST_F(VkLayerTest, Maintenance1AndNegativeViewport) { ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); if (!((DeviceExtensionSupported(gpu(), nullptr, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) && - (DeviceExtensionSupported(gpu(), nullptr, VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME)))) { + (DeviceExtensionSupported(gpu(), nullptr, VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME)))) { printf(" Maintenance1 and AMD_negative viewport height extensions not supported, skipping test\n"); return; } @@ -21153,9 +21077,7 @@ TEST_F(VkPositiveLayerTest, SecondaryCommandBufferClearColorAttachments) { } TEST_F(VkPositiveLayerTest, SecondaryCommandBufferImageLayoutTransitions) { - TEST_DESCRIPTION( - "Perform an image layout transition in a secondary command buffer followed " - "by a transition in the primary."); + TEST_DESCRIPTION("Perform an image layout transition in a secondary command buffer followed by a transition in the primary."); VkResult err; m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -21246,12 +21168,9 @@ TEST_F(VkPositiveLayerTest, SecondaryCommandBufferImageLayoutTransitions) { // This is a positive test. No failures are expected. TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { TEST_DESCRIPTION( - "Ensure that the vkUpdateDescriptorSets validation code " - "is ignoring VkWriteDescriptorSet members that are not " - "related to the descriptor type specified by " - "VkWriteDescriptorSet::descriptorType. Correct " - "validation behavior will result in the test running to " - "completion without validation errors."); + "Ensure that the vkUpdateDescriptorSets validation code is ignoring VkWriteDescriptorSet members that are not related to " + "the descriptor type specified by VkWriteDescriptorSet::descriptorType. Correct validation behavior will result in the " + "test running to completion without validation errors."); const uintptr_t invalid_ptr = 0xcdcdcdcd; @@ -21443,9 +21362,7 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { } TEST_F(VkPositiveLayerTest, ImmutableSamplerOnlyDescriptor) { - TEST_DESCRIPTION( - "Bind a DescriptorSet with only an immutable sampler" - "and make sure that we don't warn for no update."); + TEST_DESCRIPTION("Bind a DescriptorSet with only an immutable samplerand make sure that we don't warn for no update."); ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); @@ -22179,9 +22096,7 @@ TEST_F(VkPositiveLayerTest, TestAliasedMemoryTracking) { bool pass; TEST_DESCRIPTION( - "Create a buffer, allocate memory, bind memory, destroy " - "the buffer, create an image, and bind the same memory to " - "it"); + "Create a buffer, allocate memory, bind memory, destroy the buffer, create an image, and bind the same memory to it"); m_errorMonitor->ExpectSuccess(); @@ -22305,9 +22220,7 @@ TEST_F(VkPositiveLayerTest, TestAliasedMemoryTracking) { TEST_F(VkPositiveLayerTest, TestDestroyFreeNullHandles) { VkResult err; - TEST_DESCRIPTION( - "Call all applicable destroy and free routines with NULL" - "handles, expecting no validation errors"); + TEST_DESCRIPTION("Call all applicable destroy and free routines with NULL handles, expecting no validation errors"); m_errorMonitor->ExpectSuccess(); @@ -22635,8 +22548,7 @@ TEST_F(VkPositiveLayerTest, DynamicOffsetWithInactiveBinding) { TEST_F(VkPositiveLayerTest, NonCoherentMemoryMapping) { TEST_DESCRIPTION( - "Ensure that validations handling of non-coherent memory " - "mapping while using VK_WHOLE_SIZE does not cause access " + "Ensure that validations handling of non-coherent memory mapping while using VK_WHOLE_SIZE does not cause access " "violations"); VkResult err; uint8_t *pData; @@ -22886,9 +22798,7 @@ TEST_F(VkPositiveLayerTest, CreateImageViewFollowsParameterCompatibilityRequirem } TEST_F(VkPositiveLayerTest, ValidUsage) { - TEST_DESCRIPTION( - "Verify that creating an image view from an image with valid usage " - "doesn't generate validation errors"); + TEST_DESCRIPTION("Verify that creating an image view from an image with valid usage doesn't generate validation errors"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -22915,9 +22825,7 @@ TEST_F(VkPositiveLayerTest, ValidUsage) { // This is a positive test. No failures are expected. TEST_F(VkPositiveLayerTest, BindSparse) { - TEST_DESCRIPTION( - "Bind 2 memory ranges to one image using vkQueueBindSparse, destroy the image" - "and then free the memory"); + TEST_DESCRIPTION("Bind 2 memory ranges to one image using vkQueueBindSparse, destroy the image and then free the memory"); ASSERT_NO_FATAL_FAILURE(Init()); @@ -23008,10 +22916,8 @@ TEST_F(VkPositiveLayerTest, BindSparse) { TEST_F(VkPositiveLayerTest, RenderPassInitialLayoutUndefined) { TEST_DESCRIPTION( - "Ensure that CmdBeginRenderPass with an attachment's " - "initialLayout of VK_IMAGE_LAYOUT_UNDEFINED works when " - "the command buffer has prior knowledge of that " - "attachment's layout."); + "Ensure that CmdBeginRenderPass with an attachment's initialLayout of VK_IMAGE_LAYOUT_UNDEFINED works when the command " + "buffer has prior knowledge of that attachment's layout."); m_errorMonitor->ExpectSuccess(); @@ -23084,10 +22990,8 @@ TEST_F(VkPositiveLayerTest, RenderPassInitialLayoutUndefined) { TEST_F(VkPositiveLayerTest, FramebufferBindingDestroyCommandPool) { TEST_DESCRIPTION( - "This test should pass. Create a Framebuffer and " - "command buffer, bind them together, then destroy " - "command pool and framebuffer and verify there are no " - "errors."); + "This test should pass. Create a Framebuffer and command buffer, bind them together, then destroy command pool and " + "framebuffer and verify there are no errors."); m_errorMonitor->ExpectSuccess(); @@ -23160,9 +23064,7 @@ TEST_F(VkPositiveLayerTest, FramebufferBindingDestroyCommandPool) { } TEST_F(VkPositiveLayerTest, RenderPassSubpassZeroTransitionsApplied) { - TEST_DESCRIPTION( - "Ensure that CmdBeginRenderPass applies the layout " - "transitions for the first subpass"); + TEST_DESCRIPTION("Ensure that CmdBeginRenderPass applies the layout transitions for the first subpass"); m_errorMonitor->ExpectSuccess(); @@ -23242,10 +23144,8 @@ TEST_F(VkPositiveLayerTest, RenderPassSubpassZeroTransitionsApplied) { TEST_F(VkPositiveLayerTest, DepthStencilLayoutTransitionForDepthOnlyImageview) { TEST_DESCRIPTION( - "Validate that when an imageView of a depth/stencil image " - "is used as a depth/stencil framebuffer attachment, the " - "aspectMask is ignored and both depth and stencil image " - "subresources are used."); + "Validate that when an imageView of a depth/stencil image is used as a depth/stencil framebuffer attachment, the " + "aspectMask is ignored and both depth and stencil image subresources are used."); ASSERT_NO_FATAL_FAILURE(Init()); VkFormatProperties format_properties; @@ -23343,9 +23243,7 @@ TEST_F(VkPositiveLayerTest, DepthStencilLayoutTransitionForDepthOnlyImageview) { TEST_F(VkPositiveLayerTest, RenderPassTransitionsAttachmentUnused) { TEST_DESCRIPTION( - "Ensure that layout transitions work correctly without " - "errors, when an attachment reference is " - "VK_ATTACHMENT_UNUSED"); + "Ensure that layout transitions work correctly without errors, when an attachment reference is VK_ATTACHMENT_UNUSED"); m_errorMonitor->ExpectSuccess(); @@ -23383,9 +23281,7 @@ TEST_F(VkPositiveLayerTest, RenderPassTransitionsAttachmentUnused) { // This is a positive test. No errors are expected. TEST_F(VkPositiveLayerTest, StencilLoadOp) { - TEST_DESCRIPTION( - "Create a stencil-only attachment with a LOAD_OP set to " - "CLEAR. stencil[Load|Store]Op used to be ignored."); + TEST_DESCRIPTION("Create a stencil-only attachment with a LOAD_OP set to CLEAR. stencil[Load|Store]Op used to be ignored."); VkResult result = VK_SUCCESS; ASSERT_NO_FATAL_FAILURE(Init()); auto depth_format = FindSupportedDepthStencilFormat(gpu()); @@ -23952,9 +23848,7 @@ TEST_F(VkLayerTest, ResetEventThenSet) { vkQueueSubmit(queue, 1, &submit_info, VK_NULL_HANDLE); } { - m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, - "that is already in use by a " - "command buffer."); + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "that is already in use by a command buffer."); vkSetEvent(m_device->device(), event); m_errorMonitor->VerifyFound(); } @@ -23969,10 +23863,8 @@ TEST_F(VkLayerTest, ResetEventThenSet) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoFencesThreeFrames) { TEST_DESCRIPTION( - "Two command buffers with two separate fences are each " - "run through a Submit & WaitForFences cycle 3 times. This " - "previously revealed a bug so running this positive test " - "to prevent a regression."); + "Two command buffers with two separate fences are each run through a Submit & WaitForFences cycle 3 times. This previously " + "revealed a bug so running this positive test to prevent a regression."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -24043,8 +23935,7 @@ TEST_F(VkPositiveLayerTest, TwoFencesThreeFrames) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenceQWI) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "submitted on separate queues followed by a QueueWaitIdle."); + "Two command buffers, each in a separate QueueSubmit call submitted on separate queues followed by a QueueWaitIdle."); ASSERT_NO_FATAL_FAILURE(Init()); if ((m_device->queue_props.empty()) || (m_device->queue_props[0].queueCount < 2)) return; @@ -24140,9 +24031,8 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenc // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenceQWIFence) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "submitted on separate queues, the second having a fence" - "followed by a QueueWaitIdle."); + "Two command buffers, each in a separate QueueSubmit call submitted on separate queues, the second having a fencefollowed " + "by a QueueWaitIdle."); ASSERT_NO_FATAL_FAILURE(Init()); if ((m_device->queue_props.empty()) || (m_device->queue_props[0].queueCount < 2)) return; @@ -24244,9 +24134,8 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenc // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenceTwoWFF) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "submitted on separate queues, the second having a fence" - "followed by two consecutive WaitForFences calls on the same fence."); + "Two command buffers, each in a separate QueueSubmit call submitted on separate queues, the second having a fencefollowed " + "by two consecutive WaitForFences calls on the same fence."); ASSERT_NO_FATAL_FAILURE(Init()); if ((m_device->queue_props.empty()) || (m_device->queue_props[0].queueCount < 2)) return; @@ -24416,8 +24305,7 @@ TEST_F(VkPositiveLayerTest, TwoQueuesEnsureCorrectRetirementWithWorkStolen) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFence) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "submitted on separate queues, the second having a fence, " + "Two command buffers, each in a separate QueueSubmit call submitted on separate queues, the second having a fence, " "followed by a WaitForFences call."); ASSERT_NO_FATAL_FAILURE(Init()); @@ -24520,10 +24408,8 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsSeparateQueuesWithSemaphoreAndOneFenc // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueWithSemaphoreAndOneFence) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "on the same queue, sharing a signal/wait semaphore, the " - "second having a fence, " - "followed by a WaitForFences call."); + "Two command buffers, each in a separate QueueSubmit call on the same queue, sharing a signal/wait semaphore, the second " + "having a fence, followed by a WaitForFences call."); m_errorMonitor->ExpectSuccess(); @@ -24620,9 +24506,8 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueWithSemaphoreAndOneFence) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueNullQueueSubmitWithFence) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "on the same queue, no fences, followed by a third QueueSubmit with NO " - "SubmitInfos but with a fence, followed by a WaitForFences call."); + "Two command buffers, each in a separate QueueSubmit call on the same queue, no fences, followed by a third QueueSubmit " + "with NO SubmitInfos but with a fence, followed by a WaitForFences call."); m_errorMonitor->ExpectSuccess(); @@ -24716,9 +24601,8 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueNullQueueSubmitWithFence) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueOneFence) { TEST_DESCRIPTION( - "Two command buffers, each in a separate QueueSubmit call " - "on the same queue, the second having a fence, followed " - "by a WaitForFences call."); + "Two command buffers, each in a separate QueueSubmit call on the same queue, the second having a fence, followed by a " + "WaitForFences call."); m_errorMonitor->ExpectSuccess(); @@ -24809,8 +24693,7 @@ TEST_F(VkPositiveLayerTest, TwoQueueSubmitsOneQueueOneFence) { // This is a positive test. No errors should be generated. TEST_F(VkPositiveLayerTest, TwoSubmitInfosWithSemaphoreOneQueueSubmitsOneFence) { TEST_DESCRIPTION( - "Two command buffers each in a separate SubmitInfo sent in a single " - "QueueSubmit call followed by a WaitForFences call."); + "Two command buffers each in a separate SubmitInfo sent in a single QueueSubmit call followed by a WaitForFences call."); ASSERT_NO_FATAL_FAILURE(Init()); m_errorMonitor->ExpectSuccess(); @@ -24931,10 +24814,8 @@ TEST_F(VkPositiveLayerTest, RenderPassSecondaryCommandBuffersMultipleTimes) { TEST_F(VkPositiveLayerTest, ValidRenderPassAttachmentLayoutWithLoadOp) { TEST_DESCRIPTION( - "Positive test where we create a renderpass with an " - "attachment that uses LOAD_OP_CLEAR, the first subpass " - "has a valid layout, and a second subpass then uses a " - "valid *READ_ONLY* layout."); + "Positive test where we create a renderpass with an attachment that uses LOAD_OP_CLEAR, the first subpass has a valid " + "layout, and a second subpass then uses a valid *READ_ONLY* layout."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); auto depth_format = FindSupportedDepthStencilFormat(gpu()); @@ -24980,9 +24861,8 @@ TEST_F(VkPositiveLayerTest, ValidRenderPassAttachmentLayoutWithLoadOp) { TEST_F(VkPositiveLayerTest, RenderPassDepthStencilLayoutTransition) { TEST_DESCRIPTION( - "Create a render pass with depth-stencil attachment where layout transition " - "from UNDEFINED TO DS_READ_ONLY_OPTIMAL is set by render pass and verify that " - "transition has correctly occurred at queue submit time with no validation errors."); + "Create a render pass with depth-stencil attachment where layout transition from UNDEFINED TO DS_READ_ONLY_OPTIMAL is set " + "by render pass and verify that transition has correctly occurred at queue submit time with no validation errors."); ASSERT_NO_FATAL_FAILURE(Init()); auto depth_format = FindSupportedDepthStencilFormat(gpu()); @@ -25061,9 +24941,7 @@ TEST_F(VkPositiveLayerTest, RenderPassDepthStencilLayoutTransition) { } TEST_F(VkPositiveLayerTest, CreatePipelineAttribMatrixType) { - TEST_DESCRIPTION( - "Test that pipeline validation accepts matrices passed " - "as vertex attributes"); + TEST_DESCRIPTION("Test that pipeline validation accepts matrices passed as vertex attributes"); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25170,9 +25048,8 @@ TEST_F(VkPositiveLayerTest, CreatePipelineAttribArrayType) { TEST_F(VkPositiveLayerTest, CreatePipelineAttribComponents) { TEST_DESCRIPTION( - "Test that pipeline validation accepts consuming a vertex attribute " - "through multiple vertex shader inputs, each consuming a different " - "subset of the components."); + "Test that pipeline validation accepts consuming a vertex attribute through multiple vertex shader inputs, each consuming " + "a different subset of the components."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25265,9 +25142,8 @@ TEST_F(VkPositiveLayerTest, CreatePipelineSimplePositive) { TEST_F(VkPositiveLayerTest, CreatePipelineRelaxedTypeMatch) { TEST_DESCRIPTION( - "Test that pipeline validation accepts the relaxed type matching rules " - "set out in 14.1.3: fundamental type must match, and producer side must " - "have at least as many components"); + "Test that pipeline validation accepts the relaxed type matching rules set out in 14.1.3: fundamental type must match, and " + "producer side must have at least as many components"); m_errorMonitor->ExpectSuccess(); // VK 1.0.8 Specification, 14.1.3 "Additionally,..." block @@ -25315,9 +25191,7 @@ TEST_F(VkPositiveLayerTest, CreatePipelineRelaxedTypeMatch) { } TEST_F(VkPositiveLayerTest, CreatePipelineTessPerVertex) { - TEST_DESCRIPTION( - "Test that pipeline validation accepts per-vertex variables " - "passed between the TCS and TES stages"); + TEST_DESCRIPTION("Test that pipeline validation accepts per-vertex variables passed between the TCS and TES stages"); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25385,10 +25259,8 @@ TEST_F(VkPositiveLayerTest, CreatePipelineTessPerVertex) { TEST_F(VkPositiveLayerTest, CreatePipelineGeometryInputBlockPositive) { TEST_DESCRIPTION( - "Test that pipeline validation accepts a user-defined " - "interface block passed into the geometry shader. This " - "is interesting because the 'extra' array level is not " - "present on the member type, but on the block instance."); + "Test that pipeline validation accepts a user-defined interface block passed into the geometry shader. This is interesting " + "because the 'extra' array level is not present on the member type, but on the block instance."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25442,9 +25314,8 @@ TEST_F(VkPositiveLayerTest, CreatePipelineGeometryInputBlockPositive) { TEST_F(VkPositiveLayerTest, CreatePipeline64BitAttributesPositive) { TEST_DESCRIPTION( - "Test that pipeline validation accepts basic use of 64bit vertex " - "attributes. This is interesting because they consume multiple " - "locations."); + "Test that pipeline validation accepts basic use of 64bit vertex attributes. This is interesting because they consume " + "multiple locations."); m_errorMonitor->ExpectSuccess(); if (!EnableDeviceProfileLayer()) return; @@ -25565,10 +25436,12 @@ TEST_F(VkPositiveLayerTest, CreatePipelineInputAttachmentPositive) { VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL}, }; VkAttachmentReference color = { - 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + 0, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }; VkAttachmentReference input = { - 1, VK_IMAGE_LAYOUT_GENERAL, + 1, + VK_IMAGE_LAYOUT_GENERAL, }; VkSubpassDescription sd = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 1, &input, 1, &color, nullptr, nullptr, 0, nullptr}; @@ -25588,10 +25461,9 @@ TEST_F(VkPositiveLayerTest, CreatePipelineInputAttachmentPositive) { TEST_F(VkPositiveLayerTest, CreateComputePipelineMissingDescriptorUnusedPositive) { TEST_DESCRIPTION( - "Test that pipeline validation accepts a compute pipeline which declares a " - "descriptor-backed resource which is not provided, but the shader does not " - "statically use it. This is interesting because it requires compute pipelines " - "to have a proper descriptor use walk, which they didn't for some time."); + "Test that pipeline validation accepts a compute pipeline which declares a descriptor-backed resource which is not " + "provided, but the shader does not statically use it. This is interesting because it requires compute pipelines to have a " + "proper descriptor use walk, which they didn't for some time."); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25631,8 +25503,7 @@ TEST_F(VkPositiveLayerTest, CreateComputePipelineMissingDescriptorUnusedPositive TEST_F(VkPositiveLayerTest, CreateComputePipelineCombinedImageSamplerConsumedAsSampler) { TEST_DESCRIPTION( - "Test that pipeline validation accepts a shader consuming only the " - "sampler portion of a combined image + sampler"); + "Test that pipeline validation accepts a shader consuming only the sampler portion of a combined image + sampler"); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25679,8 +25550,7 @@ TEST_F(VkPositiveLayerTest, CreateComputePipelineCombinedImageSamplerConsumedAsS TEST_F(VkPositiveLayerTest, CreateComputePipelineCombinedImageSamplerConsumedAsImage) { TEST_DESCRIPTION( - "Test that pipeline validation accepts a shader consuming only the " - "image portion of a combined image + sampler"); + "Test that pipeline validation accepts a shader consuming only the image portion of a combined image + sampler"); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -25727,9 +25597,8 @@ TEST_F(VkPositiveLayerTest, CreateComputePipelineCombinedImageSamplerConsumedAsI TEST_F(VkPositiveLayerTest, CreateComputePipelineCombinedImageSamplerConsumedAsBoth) { TEST_DESCRIPTION( - "Test that pipeline validation accepts a shader consuming " - "both the sampler and the image of a combined image+sampler " - "but via separate variables"); + "Test that pipeline validation accepts a shader consuming both the sampler and the image of a combined image+sampler but " + "via separate variables"); m_errorMonitor->ExpectSuccess(); ASSERT_NO_FATAL_FAILURE(Init()); @@ -26847,9 +26716,7 @@ TEST_F(VkPositiveLayerTest, ExternalMemory) { } TEST_F(VkLayerTest, AMDMixedAttachmentSamplesValidateRenderPass) { - TEST_DESCRIPTION( - "Verify error messages for supported and unsupported " - "sample counts in render pass attachments."); + TEST_DESCRIPTION("Verify error messages for supported and unsupported sample counts in render pass attachments."); ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); if (DeviceExtensionSupported(gpu(), nullptr, VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME)) { @@ -26928,9 +26795,7 @@ TEST_F(VkLayerTest, AMDMixedAttachmentSamplesValidateRenderPass) { } TEST_F(VkLayerTest, AMDMixedAttachmentSamplesValidateGraphicsPipeline) { - TEST_DESCRIPTION( - "Verify an error message for an incorrect graphics pipeline " - "rasterization sample count."); + TEST_DESCRIPTION("Verify an error message for an incorrect graphics pipeline rasterization sample count."); ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); if (DeviceExtensionSupported(gpu(), nullptr, VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME)) { diff --git a/tests/loader_validation_tests.cpp b/tests/loader_validation_tests.cpp index bc6723e28..36442f1c3 100644 --- a/tests/loader_validation_tests.cpp +++ b/tests/loader_validation_tests.cpp @@ -247,7 +247,7 @@ struct DeviceCreateInfo { VkDeviceCreateInfo info; }; -} +} // namespace VK struct CommandLine : public ::testing::Test { static void Initialize(int argc, char **argv) { arguments.assign(argv, argv + argc); }; diff --git a/tests/test_common.h b/tests/test_common.h index 446e5eba2..4e054021a 100644 --- a/tests/test_common.h +++ b/tests/test_common.h @@ -91,7 +91,7 @@ static inline void test_error_callback(const char *expr, const char *file, unsig } #if defined(__linux__) -/* Linux-specific common code: */ + /* Linux-specific common code: */ #include <pthread.h> @@ -159,12 +159,12 @@ static void test_platform_thread_cond_broadcast(test_platform_thread_cond *pCond #error The "test_common.h" file must be modified for this OS. -// NOTE: In order to support another OS, an #elif needs to be added (above the -// "#else // defined(_WIN32)") for that OS, and OS-specific versions of the -// contents of this file must be created. + // NOTE: In order to support another OS, an #elif needs to be added (above the + // "#else // defined(_WIN32)") for that OS, and OS-specific versions of the + // contents of this file must be created. -// NOTE: Other OS-specific changes are also needed for this OS. Search for -// files with "WIN32" in it, as a quick way to find files that must be changed. + // NOTE: Other OS-specific changes are also needed for this OS. Search for + // files with "WIN32" in it, as a quick way to find files that must be changed. #endif // defined(_WIN32) diff --git a/tests/test_environment.cpp b/tests/test_environment.cpp index 1b35168fd..6a988d00e 100644 --- a/tests/test_environment.cpp +++ b/tests/test_environment.cpp @@ -154,4 +154,4 @@ void Environment::TearDown() { if (inst) vkDestroyInstance(inst, NULL); } -} // vk_testing namespace +} // namespace vk_testing diff --git a/tests/test_environment.h b/tests/test_environment.h index a784644e8..83afcc20b 100644 --- a/tests/test_environment.h +++ b/tests/test_environment.h @@ -51,5 +51,5 @@ class Environment : public ::testing::Environment { std::vector<Device *> devs_; }; -} +} // namespace vk_testing #endif // TEST_ENVIRONMENT_H diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp index fc842247e..70cdefa59 100644 --- a/tests/vkrenderframework.cpp +++ b/tests/vkrenderframework.cpp @@ -218,8 +218,7 @@ void VkRenderFramework::InitFramework(PFN_vkDebugReportCallbackEXT dbgFunction, m_DestroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(this->inst, "vkDestroyDebugReportCallbackEXT"); ASSERT_NE(m_DestroyDebugReportCallback, (PFN_vkDestroyDebugReportCallbackEXT)NULL) - << "Did not get function pointer for " - "DestroyDebugReportCallback"; + << "Did not get function pointer for DestroyDebugReportCallback"; m_DebugReportMessage = (PFN_vkDebugReportMessageEXT)vkGetInstanceProcAddr(this->inst, "vkDebugReportMessageEXT"); ASSERT_NE(m_DebugReportMessage, (PFN_vkDebugReportMessageEXT)NULL) << "Did not get function pointer for DebugReportMessage"; @@ -715,7 +714,7 @@ void VkImageObj::ImageMemoryBarrier(VkCommandBufferObj *cmd_buf, VkImageAspectFl VkImageLayout image_layout) { // TODO: Mali device crashing with VK_REMAINING_MIP_LEVELS const VkImageSubresourceRange subresourceRange = - subresource_range(aspect, 0, /*VK_REMAINING_MIP_LEVELS*/ 1, 0, 1/*VK_REMAINING_ARRAY_LAYERS*/); + subresource_range(aspect, 0, /*VK_REMAINING_MIP_LEVELS*/ 1, 0, 1 /*VK_REMAINING_ARRAY_LAYERS*/); VkImageMemoryBarrier barrier; barrier = image_memory_barrier(output_mask, input_mask, Layout(), image_layout, subresourceRange); @@ -1392,7 +1391,7 @@ void VkCommandBufferObj::ClearAllBuffers(const vector<VkImageObj *> &color_objs, subrange.levelCount = 1; // VK_REMAINING_MIP_LEVELS; subrange.baseArrayLayer = 0; // TODO: Mesa crashing with VK_REMAINING_ARRAY_LAYERS - subrange.layerCount = 1; // VK_REMAINING_ARRAY_LAYERS; + subrange.layerCount = 1; // VK_REMAINING_ARRAY_LAYERS; const VkImageLayout clear_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; diff --git a/tests/vktestbinding.cpp b/tests/vktestbinding.cpp index 9890c0cdd..226e74aaa 100644 --- a/tests/vktestbinding.cpp +++ b/tests/vktestbinding.cpp @@ -218,7 +218,8 @@ std::vector<VkLayerProperties> PhysicalDevice::layers() const { return layer_props; } -QueueCreateInfoArray::QueueCreateInfoArray(const std::vector<VkQueueFamilyProperties> &queue_props) : queue_info_(), queue_priorities_() { +QueueCreateInfoArray::QueueCreateInfoArray(const std::vector<VkQueueFamilyProperties> &queue_props) + : queue_info_(), queue_priorities_() { queue_info_.reserve(queue_props.size()); for (uint32_t i = 0; i < (uint32_t)queue_props.size(); ++i) { diff --git a/tests/vktestbinding.h b/tests/vktestbinding.h index 843d58e38..f811182a8 100644 --- a/tests/vktestbinding.h +++ b/tests/vktestbinding.h @@ -213,7 +213,7 @@ class Device : public internal::Handle<VkDevice> { const std::vector<Queue *> &graphics_queues() const { return queues_[GRAPHICS]; } const std::vector<Queue *> &compute_queues() { return queues_[COMPUTE]; } const std::vector<Queue *> &dma_queues() { return queues_[DMA]; } - uint32_t queue_family_without_capabilities( VkQueueFlags capabilities ); + uint32_t queue_family_without_capabilities(VkQueueFlags capabilities); uint32_t graphics_queue_node_index_; struct Format { diff --git a/tests/vktestframework.cpp b/tests/vktestframework.cpp index 9c120cbc1..7e0af96e2 100644 --- a/tests/vktestframework.cpp +++ b/tests/vktestframework.cpp @@ -171,17 +171,14 @@ void VkTestFramework::InitArgs(int *argc, char *argv[]) { "\t\tDisplay test images in viewer after tests complete.\n"); printf( "\t--save-images\n" - "\t\tSave tests images as ppm files in current working " - "directory.\n" + "\t\tSave tests images as ppm files in current working directory.\n" "\t\tUsed to generate golden images for compare-images.\n"); printf( "\t--compare-images\n" "\t\tCompare test images to 'golden' image in golden folder.\n" "\t\tAlso saves the generated test image in current working\n" - "\t\t\tdirectory but only if the image is different from the " - "golden\n" - "\t\tSetting RENDERTEST_GOLDEN_DIR environment variable can " - "specify\n" + "\t\t\tdirectory but only if the image is different from the golden\n" + "\t\tSetting RENDERTEST_GOLDEN_DIR environment variable can specify\n" "\t\t\tdifferent directory for golden images\n" "\t\tSignal test failure if different.\n"); printf( @@ -189,8 +186,7 @@ void VkTestFramework::InitArgs(int *argc, char *argv[]) { "\t\tUse built-in GLSL compiler rather than SPV code path.\n"); printf( "\t--strip-SPV\n" - "\t\tStrip SPIR-V debug information (line numbers, names, " - "etc).\n"); + "\t\tStrip SPIR-V debug information (line numbers, names, etc).\n"); printf( "\t--canonicalize-SPV\n" "\t\tRemap SPIR-V ids before submission to aid compression.\n"); @@ -224,9 +220,7 @@ VkFormat VkTestFramework::GetFormat(VkInstance instance, vk_testing::Device *dev format_props.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { return VK_FORMAT_R8G8B8A8_UNORM; } - printf( - "Error - device does not support VK_FORMAT_B8G8R8A8_UNORM nor " - "VK_FORMAT_R8G8B8A8_UNORM - exiting\n"); + printf("Error - device does not support VK_FORMAT_B8G8R8A8_UNORM nor VK_FORMAT_R8G8B8A8_UNORM - exiting\n"); exit(1); } @@ -357,9 +351,7 @@ void VkTestFramework::ProcessConfigFile() { if (configStrings) config = *configStrings; else { - printf( - "Error opening configuration file; will instead use the " - "default configuration\n"); + printf("Error opening configuration file; will instead use the default configuration\n"); } } @@ -373,10 +365,7 @@ void VkTestFramework::ProcessConfigFile() { while (token) { const char *valueStr = strtok(0, delims); if (valueStr == 0 || !(valueStr[0] == '-' || (valueStr[0] >= '0' && valueStr[0] <= '9'))) { - printf( - "Error: '%s' bad .conf file. Each name must be followed by " - "one number.\n", - valueStr ? valueStr : ""); + printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n", valueStr ? valueStr : ""); return; } int value = atoi(valueStr); diff --git a/windowsRuntimeInstaller/VULKANRT_LICENSE.rtf b/windowsRuntimeInstaller/VULKANRT_LICENSE.rtf Binary files differindex d0ef6c330..c23139b27 100644 --- a/windowsRuntimeInstaller/VULKANRT_LICENSE.rtf +++ b/windowsRuntimeInstaller/VULKANRT_LICENSE.rtf |