Search code examples
vulkan

Unable to get vkDebugMarkerSetObjectNameEXT to function


I'm trying to add vkDebugMarkerSetObjectNameEXT support to an application to track down some leaked objects by adding meaningful names.

I have added VK_EXT_DEBUG_UTILS_EXTENSION_NAME to my instance extensions, and am using the vkGetInstanceProcAddr call to get the entrypoint:

pfn_vkDebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)vkGetInstanceProcAddr(vulkanInstance, "vkDebugMarkerSetObjectNameEXT");

(I initially thought the spec was confused on this last part - there's some documentation pages say this should be vkGetDeviceProcAddr which always just returns nullptr - the vkGetInstanceProcAddr call is returning a valid pointer however, but since this was promoted to the VK_EXT_debug_utils extension it's now called on the instance).

Despite having a valid pointer, any subsequent call to vkDebugMarkerSetObjectNameEXT crashes immediately, attempting to execute a null pointer.

I have other debug utils functions I've been using in this same code for a while without issue (e.g. vkCmdBeginDebugUtilsLabelEXT) so I know the extension is loaded/functioning.

Anyone have any ideas what I'm missing?


Solution

  • I figured this out, so posting an answer here just in case anyone else hits this same issue! It's actually quite obvious, but similarity in naming and the fact I was getting a valid entry-point back definitely threw me off.

    So in my question above, I was using the entry-points/structures for the original extension, prior to it becoming promoted to core. Because of similar naming, it was easy to miss this when poking through docs and examples (and specifically some good older examples I was basing this work off).

    The correct setup code is:

    pfn_vkSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(vulkanInstance, "vkSetDebugUtilsObjectNameEXT");

    and then call using the VkDebugUtilsObjectNameInfoEXT struct.

    Note the disambiguation on names here: vkDebugMarkerSetObjectNameEXT -> vkSetDebugUtilsObjectNameEXT.

    Updating to the appropriate naming works flawlessly.