KhronosGroup/Vulkan-Docs

vkSetDebugUtilsObjectNameEXT example in the spec is invalid

Closed this issue · 2 comments

zeux commented

The spec has the following example of using vkSetDebugUtilsObjectNameEXT:

   ​// Must call extension functions through a function pointer:
   ​PFN_vkSetDebugUtilsObjectNameEXT pfnSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetDeviceProcAddr(device, "vkSetDebugUtilsObjectNameEXT");

However, this code is technically incorrect as GDPA should only be used on device-level core commands and commands of device extensions:

#655 - initial discussion on the topic
ab08f09#diff-57bb29a947a8f7ed267e2e5cbf35045a - change that clarified the wording for GDPA (although it's still a bit confusing)

https://vulkan.lunarg.com/doc/sdk/1.2.162.1/windows/loader_and_layer_interface.html mentions this as well:

Also, unlike vkGetInstanceProcAddr, vkGetDeviceProcAddr can only be used on core Vulkan Device functions, or Device extension functions.

So in the example above, vkGetDeviceProcAddr should be changed to vkGetInstanceProcAddr. Note that this affects all examples present in VK_EXT_debug_utils; vkGetDeviceProcAddr was likely copied from VK_EXT_debug_marker, but in case of VK_EXT_debug_marker it's correct to use GDPA (as it's a device-level extension), whereas in case of VK_EXT_debug_utils it's not (as it's instance-level).

I believe that @zeux is correct, and that by the same logic this extends to the other examples in the VK_EXT_debug_utils extension appendix as well. I'll open internal MR for discussion/approval.

zeux commented

Looks like this has been fixed at some point! So closing this.