From a0f0b6723c062a5e010cd2c99e5f06d668c2d464 Mon Sep 17 00:00:00 2001 From: Dustin Graves Date: Thu, 5 May 2016 13:44:21 -0600 Subject: [PATCH] layers: Add error codes for parameter_validation Add error codes to the parameter_validation layer: - Add parameter_validation::ErrorCode enum defining common parameter validation errors to parameter_validation_utils.h - Replace the '1' in parameter_validation log_msg calls with the appropriate error code - Add parameter_validation error code documentation to vk_validation_layer_details.md - Remove 'typedef enum' declaration requirement for error code enumerations from vk_layer_documentation_generate.py; It will now recognize error code enmerations declared wihtout the typedef Change-Id: Icf18b9124000159f7436f66e48a95d0c58047a07 --- layers/parameter_validation.cpp | 86 +++++++++++++-------- layers/parameter_validation_utils.h | 140 +++++++++++++++++++++------------- layers/vk_validation_layer_details.md | 13 +++- vk_layer_documentation_generate.py | 8 +- 4 files changed, 156 insertions(+), 91 deletions(-) diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index d1d09b6..9dc9b8f 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -1214,14 +1214,15 @@ static bool validate_queue_family_indices(VkDevice device, const char *function_ for (auto i = 0u; i < count; i++) { if (indices[i] == VK_QUEUE_FAMILY_IGNORED) { - skipCall |= - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", - "%s: the specified queueFamilyIndex cannot be VK_QUEUE_FAMILY_IGNORED.", function_name); + skipCall |= log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", + "%s: the specified queueFamilyIndex cannot be VK_QUEUE_FAMILY_IGNORED.", function_name); } else { const auto &queue_data = my_device_data->queueFamilyIndexMap.find(indices[i]); if (queue_data == my_device_data->queueFamilyIndexMap.end()) { skipCall |= log_msg( - mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, + "PARAMCHECK", "VkGetDeviceQueue parameter, uint32_t queueFamilyIndex %d, must have been given when the device was created.", indices[i]); return false; @@ -1277,11 +1278,13 @@ static bool validate_string(debug_report_data *report_data, const char *apiName, if (result == VK_STRING_ERROR_NONE) { return skipCall; } else if (result & VK_STRING_ERROR_LENGTH) { - skipCall = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", - "%s: string %s exceeds max length %d", apiName, stringName, MaxParamCheckerStringLength); + skipCall = + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, + "PARAMCHECK", "%s: string %s exceeds max length %d", apiName, stringName, MaxParamCheckerStringLength); } else if (result & VK_STRING_ERROR_BAD_DATA) { - skipCall = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", - "%s: string %s contains invalid characters or is badly formed", apiName, stringName); + skipCall = + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, + "PARAMCHECK", "%s: string %s contains invalid characters or is badly formed", apiName, stringName); } return skipCall; } @@ -1524,8 +1527,8 @@ void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCre if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { if (set.count(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex)) { - log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - "PARAMCHECK", + log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex, is not unique within this " "structure.", i); @@ -1537,8 +1540,8 @@ void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCre for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { if ((pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] < 0.f) || (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] > 1.f)) { - log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - "PARAMCHECK", + log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, INVALID_USAGE, "PARAMCHECK", "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->pQueuePriorities[%d], must be " "between 0 and 1. Actual value is %f", i, j, pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]); @@ -1548,14 +1551,16 @@ void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCre if (pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex >= properties.size()) { log_msg( - mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex cannot be more than the number " "of queue families.", i); } else if (pCreateInfo->pQueueCreateInfos[i].queueCount > properties[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex].queueCount) { log_msg( - mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueCount cannot be more than the number of " "queues for the given family index.", i); @@ -1676,7 +1681,8 @@ bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queu const auto &queue_data = my_device_data->queueFamilyIndexMap.find(queueFamilyIndex); if (queue_data->second <= queueIndex) { - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, + "PARAMCHECK", "VkGetDeviceQueue parameter, uint32_t queueIndex %d, must be less than the number of queues given when the device " "was created.", queueIndex); @@ -1920,7 +1926,8 @@ bool PostGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32 if ((pSparseMemoryRequirements->formatProperties.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkGetImageSparseMemoryRequirements parameter, VkImageAspect " "pSparseMemoryRequirements->formatProperties.aspectMask, is an unrecognized enumerator"); return false; @@ -1954,7 +1961,8 @@ bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalD if (pProperties != nullptr) { if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, 1, + "PARAMCHECK", "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageAspect pProperties->aspectMask, is an " "unrecognized enumerator"); return false; @@ -2371,7 +2379,8 @@ bool PreGetImageSubresourceLayout(VkDevice device, const VkImageSubresource *pSu if (pSubresource != nullptr) { if ((pSubresource->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkGetImageSubresourceLayout parameter, VkImageAspect pSubresource->aspectMask, is an unrecognized enumerator"); return false; } @@ -2536,7 +2545,8 @@ bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateI if (pCreateInfos->flags | VK_PIPELINE_CREATE_DERIVATIVE_BIT) { if (pCreateInfos->basePipelineIndex != -1) { if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", "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"); @@ -2547,7 +2557,8 @@ bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateI if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { if (pCreateInfos->basePipelineIndex != -1) { log_msg( - mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_USAGE, "PARAMCHECK", "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"); @@ -2558,7 +2569,8 @@ bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateI if (pCreateInfos->pRasterizationState != nullptr) { if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) { - log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an " "unrecognized enumerator"); return false; @@ -3212,16 +3224,16 @@ bool PreCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t in if (vertexCount == 0) { // TODO: Verify against Valid Usage section. I don't see a non-zero vertexCount listed, may need to add that and make // this an error or leave as is. - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", - "vkCmdDraw parameter, uint32_t vertexCount, is 0"); + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, "PARAMCHECK", "vkCmdDraw parameter, uint32_t vertexCount, is 0"); return false; } if (instanceCount == 0) { // TODO: Verify against Valid Usage section. I don't see a non-zero instanceCount listed, may need to add that and make // this an error or leave as is. - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", - "vkCmdDraw parameter, uint32_t instanceCount, is 0"); + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, "PARAMCHECK", "vkCmdDraw parameter, uint32_t instanceCount, is 0"); return false; } @@ -3305,13 +3317,15 @@ bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) if (pRegions != nullptr) { if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); return false; } if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); return false; } @@ -3342,13 +3356,15 @@ bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) if (pRegions != nullptr) { if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); return false; } if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); return false; } @@ -3379,7 +3395,8 @@ bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageC 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) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyBufferToImage parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " "enumerator"); return false; @@ -3411,7 +3428,8 @@ bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageC 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) { - log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " "enumerator"); return false; @@ -3518,14 +3536,16 @@ bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRe if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { log_msg( - mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); return false; } if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { log_msg( - mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, "PARAMCHECK", "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); return false; } diff --git a/layers/parameter_validation_utils.h b/layers/parameter_validation_utils.h index 29182bf..6660ab3 100644 --- a/layers/parameter_validation_utils.h +++ b/layers/parameter_validation_utils.h @@ -31,6 +31,28 @@ namespace parameter_validation { +enum ErrorCode { + NONE, // Used for INFO & other non-error messages + INVALID_USAGE, // The value of a parameter is not consistent + // with the valid usage criteria defined in + // the Vulkan specification. + INVALID_STRUCT_STYPE, // The sType field of a Vulkan structure does + // not contain the value expected for a structure + // of that type. + INVALID_STRUCT_PNEXT, // The pNext field of a Vulkan structure references + // a value that is not compatible with a structure of + // that type or is not NULL when a structure of that + // type has no compatible pNext values. + REQUIRED_PARAMETER, // A required parameter was specified as 0 or NULL. + RESERVED_PARAMETER, // A parameter reserved for future use was not + // specified as 0 or NULL. + UNRECOGNIZED_VALUE, // A Vulkan enumeration, VkFlags, or VkBool32 parameter + // contains a value that is not recognized as valid for + // that type. + FAILURE_RETURN_CODE, // A Vulkan return code indicating a failure condition + // was encountered. +}; + struct GenericHeader { VkStructureType sType; const void *pNext; @@ -78,8 +100,8 @@ static bool validate_required_pointer(debug_report_data *report_data, const char bool skipCall = false; if (value == NULL) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: required parameter %s specified as NULL", apiName, parameterName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, parameterName); } return skipCall; @@ -109,14 +131,14 @@ bool validate_array(debug_report_data *report_data, const char *apiName, const c // Count parameters not tagged as optional cannot be 0 if ((count == 0) && countRequired) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: parameter %s must be greater than 0", apiName, countName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: parameter %s must be greater than 0", apiName, countName); } // Array parameters not tagged as optional cannot be NULL, unless the count is 0 if ((array == NULL) && arrayRequired && (count != 0)) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: required parameter %s specified as NULL", apiName, arrayName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, arrayName); } return skipCall; @@ -149,8 +171,8 @@ bool validate_array(debug_report_data *report_data, const char *apiName, const c if (count == NULL) { if (countPtrRequired) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: required parameter %s specified as NULL", apiName, countName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, countName); } } else { @@ -183,12 +205,14 @@ bool validate_struct_type(debug_report_data *report_data, const char *apiName, c if (value == NULL) { if (required) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: required parameter %s specified as NULL", apiName, parameterName); + skipCall |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, parameterName); } } else if (value->sType != sType) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: parameter %s->sType must be %s", apiName, parameterName, sTypeName); + skipCall |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_STRUCT_STYPE, LayerName, "%s: parameter %s->sType must be %s", apiName, parameterName, sTypeName); } return skipCall; @@ -223,8 +247,8 @@ bool validate_struct_type_array(debug_report_data *report_data, const char *apiN if (count == NULL) { if (countPtrRequired) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: required parameter %s specified as NULL", apiName, countName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, countName); } } else { skipCall |= validate_struct_type_array(report_data, apiName, countName, arrayName, sTypeName, (*count), array, sType, @@ -265,8 +289,9 @@ bool validate_struct_type_array(debug_report_data *report_data, const char *apiN // Verify that all structs in the array have the correct type for (uint32_t i = 0; i < count; ++i) { if (array[i].sType != sType) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: parameter %s[%d].sType must be %s", apiName, arrayName, i, sTypeName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, INVALID_STRUCT_STYPE, LayerName, "%s: parameter %s[%d].sType must be %s", apiName, + arrayName, i, sTypeName); } } } @@ -290,8 +315,9 @@ bool validate_required_handle(debug_report_data *report_data, const char *api_na bool skip_call = false; if (value == VK_NULL_HANDLE) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: required parameter %s specified as VK_NULL_HANDLE", api_name, parameter_name); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as VK_NULL_HANDLE", api_name, + parameter_name); } return skip_call; @@ -330,9 +356,9 @@ bool validate_handle_array(debug_report_data *report_data, const char *api_name, // Verify that no handles in the array are VK_NULL_HANDLE for (uint32_t i = 0; i < count; ++i) { if (array[i] == VK_NULL_HANDLE) { - skip_call |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name, array_name, i); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, REQUIRED_PARAMETER, LayerName, + "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name, array_name, i); } } } @@ -368,8 +394,9 @@ static bool validate_string_array(debug_report_data *report_data, const char *ap // Verify that strings in the array are not NULL for (uint32_t i = 0; i < count; ++i) { if (array[i] == NULL) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: required parameter %s[%d] specified as NULL", apiName, arrayName, i); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, REQUIRED_PARAMETER, LayerName, "%s: required parameter %s[%d] specified as NULL", + apiName, arrayName, i); } } } @@ -400,8 +427,8 @@ static bool validate_struct_pnext(debug_report_data *report_data, const char *ap if (next != NULL) { if (allowedTypeCount == 0) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: value of %s must be NULL", apiName, parameterName); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_STRUCT_PNEXT, LayerName, "%s: value of %s must be NULL", apiName, parameterName); } else { const VkStructureType *start = allowedTypes; const VkStructureType *end = allowedTypes + allowedTypeCount; @@ -413,12 +440,14 @@ static bool validate_struct_pnext(debug_report_data *report_data, const char *ap if (typeName == UnsupportedStructureTypeString) { skipCall |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_STRUCT_PNEXT, LayerName, "%s: %s chain includes a structure with unexpected VkStructureType (%d); Allowed structures are [%s]", apiName, parameterName, current->sType, allowedStructNames); } else { skipCall |= log_msg( - report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + INVALID_STRUCT_PNEXT, LayerName, "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are [%s]", apiName, parameterName, typeName.c_str(), allowedStructNames); } @@ -447,8 +476,9 @@ static bool validate_bool32(debug_report_data *report_data, const char *apiName, bool skipCall = false; if ((value != VK_TRUE) && (value != VK_FALSE)) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName, parameterName, value); + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, LayerName, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName, + parameterName, value); } return skipCall; @@ -479,10 +509,11 @@ bool validate_ranged_enum(debug_report_data *report_data, const char *apiName, c bool skipCall = false; if (((value < begin) || (value > end)) && !is_extension_added_token(value)) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, 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", - apiName, parameterName, value, enumName); + skipCall |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, 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", + apiName, parameterName, value, enumName); } return skipCall; @@ -522,9 +553,10 @@ static bool validate_ranged_enum_array(debug_report_data *report_data, const cha } else { for (uint32_t i = 0; i < count; ++i) { if (((array[i] < begin) || (array[i] > end)) && !is_extension_added_token(array[i])) { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s " - "enumeration tokens and is not an extension added token", + skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, UNRECOGNIZED_VALUE, LayerName, + "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s " + "enumeration tokens and is not an extension added token", apiName, arrayName, i, array[i], enumName); } } @@ -550,8 +582,8 @@ static bool validate_reserved_flags(debug_report_data *report_data, const char * bool skip_call = false; if (value != 0) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: parameter %s must be 0", api_name, parameter_name); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + RESERVED_PARAMETER, LayerName, "%s: parameter %s must be 0", api_name, parameter_name); } return skip_call; @@ -578,13 +610,14 @@ 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, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: value of %s must not be 0", api_name, parameter_name); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: value of %s must not be 0", api_name, parameter_name); } } else if ((value & (~all_flags)) != 0) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: value of %s contains flag bits that are not recognized members of %s", api_name, parameter_name, - flag_bits_name); + skip_call |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + UNRECOGNIZED_VALUE, LayerName, "%s: value of %s contains flag bits that are not recognized members of %s", + api_name, parameter_name, flag_bits_name); } return skip_call; @@ -622,13 +655,15 @@ static bool validate_flags_array(debug_report_data *report_data, const char *api // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if // elements in the array are allowed be 0 if (array_required) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - 1, LayerName, "%s: value of %s[%d] must not be 0", api_name, array_name, i); + skip_call |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + REQUIRED_PARAMETER, LayerName, "%s: value of %s[%d] must not be 0", api_name, array_name, i); } } else if ((array[i] & (~all_flags)) != 0) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, - LayerName, "%s: value of %s[%d] contains flag bits that are not recognized members of %s", - api_name, array_name, i, flag_bits_name); + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, UNRECOGNIZED_VALUE, LayerName, + "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name, + array_name, i, flag_bits_name); } } } @@ -698,12 +733,13 @@ static void validate_result(debug_report_data *report_data, const char *apiName, if (resultName == UnsupportedResultString) { // Unrecognized result code - log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: returned a result code indicating that an error has occurred", apiName); + log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + FAILURE_RETURN_CODE, LayerName, "%s: returned a result code indicating that an error has occurred", apiName); } else { std::string resultDesc = get_result_description(result); - log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, - "%s: returned %s, indicating that %s", apiName, resultName.c_str(), resultDesc.c_str()); + log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + FAILURE_RETURN_CODE, LayerName, "%s: returned %s, indicating that %s", apiName, resultName.c_str(), + resultDesc.c_str()); } } } diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index 3c1c77b..8182144 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -185,14 +185,19 @@ The Mem Tracker portion of the VK_LAYER_LUNARG_core_validation layer tracks memo ### VK_LAYER_LUNARG_parameter_validation Overview -The VK_LAYER_LUNARG_parameter_validation layer validates parameter values and flags errors for any values that are outside of acceptable values for the given parameter. +The VK_LAYER_LUNARG_parameter_validation layer validates parameter values and flags errors for any values that are not consistent with the valid usage criteria defined for that parameter. ### VK_LAYER_LUNARG_parameter_validation Details Table -| Check | Overview | ENUM | Relevant API | Testname | Notes/TODO | +| Check | Overview | ENUM * | Relevant API | Testname | Notes/TODO | | ----- | -------- | ---------------- | ------------ | -------- | ---------- | -| Input Parameters | Pointers in structures are recursively validated to be non-null. Enumerated types are validated against min and max enum values. Structure Types are verified to be correct. | NA | vkQueueSubmit vkAllocateMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkQueueBindSparse vkCreateFence vkResetFences vkWaitForFences vkCreateSemaphore vkCreateEvent vkCreateQueryPool vkCreateBuffer vkCreateBufferView vkCreateImage vkGetImageSubresourceLayout vkCreateImageView vkCreatePipelineCache vkMergePipelineCaches vkCreateGraphicsPipelines vkCreateComputePipelines vkCreatePipelineLayout vkCreateSampler vkCreateDescriptorSetLayout( vkCreateDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkUpdateDescriptorSets vkCreateFramebuffer vkCreateRenderPass vkCreateCommandPool vkAllocateCommandBuffers vkBeginCommandBuffer vkCmdBindDescriptorSets vkCmdBindVertexBuffers vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdWaitEvents vkCmdPipelineBarrier vkCmdPushConstants vkCmdBeginRenderPass vkCmdExecuteCommands | TBD | NA | -| Call results, Output Parameters | Return values are checked for VK_SUCCESS, returned pointers are checked to be NON-NULL, enumerated types of return values are checked to be within the defined range. | NA | vkEnumeratePhysicalDevices vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceLimits vkGetPhysicalDeviceProperties vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceMemoryProperties vkGetDeviceQueue vkQueueSubmit vkQueueWaitIdle vkDeviceWaitIdle vkAllocateMemory vkFreeMemory vkMapMemory vkUnmapMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkGetDeviceMemoryCommitment vkBindBufferMemory vkBindImageMemory vkGetBufferMemoryRequirements vkGetImageMemoryRequirements vkGetImageSparseMemoryRequirements vkGetPhysicalDeviceSparseImageFormatProperties vkQueueBindSparse vkCreateFence vkDestroyFence vkResetFences vkGetFenceStatus vkWaitForFences vkCreateSemaphore vkDestroySemaphore vkCreateEvent vkDestroyEvent vkGetEventStatus vkSetEvent vkResetEvent vkCreateQueryPool vkDestroyQueryPool vkGetQueryPoolResults vkCreateBuffer vkDestroyBuffer vkCreateBufferView vkDestroyBufferView vkCreateImage vkDestroyImage vkGetImageSubresourceLayout vkCreateImageView vkDestroyImageView vkDestroyShaderModule vkCreatePipelineCache vkDestroyPipelineCache vkGetPipelineCacheData vkMergePipelineCaches vkCreateGraphicsPipelines vkCreateComputePipelines vkDestroyPipeline vkCreatePipelineLayout vkDestroyPipelineLayout vkCreateSampler vkDestroySampler vkCreateDescriptorSetLayout vkDestroyDescriptorSetLayout vkCreateDescriptorPool vkDestroyDescriptorPool vkResetDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkUpdateDescriptorSets vkCreateFramebuffer vkDestroyFramebuffer vkCreateRenderPass vkDestroyRenderPass vkGetRenderAreaGranularity vkCreateCommandPool vkDestroyCommandPool vkResetCommandPool vkAllocateCommandBuffers vkFreeCommandBuffers vkBeginCommandBuffer vkEndCommandBuffer vkResetCommandBuffer vkCmdBindPipeline vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestamp vkCmdCopyQueryPoolResults vkCmdPushConstants vkCmdBeginRenderPass vkCmdNextSubpass vkCmdEndRenderPass vkCmdExecuteCommands | TBD | NA | +| Valid Usage | Verifies that the value of a parameter is consistent with the valid usage criteria defined in the Vulkan specification | INVALID_USAGE | | TBD | NA | +| Valid VkStructureType Value | Verifies that the sType field of a Vulkan structure contains the value expected for a structure of that type | INVALID_STRUCT_STYPE | | TBD | NA | +| Valid Structure pNext Value | Verifies that the pNext field of a Vulkan structure references a value that is compatible with a structure of that type or is NULL when a structure of that type has no compatible pNext values | INVALID_STRUCT_PNEXT | | TBD | NA | +| Required Parameter | Verifies that a required parameter was not specified as 0 or NULL | REQUIRED_PARAMETER | | TBD | NA | +| Reserved Parameter | Verifies that a parameter reserved for future use was specified as 0 or NULL | RESERVED_PARAMETER | | TBD | NA | +| Unrecognized Value | Verifies that a Vulkan enumeration, VkFlags, or VkBool32 parameter contains a value that is recognized as valid for that type | UNRECOGNIZED_VALUE | | TBD | NA | +| Failed Call Return Code | Provides a description of a failure code returned by a Vulkan API call | FAILURE_RETURN_CODE | | TBD | NA | | NA | Enum used for informational messages | NONE | | NA | None | ### VK_LAYER_LUNARG_parameter_validation Pending Work diff --git a/vk_layer_documentation_generate.py b/vk_layer_documentation_generate.py index 5e79369..4f23cd6 100755 --- a/vk_layer_documentation_generate.py +++ b/vk_layer_documentation_generate.py @@ -81,6 +81,10 @@ layer_inputs = { 'draw_state' : {'header' : 'layers/core_validation_error_enums. 'source' : 'layers/swapchain.cpp', 'generated' : False, 'error_enum' : 'SWAPCHAIN_ERROR',}, + 'parameter_validation' : {'header' : 'layers/parameter_validation_utils.h', + 'source' : 'layers/parameter_validation.cpp', + 'generated' : False, + 'error_enum' : 'ErrorCode',}, } builtin_headers = [layer_inputs[ln]['header'] for ln in layer_inputs] @@ -198,8 +202,8 @@ class LayerParser: if enum_name in self.layer_dict[layer_name]['CHECKS']: print('ERROR : % layer has duplicate error enum: %s' % (layer_name, enum_name)) self.layer_dict[layer_name]['CHECKS'].append(enum_name) - # If the line includes 'typedef', 'enum', and the expected enum name, start capturing enums - if False not in [ex in line for ex in ['typedef', 'enum', layer_inputs[layer_name]['error_enum']]]: + # If the line includes 'enum' and the expected enum name, start capturing enums + if False not in [ex in line for ex in ['enum', layer_inputs[layer_name]['error_enum']]]: store_enum = True # For each source file, parse into dicts -- 2.7.4