Vulkan-Hpp icon indicating copy to clipboard operation
Vulkan-Hpp copied to clipboard

Add a way to force use of the static loader, even with VK_NO_PROTOTYPES

Open HildarTheDorf opened this issue 2 years ago • 1 comments

I was trying to use vulkan.hpp in an application that already uses volk.h for function loading. By including volk.h, but then undefining VK_NO_PROTOTYPES, I can make the vulkan.hpp static loader be defined and used by default, and consume the volk function pointers. Doing it this way feels wrong, as I still want vulkan.h to not define prototypes if it's included again.

I'm not sure exactly what define should trigger the definition of the static loader, but my suggestion would be #if !defined( VK_NO_PROTOTYPES ) || (defined(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC) && VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 0). Currently VK_NO_PROTOTYPES being defined and VULKAN_HPP_DISPATCH_LOADER_DYNAMIC being defined to 0 results in a header that fails to compile as vk::DispatchLoaderStatic is referenced but not defined.

HildarTheDorf avatar Oct 18 '23 21:10 HildarTheDorf

Would you mind to provide a PR with a change that runs with your environment?

asuessenbach avatar Jan 08 '24 08:01 asuessenbach