Closed RedNicStone closed 1 year ago
Thanks for the well written issue! I'll take a look at this when I'm home later today.
Alternatively - if you want - you can also submit a PR fixing this issue and we will make sure to merge it asap :)
I might do that today if I find some time. I already have a custom branch with some of my own changes, so I should be able to apply a fix and cherry-pick it.
Committed some code to resolve this issue. Having issues with the linker though :/
/usr/bin/ld: module/backend/daxa/lib/Daxa/libdaxa.a(unity_0_cxx.cxx.o): in function `daxa::ImplDevice::ImplDevice(daxa::DeviceInfo, daxa::ManagedWeakPtr, VkPhysicalDevice_T*)':
Embers/module/backend/daxa/lib/Daxa/src/impl_device.cpp:1090: undefined reference to `vkSetDebugUtilsObjectNameEXT'
Seems like the linker cant find the corresponding Vulkan function (although Vulkan is included). Has anyone experienced a similar linker error before?
Does the issue occur when you try to build in release? nevermind
Added an instance info boolean to en/disable debug utils as a whole https://github.com/Ipotrick/Daxa/commit/775f6a2523d50cc5035ead8e05a2a2ccd86702a7.
idk why your merged changes were lost (probably gabe doing sus things on the git repo again :ogre:).
Context
VK_EXT_debug_utils
is a Vulkan extension that allows the developer to gather more feedback about his usage of the API. For more details see the Vulkan registry entry. This extension has not yet been promoted to core, so its availability is optional to the driver.Issue:
Daxa requests the extension in
daxa::ImplInstace::ImplInstance(daxa::InstanceInfo)
atDaxa/src/impl_instance.cpp:61
:extension_names.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
It the tries to acquire a pointer to the
vkSetDebugUtilsObjectNameEXT
indaxa::ImplDevice::ImplDevice(daxa::DeviceInfo, daxa::ManagedWeakPtr, VkPhysicalDevice)
atDaxa/src/impl_device.cpp:714
:this->vkSetDebugUtilsObjectNameEXT = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>(vkGetDeviceProcAddr(this->vk_device, "vkSetDebugUtilsObjectNameEXT"));
This is done without checking the extensions availability using
vkEnumerateInstanceExtensionProperties
. The same also applies forvkCmdBeginDebugUtilsLabelEXT
andvkCmdEndDebugUtilsLabelEXT
.Effect:
Data exits with SIGSEGV (Segmentation fault) when calling
daxa::Instance::create_device
on platforms that do not supportVK_EXT_debug_utils
.Proposed solution:
The existence of
VK_EXT_debug_utils
should be checked before tying to acquire a function pointer to one of its methods.Additionally I propose the following changes:
VK_EXT_debug_utils
should only be enabled when compiled under a certain condition, for example only inDEBUG
mode. Otherwise this may needlessly consume resources.vkGetDeviceProcAddr
in this case is also wrong. SinceVK_EXT_debug_utils
is an instance level extension the pointer may only be acquired using an instance handle usingvkGetInstanceProcAddr
. Other use may led to undefined behaviour as stated in the Vulkan registry. The pointer should be acquired using and instance handle indaxa::InstanceImpl::InstanceImpl(daxa::InstanceInfo)
.