aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMike Schuchardt <mikes@lunarg.com>2016-12-08 15:36:24 -0700
committerMike Schuchardt <mikes@lunarg.com>2016-12-29 13:04:37 -0700
commit6486c1a235fc1b90989139fa8623d99faa9deff3 (patch)
tree418c2a88bb4fe907b4985673aaa68aae1b8c5653 /layers/core_validation.cpp
parentfde52f9a0b1f05b4d72fafc86f8cf726c215c15e (diff)
downloadusermoji-6486c1a235fc1b90989139fa8623d99faa9deff3.tar.xz
layers: Add valid usage enums to core_validation
Update valid usage enums in subsection of core validation from validateEventStageMask() to validateSecondaryCommandBufferState(), inclusive. Update tests for vkCreateFramebuffer to work with refactored error messages. Change-Id: Ie6138fbfe7422b3a6affac45faeeb198a0ab6bcc
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp274
1 files changed, 144 insertions, 130 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 16f036e5..af550456 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -9551,12 +9551,12 @@ bool validateEventStageMask(VkQueue queue, GLOBAL_CB_NODE *pCB, uint32_t eventCo
// but set event can be called at any time.
if (sourceStageMask != stageMask && sourceStageMask != (stageMask | VK_PIPELINE_STAGE_HOST_BIT)) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_EVENT, "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.",
- sourceStageMask, stageMask);
+ VALIDATION_ERROR_00254, "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",
+ sourceStageMask, stageMask, validation_error_map[VALIDATION_ERROR_00254]);
}
return skip_call;
}
@@ -9755,8 +9755,8 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPoo
if (!pCB->activeQueries.count(query)) {
skip_call |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_QUERY, "DS", "Ending a query before it was started: queryPool 0x%" PRIx64 ", index %d",
- (uint64_t)(queryPool), slot);
+ VALIDATION_ERROR_01041, "DS", "Ending a query before it was started: queryPool 0x%" PRIx64 ", index %d. %s",
+ (uint64_t)(queryPool), slot, validation_error_map[VALIDATION_ERROR_01041]);
} else {
pCB->activeQueries.erase(query);
}
@@ -9899,7 +9899,8 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip
skip_call |= validatePushConstantRange(dev_data, offset, size, "vkCmdPushConstants()");
if (0 == stageFlags) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCmdPushConstants() call has no stageFlags set.");
+ VALIDATION_ERROR_00996, "DS", "vkCmdPushConstants() call has no stageFlags set. %s",
+ validation_error_map[VALIDATION_ERROR_00996]);
}
// Check if push constant update is within any of the ranges with the same stage flags specified in pipeline layout.
@@ -9923,9 +9924,9 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip
// There were no ranges that matched the stageFlags.
skip_call |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCmdPushConstants() stageFlags = 0x%" PRIx32 " do not match "
- "the stageFlags in any of the ranges in pipeline layout 0x%" PRIx64 ".",
- (uint32_t)stageFlags, (uint64_t)layout);
+ VALIDATION_ERROR_00988, "DS", "vkCmdPushConstants() stageFlags = 0x%" PRIx32 " do not match "
+ "the stageFlags in any of the ranges in pipeline layout 0x%" PRIx64 ". %s",
+ (uint32_t)stageFlags, (uint64_t)layout, validation_error_map[VALIDATION_ERROR_00988]);
} else {
// Sort span list by start value.
struct comparer {
@@ -9960,12 +9961,12 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip
}
}
if (!contained_in_a_range) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCmdPushConstants() Push constant range [%d, %d) "
- "with stageFlags = 0x%" PRIx32 " "
- "not within flag-matching ranges in pipeline layout 0x%" PRIx64 ".",
- offset, offset + size, (uint32_t)stageFlags, (uint64_t)layout);
+ skip_call |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_00988, "DS", "vkCmdPushConstants() Push constant range [%d, %d) "
+ "with stageFlags = 0x%" PRIx32 " "
+ "not within flag-matching ranges in pipeline layout 0x%" PRIx64 ". %s",
+ offset, offset + size, (uint32_t)stageFlags, (uint64_t)layout, validation_error_map[VALIDATION_ERROR_00988]);
}
}
lock.unlock();
@@ -9996,7 +9997,8 @@ CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelin
}
static bool MatchUsage(layer_data *dev_data, uint32_t count, const VkAttachmentReference *attachments,
- const VkFramebufferCreateInfo *fbci, VkImageUsageFlagBits usage_flag) {
+ const VkFramebufferCreateInfo *fbci, VkImageUsageFlagBits usage_flag,
+ UNIQUE_VALIDATION_ERROR_CODE error_code) {
bool skip_call = false;
for (uint32_t attach = 0; attach < count; attach++) {
@@ -10010,10 +10012,11 @@ static bool MatchUsage(layer_data *dev_data, uint32_t count, const VkAttachmentR
if (ici != nullptr) {
if ((ici->usage & usage_flag) == 0) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_USAGE, "DS",
+ (VkDebugReportObjectTypeEXT)0, 0, __LINE__, error_code, "DS",
"vkCreateFramebuffer: Framebuffer Attachment (%d) conflicts with the image's "
- "IMAGE_USAGE flags (%s).",
- attachments[attach].attachment, string_VkImageUsageFlagBits(usage_flag));
+ "IMAGE_USAGE flags (%s). %s",
+ attachments[attach].attachment, string_VkImageUsageFlagBits(usage_flag),
+ validation_error_map[error_code]);
}
}
}
@@ -10041,10 +10044,11 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf
if (rpci->attachmentCount != pCreateInfo->attachmentCount) {
skip_call |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS",
+ reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00404, "DS",
"vkCreateFramebuffer(): VkFramebufferCreateInfo attachmentCount of %u does not match attachmentCount of %u of "
- "renderPass (0x%" PRIxLEAST64 ") being used to create Framebuffer.",
- pCreateInfo->attachmentCount, rpci->attachmentCount, reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass));
+ "renderPass (0x%" PRIxLEAST64 ") being used to create Framebuffer. %s",
+ pCreateInfo->attachmentCount, rpci->attachmentCount, reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass),
+ validation_error_map[VALIDATION_ERROR_00404]);
} else {
// attachmentCounts match, so make sure corresponding attachment details line up
const VkImageView *image_views = pCreateInfo->pAttachments;
@@ -10054,30 +10058,31 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf
if (ivci.format != rpci->pAttachments[i].format) {
skip_call |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE,
- "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%" PRIxLEAST64 ").",
+ reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00408, "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%" PRIxLEAST64 "). %s",
i, string_VkFormat(ivci.format), string_VkFormat(rpci->pAttachments[i].format),
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass));
+ reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00408]);
}
const VkImageCreateInfo *ici = &getImageState(dev_data, ivci.image)->createInfo;
if (ici->samples != rpci->pAttachments[i].samples) {
skip_call |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE,
- "DS", "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match "
- "the %s samples used by the corresponding attachment for renderPass (0x%" PRIxLEAST64 ").",
+ reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00409, "DS",
+ "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match "
+ "the %s samples used by the corresponding attachment for renderPass (0x%" PRIxLEAST64 "). %s",
i, string_VkSampleCountFlagBits(ici->samples), string_VkSampleCountFlagBits(rpci->pAttachments[i].samples),
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass));
+ reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00409]);
}
// Verify that view only has a single mip level
if (ivci.subresourceRange.levelCount != 1) {
- skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0,
- __LINE__, DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, "DS",
- "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has mip levelCount of %u "
- "but only a single mip level (levelCount == 1) is allowed when creating a Framebuffer.",
- i, ivci.subresourceRange.levelCount);
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
+ VALIDATION_ERROR_00411, "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",
+ i, ivci.subresourceRange.levelCount, validation_error_map[VALIDATION_ERROR_00411]);
}
const uint32_t mip_level = ivci.subresourceRange.baseMipLevel;
uint32_t mip_width = max(1u, ici->extent.width >> mip_level);
@@ -10104,53 +10109,64 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf
((ivci.components.a != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci.components.a != VK_COMPONENT_SWIZZLE_A))) {
skip_call |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
- DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, "DS",
+ VALIDATION_ERROR_00412, "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",
+ "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));
+ string_VkComponentSwizzle(ivci.components.b), string_VkComponentSwizzle(ivci.components.a),
+ validation_error_map[VALIDATION_ERROR_00412]);
}
}
}
// Verify correct attachment usage flags
for (uint32_t subpass = 0; subpass < rpci->subpassCount; subpass++) {
// Verify input attachments:
- skip_call |= MatchUsage(dev_data, rpci->pSubpasses[subpass].inputAttachmentCount,
- rpci->pSubpasses[subpass].pInputAttachments, pCreateInfo, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT);
+ skip_call |=
+ MatchUsage(dev_data, rpci->pSubpasses[subpass].inputAttachmentCount, rpci->pSubpasses[subpass].pInputAttachments,
+ pCreateInfo, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, VALIDATION_ERROR_00407);
// Verify color attachments:
- skip_call |= MatchUsage(dev_data, rpci->pSubpasses[subpass].colorAttachmentCount,
- rpci->pSubpasses[subpass].pColorAttachments, pCreateInfo, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
+ skip_call |=
+ MatchUsage(dev_data, rpci->pSubpasses[subpass].colorAttachmentCount, rpci->pSubpasses[subpass].pColorAttachments,
+ pCreateInfo, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VALIDATION_ERROR_00405);
// Verify depth/stencil attachments:
if (rpci->pSubpasses[subpass].pDepthStencilAttachment != nullptr) {
skip_call |= MatchUsage(dev_data, 1, rpci->pSubpasses[subpass].pDepthStencilAttachment, pCreateInfo,
- VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
+ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VALIDATION_ERROR_00406);
}
}
- } else {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS",
- "vkCreateFramebuffer(): Attempt to create framebuffer with invalid renderPass (0x%" PRIxLEAST64 ").",
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass));
}
// Verify FB dimensions are within physical device limits
- if ((pCreateInfo->height > dev_data->phys_dev_properties.properties.limits.maxFramebufferHeight) ||
- (pCreateInfo->width > dev_data->phys_dev_properties.properties.limits.maxFramebufferWidth) ||
- (pCreateInfo->layers > dev_data->phys_dev_properties.properties.limits.maxFramebufferLayers)) {
+ if (pCreateInfo->width > dev_data->phys_dev_properties.properties.limits.maxFramebufferWidth) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
- DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, "DS",
- "vkCreateFramebuffer(): Requested VkFramebufferCreateInfo dimensions exceed physical device limits. "
- "Here are the respective dimensions: requested, device max:\n"
- "width: %u, %u\n"
- "height: %u, %u\n"
- "layerCount: %u, %u\n",
+ VALIDATION_ERROR_00413, "DS",
+ "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_00413]);
+ }
+ if (pCreateInfo->height > dev_data->phys_dev_properties.properties.limits.maxFramebufferHeight) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
+ VALIDATION_ERROR_00414, "DS",
+ "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,
- pCreateInfo->layers, dev_data->phys_dev_properties.properties.limits.maxFramebufferLayers);
+ validation_error_map[VALIDATION_ERROR_00414]);
+ }
+ if (pCreateInfo->layers > dev_data->phys_dev_properties.properties.limits.maxFramebufferLayers) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
+ VALIDATION_ERROR_00415, "DS",
+ "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_00415]);
}
return skip_call;
}
@@ -10349,18 +10365,16 @@ static bool ValidateDependencies(const layer_data *dev_data, FRAMEBUFFER_STATE c
uint32_t attachment = i;
for (auto other_attachment : overlapping_attachments[i]) {
if (!(pCreateInfo->pAttachments[attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_RENDERPASS, "DS", "Attachment %d aliases attachment %d but doesn't "
- "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT.",
- attachment, other_attachment);
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0,
+ __LINE__, VALIDATION_ERROR_00324, "DS", "Attachment %d aliases attachment %d but doesn't "
+ "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
+ attachment, other_attachment, validation_error_map[VALIDATION_ERROR_00324]);
}
if (!(pCreateInfo->pAttachments[other_attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_RENDERPASS, "DS", "Attachment %d aliases attachment %d but doesn't "
- "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT.",
- other_attachment, attachment);
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0,
+ __LINE__, VALIDATION_ERROR_00324, "DS", "Attachment %d aliases attachment %d but doesn't "
+ "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
+ other_attachment, attachment, validation_error_map[VALIDATION_ERROR_00324]);
}
}
}
@@ -10448,10 +10462,10 @@ static bool ValidateLayoutVsAttachmentDescription(debug_report_data *report_data
if (attachment_description.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) {
if ((first_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) ||
(first_layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)) {
- skip_call |=
- log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
- VkDebugReportObjectTypeEXT(0), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Cannot clear attachment %d with invalid first layout %s.", attachment, string_VkImageLayout(first_layout));
+ skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
+ VkDebugReportObjectTypeEXT(0), __LINE__, VALIDATION_ERROR_02351, "DS",
+ "Cannot clear attachment %d with invalid first layout %s. %s", attachment,
+ string_VkImageLayout(first_layout), validation_error_map[VALIDATION_ERROR_02351]);
}
}
return skip_call;
@@ -10645,17 +10659,18 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend
for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
const VkSubpassDescription &subpass = pCreateInfo->pSubpasses[i];
if (subpass.pipelineBindPoint != VK_PIPELINE_BIND_POINT_GRAPHICS) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_RENDERPASS, "DS",
- "CreateRenderPass: Pipeline bind point for subpass %d must be VK_PIPELINE_BIND_POINT_GRAPHICS.", i);
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_00347, "DS",
+ "CreateRenderPass: Pipeline bind point for subpass %d must be VK_PIPELINE_BIND_POINT_GRAPHICS. %s",
+ i, validation_error_map[VALIDATION_ERROR_00347]);
}
for (uint32_t j = 0; j < subpass.preserveAttachmentCount; ++j) {
uint32_t attachment = subpass.pPreserveAttachments[j];
if (attachment == VK_ATTACHMENT_UNUSED) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0,
- __LINE__, DRAWSTATE_INVALID_ATTACHMENT_INDEX, "DS",
- "CreateRenderPass: Preserve attachment (%d) must not be VK_ATTACHMENT_UNUSED.", j);
+ __LINE__, VALIDATION_ERROR_00356, "DS",
+ "CreateRenderPass: Preserve attachment (%d) must not be VK_ATTACHMENT_UNUSED. %s", j,
+ validation_error_map[VALIDATION_ERROR_00356]);
} else {
skip_call |= ValidateAttachmentIndex(dev_data, attachment, pCreateInfo->attachmentCount, "Preserve");
}
@@ -10676,10 +10691,11 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend
if (!skip_call && attachment != VK_ATTACHMENT_UNUSED &&
pCreateInfo->pAttachments[attachment].samples != VK_SAMPLE_COUNT_1_BIT) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0,
- __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS",
+ __LINE__, VALIDATION_ERROR_00352, "DS",
"CreateRenderPass: Subpass %u requests multisample resolve into attachment %u, "
- "which must have VK_SAMPLE_COUNT_1_BIT but has %s",
- i, attachment, string_VkSampleCountFlagBits(pCreateInfo->pAttachments[attachment].samples));
+ "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_00352]);
}
}
attachment = subpass.pColorAttachments[j].attachment;
@@ -10691,10 +10707,10 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend
if (subpass_performs_resolve &&
pCreateInfo->pAttachments[attachment].samples == VK_SAMPLE_COUNT_1_BIT) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0,
- __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS",
+ __LINE__, VALIDATION_ERROR_00351, "DS",
"CreateRenderPass: Subpass %u requests multisample resolve from attachment %u "
- "which has VK_SAMPLE_COUNT_1_BIT",
- i, attachment);
+ "which has VK_SAMPLE_COUNT_1_BIT. %s",
+ i, attachment, validation_error_map[VALIDATION_ERROR_00351]);
}
}
}
@@ -10714,11 +10730,10 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend
}
if (sample_count && !IsPowerOfTwo(sample_count)) {
- skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0,
- __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS",
- "CreateRenderPass: Subpass %u attempts to render to "
- "attachments with inconsistent sample counts",
- i);
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__,
+ VALIDATION_ERROR_00337, "DS", "CreateRenderPass: Subpass %u attempts to render to "
+ "attachments with inconsistent sample counts. %s",
+ i, validation_error_map[VALIDATION_ERROR_00337]);
}
}
return skip_call;
@@ -10866,12 +10881,13 @@ static void TransitionSubpassLayouts(layer_data *dev_data, GLOBAL_CB_NODE *pCB,
}
}
-static bool validatePrimaryCommandBuffer(const layer_data *dev_data, const GLOBAL_CB_NODE *pCB, const std::string &cmd_name) {
+static bool validatePrimaryCommandBuffer(const layer_data *dev_data, const GLOBAL_CB_NODE *pCB, const std::string &cmd_name,
+ UNIQUE_VALIDATION_ERROR_CODE error_code) {
bool skip_call = false;
if (pCB->createInfo.level != VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_COMMAND_BUFFER, "DS", "Cannot execute command %s on a secondary command buffer.",
- cmd_name.c_str());
+ error_code, "DS", "Cannot execute command %s on a secondary command buffer. %s", cmd_name.c_str(),
+ validation_error_map[error_code]);
}
return skip_call;
}
@@ -11000,7 +11016,7 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
skip_call |= VerifyFramebufferAndRenderPassLayouts(dev_data, cb_node, pRenderPassBegin);
skip_call |= insideRenderPass(dev_data, cb_node, "vkCmdBeginRenderPass()", VALIDATION_ERROR_00440);
skip_call |= ValidateDependencies(dev_data, framebuffer, renderPass);
- skip_call |= validatePrimaryCommandBuffer(dev_data, cb_node, "vkCmdBeginRenderPass");
+ skip_call |= validatePrimaryCommandBuffer(dev_data, cb_node, "vkCmdBeginRenderPass", VALIDATION_ERROR_00441);
skip_call |= ValidateCmd(dev_data, cb_node, CMD_BEGINRENDERPASS, "vkCmdBeginRenderPass()");
UpdateCmdBufferLastCmd(dev_data, cb_node, CMD_BEGINRENDERPASS);
cb_node->activeRenderPass = renderPass;
@@ -11013,10 +11029,6 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
AddFramebufferBinding(dev_data, cb_node, framebuffer);
// transition attachments to the correct layouts for the first subpass
TransitionSubpassLayouts(dev_data, cb_node, &cb_node->activeRenderPassBeginInfo, cb_node->activeSubpass);
- } else {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_RENDERPASS, "DS", "You cannot use a NULL RenderPass object in vkCmdBeginRenderPass()");
}
}
lock.unlock();
@@ -11031,17 +11043,17 @@ VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpa
std::unique_lock<std::mutex> lock(global_lock);
GLOBAL_CB_NODE *pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
- skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdNextSubpass");
+ skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdNextSubpass", VALIDATION_ERROR_00459);
skip_call |= ValidateCmd(dev_data, pCB, CMD_NEXTSUBPASS, "vkCmdNextSubpass()");
UpdateCmdBufferLastCmd(dev_data, pCB, CMD_NEXTSUBPASS);
skip_call |= outsideRenderPass(dev_data, pCB, "vkCmdNextSubpass()", VALIDATION_ERROR_00458);
auto subpassCount = pCB->activeRenderPass->createInfo.subpassCount;
if (pCB->activeSubpass == subpassCount - 1) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DRAWSTATE_INVALID_SUBPASS_INDEX, "DS",
- "vkCmdNextSubpass(): Attempted to advance beyond final subpass");
+ skip_call |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00453, "DS",
+ "vkCmdNextSubpass(): Attempted to advance beyond final subpass. %s", validation_error_map[VALIDATION_ERROR_00453]);
}
}
lock.unlock();
@@ -11069,10 +11081,10 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
auto framebuffer = getFramebufferState(dev_data, pCB->activeFramebuffer);
if (rp_state) {
if (pCB->activeSubpass != rp_state->createInfo.subpassCount - 1) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DRAWSTATE_INVALID_SUBPASS_INDEX, "DS",
- "vkCmdEndRenderPass(): Called before reaching final subpass");
+ skip_call |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00460, "DS",
+ "vkCmdEndRenderPass(): Called before reaching final subpass. %s", validation_error_map[VALIDATION_ERROR_00460]);
}
for (size_t i = 0; i < rp_state->createInfo.attachmentCount; ++i) {
@@ -11097,7 +11109,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
}
}
skip_call |= outsideRenderPass(dev_data, pCB, "vkCmdEndRenderpass()", VALIDATION_ERROR_00464);
- skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdEndRenderPass");
+ skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdEndRenderPass", VALIDATION_ERROR_00465);
skip_call |= ValidateCmd(dev_data, pCB, CMD_ENDRENDERPASS, "vkCmdEndRenderPass()");
UpdateCmdBufferLastCmd(dev_data, pCB, CMD_ENDRENDERPASS);
}
@@ -11120,11 +11132,12 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
static bool logInvalidAttachmentMessage(layer_data *dev_data, VkCommandBuffer secondaryBuffer, uint32_t primaryAttach,
uint32_t secondaryAttach, const char *msg) {
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
+ VALIDATION_ERROR_02059, "DS",
"vkCmdExecuteCommands() called w/ invalid Secondary Cmd Buffer 0x%" PRIx64 " which has a render pass "
"that is not compatible with the Primary Cmd Buffer current render pass. "
- "Attachment %u is not compatible with %u: %s",
- reinterpret_cast<uint64_t &>(secondaryBuffer), primaryAttach, secondaryAttach, msg);
+ "Attachment %u is not compatible with %u: %s. %s",
+ reinterpret_cast<uint64_t &>(secondaryBuffer), primaryAttach, secondaryAttach, msg,
+ validation_error_map[VALIDATION_ERROR_02059]);
}
static bool validateAttachmentCompatibility(layer_data *dev_data, VkCommandBuffer primaryBuffer,
@@ -11252,13 +11265,13 @@ static bool validateFramebuffer(layer_data *dev_data, VkCommandBuffer primaryBuf
VkFramebuffer secondary_fb = pSubCB->beginInfo.pInheritanceInfo->framebuffer;
if (secondary_fb != VK_NULL_HANDLE) {
if (primary_fb != secondary_fb) {
- skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_FRAMEBUFFER_INCOMPATIBLE, "DS",
- "vkCmdExecuteCommands() called w/ invalid secondary command buffer 0x%" PRIx64
- " which has a framebuffer 0x%" PRIx64
- " that is not the same as the primary command buffer's current active framebuffer 0x%" PRIx64 ".",
- reinterpret_cast<uint64_t &>(secondaryBuffer), reinterpret_cast<uint64_t &>(secondary_fb),
- reinterpret_cast<uint64_t &>(primary_fb));
+ skip_call |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_02060, "DS",
+ "vkCmdExecuteCommands() called w/ invalid secondary command buffer 0x%" PRIx64 " which has a framebuffer 0x%" PRIx64
+ " that is not the same as the primary command buffer's current active framebuffer 0x%" PRIx64 ". %s",
+ reinterpret_cast<uint64_t &>(secondaryBuffer), reinterpret_cast<uint64_t &>(secondary_fb),
+ reinterpret_cast<uint64_t &>(primary_fb), validation_error_map[VALIDATION_ERROR_02060]);
}
auto fb = getFramebufferState(dev_data, secondary_fb);
if (!fb) {
@@ -11288,13 +11301,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_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0,
- __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
- "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
- "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.",
- pCB->commandBuffer, reinterpret_cast<const uint64_t &>(queryPoolData->first));
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_02065, "DS", "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
+ "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",
+ pCB->commandBuffer, reinterpret_cast<const uint64_t &>(queryPoolData->first),
+ validation_error_map[VALIDATION_ERROR_02065]);
}
}
activeTypes.insert(queryPoolData->second.createInfo.queryType);
@@ -11431,7 +11445,7 @@ CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount,
pCB->queryUpdates.push_back(function);
}
}
- skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdExecuteComands");
+ skip_call |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdExecuteComands", VALIDATION_ERROR_00163);
skip_call |= ValidateCmd(dev_data, pCB, CMD_EXECUTECOMMANDS, "vkCmdExecuteComands()");
UpdateCmdBufferLastCmd(dev_data, pCB, CMD_EXECUTECOMMANDS);
}