Better access to Vulkan debug report callback data

Hello there,

The Vulkan debug report callback allows us to set up a function for handling validation errors/warnings etc.
We must specify that we receive the final message as a const char*. Here’s an example message:

Validation Error: [ VUID-vkCmdDrawIndexed-indexSize-00463 ] Object 0: handle = 0x93dcbb000000007e, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xd4f2594c | vkCmdDrawIndexed(
) index size (2) * (firstIndex (543) + indexCount (159)) + binding offset (0) = an ending offset of 1404 bytes, which is greater than the index buffer size (1086). The Vulkan spec states: (indexSize * (firstIndex + indexCount) + o
ffset) must be less than or equal to the size of the bound index buffer, with indexSize being based on the type specified by indexType, where the index buffer, indexType, and offset are specified via vkCmdBindIndexBuffer (https://
vulkan.lunarg.com/doc/view/1.2.141.0/windows/1.2-extensions/vkspec.html#VUID-vkCmdDrawIndexed-indexSize-00463)

However, since I am not happy with the way these long messages are printed out to the console, I would prefer to access the information in this string separately, as it would be a struct:

Type: Validation Error
Code: VUID-vkCmdDrawIndexed-indexSize-00463
Object 0: handle = 0x93dcbb000000007e
type: VK_OBJECT_TYPE_BUFFER
MessageID: 0xd4f2594c
Message: vkCmdDrawIndexed() index size (2) * (firstIndex (543) + indexCount (159)) + binding offset (0) = an ending offset of 1404 bytes, which is greater than the index buffer size (1086). The Vulkan spec states: (indexSize * (firstIndex + indexCount) + offset) must be less than or equal to the size of the bound index buffer, with indexSize being based on the type specified by indexType, where the index buffer, indexType, and offset are specified via vkCmdBindIndexBuffer (https://vulkan.lunarg.com/doc/view/1.2.141.0/windows/1.2-extensions/vkspec.html#VUID-vkCmdDrawIndexed-indexSize-00463)

This means I could print out the stuff I really want to focus on without printing the rest.
One option would be to find some regex pattern to match this, but is there an easier way?
I can’t find another way of setting up the callback so it gives me these infos separately.
It’s a minor issue, but being able to format this as we need it would be nicer.

Greetings
Johannes

Did you check out the VkDebugUtilsMessengerCallbackDataEXT* that the callback provides? It may have some of the information you want already in an easy to use format.

Spec reference https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDebugUtilsMessengerCallbackDataEXT.html