diff options
| author | Dave Houlton <daveh@lunarg.com> | 2018-02-07 10:51:23 -0700 |
|---|---|---|
| committer | Dave Houlton <daveh@lunarg.com> | 2018-02-16 09:31:58 -0700 |
| commit | b575cecc062ea5ff65df8002017f81fb05854622 (patch) | |
| tree | f2499673da4609d8bdf67b6ca6f4041fef823a00 | |
| parent | 6ecf456fdf8132a38d8b599e7cf2756a7c09dddf (diff) | |
| download | usermoji-b575cecc062ea5ff65df8002017f81fb05854622.tar.xz | |
layers: clang-format only
Whole-file clang-format of layers .h and .cpp files
Change-Id: I683ad38fa9bced371a923b86d8cc916f2c2aa947
| -rw-r--r-- | layers/buffer_validation.cpp | 395 | ||||
| -rw-r--r-- | layers/buffer_validation.h | 3 | ||||
| -rw-r--r-- | layers/core_validation.cpp | 997 | ||||
| -rw-r--r-- | layers/core_validation.h | 4 | ||||
| -rw-r--r-- | layers/core_validation_error_enums.h | 38 | ||||
| -rw-r--r-- | layers/core_validation_types.h | 58 | ||||
| -rw-r--r-- | layers/descriptor_sets.cpp | 39 | ||||
| -rw-r--r-- | layers/descriptor_sets.h | 2 | ||||
| -rw-r--r-- | layers/object_tracker_utils.cpp | 27 | ||||
| -rw-r--r-- | layers/parameter_name.h | 56 | ||||
| -rw-r--r-- | layers/parameter_validation.h | 371 | ||||
| -rw-r--r-- | layers/parameter_validation_utils.cpp | 216 | ||||
| -rw-r--r-- | layers/shader_validation.cpp | 143 | ||||
| -rw-r--r-- | layers/shader_validation.h | 72 | ||||
| -rw-r--r-- | layers/threading.cpp | 3 | ||||
| -rw-r--r-- | layers/threading.h | 6 | ||||
| -rw-r--r-- | layers/unique_objects.cpp | 55 | ||||
| -rw-r--r-- | layers/unique_objects.h | 5 | ||||
| -rw-r--r-- | layers/vk_format_utils.cpp | 4 | ||||
| -rw-r--r-- | layers/vk_layer_logging.h | 5 | ||||
| -rw-r--r-- | layers/vk_layer_utils.cpp | 1 |
21 files changed, 1170 insertions, 1330 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index c4864a7e..071f41ab 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)); } @@ -2855,19 +2839,18 @@ bool ValidateLayouts(core_validation::layer_data *device_data, VkDevice device, 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 truly is undefined at the start of the render pass."); + "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) { + 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 truly is undefined at the start of the render pass."); + "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."); } } } @@ -2912,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]) { @@ -2978,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; @@ -3038,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)); } } @@ -3067,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; @@ -3113,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; } @@ -3178,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, @@ -3363,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 @@ -3457,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 |= @@ -3516,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]]); } } @@ -3713,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]); } @@ -3735,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]); } @@ -3819,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 @@ -3842,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 b8a3a2ff..9c7fa2af 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 dd91a140..475accf3 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"; } @@ -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); @@ -4350,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]); } } @@ -4476,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); @@ -4646,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; } @@ -4968,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]); } @@ -5009,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, @@ -5045,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); @@ -5652,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); @@ -5689,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]); } } @@ -5699,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]); } } } @@ -5910,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) { @@ -5940,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) { @@ -6008,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; @@ -6031,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; @@ -6157,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]); } @@ -6172,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 @@ -6224,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; @@ -6250,7 +6231,6 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); } else { lock.unlock(); - } } @@ -6373,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); @@ -6383,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()"); @@ -6426,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]); @@ -6787,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); @@ -6812,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); @@ -6995,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); @@ -7023,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); @@ -7099,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, @@ -7134,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]); } @@ -7144,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]); } @@ -7203,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]); } @@ -7212,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; @@ -7233,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]); } @@ -7243,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]); } @@ -7254,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]); @@ -7419,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]); } @@ -7708,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; @@ -7761,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]); } @@ -7826,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); } } @@ -7900,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); } } @@ -7971,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); } @@ -7983,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; @@ -7997,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); @@ -8010,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; @@ -8057,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) { @@ -8067,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); } @@ -8107,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(); @@ -8140,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); }); } } @@ -8190,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; @@ -8204,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]); } @@ -8227,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; @@ -8236,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]); } } } @@ -8289,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]); } @@ -8526,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]); } } @@ -8646,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); @@ -8728,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]); } @@ -8738,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]); } } @@ -8752,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]); } @@ -8765,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]); } } } @@ -8800,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, @@ -8907,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)); } @@ -8927,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, @@ -8978,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, @@ -9157,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); @@ -9178,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)); } @@ -9211,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) { @@ -9255,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; } } @@ -9281,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. @@ -9386,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]); } @@ -9401,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]); @@ -9569,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]); @@ -9582,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]); @@ -9818,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)); } } @@ -10156,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; } @@ -10194,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; @@ -10204,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; @@ -10473,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; @@ -10600,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]); } } @@ -10625,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]); } } @@ -10653,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); } } @@ -10684,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); } } } @@ -10813,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); @@ -10834,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); @@ -10922,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; @@ -11111,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(); @@ -11397,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 @@ -11409,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; @@ -11460,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; } @@ -11588,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); @@ -11612,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; } @@ -11631,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]; @@ -11825,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); } diff --git a/layers/core_validation.h b/layers/core_validation.h index d4a78bbd..de1aeac5 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 12099c32..45d03f65 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 16052793..bc5a554f 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,11 +244,11 @@ 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 get_sparse_reqs_called; // Track if GetImageSparseMemoryRequirements() has been called for this image + 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; @@ -280,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; } }; @@ -452,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 @@ -486,7 +486,6 @@ struct TEMPLATE_STATE { : desc_update_template(update_template), create_info(*pCreateInfo) {} }; - struct QueryObject { VkQueryPool pool; uint32_t index; @@ -503,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; }; @@ -535,7 +534,7 @@ struct hash<ImageSubresourcePair> { return hashVal; } }; -} +} // namespace std // Store layouts and pushconstants for PipelineLayout struct PIPELINE_LAYOUT_NODE { @@ -668,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 @@ -786,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); } }; @@ -797,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; @@ -849,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); @@ -878,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 c14ae034..9294dde9 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; } } @@ -942,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; } @@ -1028,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; } diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h index 016230a8..ac5bede4 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 501083b2..957f347e 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 6459b5e5..05a1d89e 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 e3c5d8f9..82e95eb6 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 c3e76061..65df05d1 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]); } } } @@ -2315,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; @@ -2452,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) && @@ -2526,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, @@ -2652,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]); } @@ -2668,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]); } @@ -2684,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 41885563..aa3ec8a4 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 2f10dcab..10d97655 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 b3e2a17c..d27d75f3 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 9d6a6546..950d77cf 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 699f8ee9..18786f4c 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 e604e915..d8d33935 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 93481e85..83029fe7 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 80192b0e..559b5a45 100644 --- a/layers/vk_layer_logging.h +++ b/layers/vk_layer_logging.h @@ -417,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 @@ -428,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 367c0bf1..d788daf7 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); } - } |
