KhronosGroup / Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
Apache License 2.0
414 stars 172 forks source link

Add log_msg overload that will accept text VUIDs #2549

Closed mark-lunarg closed 6 years ago

mark-lunarg commented 6 years ago

This ability is necessary to support private extension development, where numeric VUIDs are unavailable, and even text VUIDs will not appear in the VUID database.

Added an overload of log_msg that will take text VUIDs (e.g., "VUID-VkDeviceQueueInfo2-queueFamilyIndex-01842") in place of the usual integer VUID (e.g., VALIDATION_ERROR_42200e64).

A new map of the VUID strings to the old integer VUIDs has been added to vk_validation_error_messages.h.

vk_layer_logging.h was modified to handle outputting the text VUIDs without changing the callbacks. This is important since many ISVs are likely using the current callback structure.

If a text VUID is used with the DEBUG_REPORT extension, the message will look like:

[ VUID-VkGraphicsPipelineCreateInfo-attachmentCount-00746 ] Object: VK_NULL_HANDLE (Type = 19) | vkCreateGraphicsPipelines(): Render pass (0x6) subpass 0 has colorAttachmentCount of 1 which doesn't match the pColorBlendState->attachmentCount of 0. The spec valid usage text states 'If rasterization is not disabled and the subpass uses color attachments, the attachmentCount member of pColorBlendState must be equal to the colorAttachmentCount used to create subpass' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-attachmentCount-00746)

The DEBUG_UTILS extension handles text VUIDs natively.

If a text VUID is specified and does NOT exist in the error_message database, the message will appear as before but without the appended spec text.

mark-lunarg commented 6 years ago

Incorporated feedback and pushed to Master.