diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 12705fd..e6297fc 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1241,18 +1241,24 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic(std::string & str) #if !defined(VK_NO_PROTOTYPES) // This interface is designed to be used for per-device function pointers in combination with a linked vulkan library. - DispatchLoaderDynamic(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device) VULKAN_HPP_NOEXCEPT + template + void init(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device, DynamicLoader const& dl) VULKAN_HPP_NOEXCEPT { - init(instance, device); + PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.template getProcAddress("vkGetInstanceProcAddr"); + PFN_vkGetDeviceProcAddr getDeviceProcAddr = dl.template getProcAddress("vkGetDeviceProcAddr"); + init(static_cast(instance), getInstanceProcAddr, static_cast(device), device ? getDeviceProcAddr : nullptr); } // This interface is designed to be used for per-device function pointers in combination with a linked vulkan library. + template void init(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device) VULKAN_HPP_NOEXCEPT { - static vk::DynamicLoader dl; - PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.getProcAddress("vkGetInstanceProcAddr"); - PFN_vkGetDeviceProcAddr getDeviceProcAddr = dl.getProcAddress("vkGetDeviceProcAddr"); - init(static_cast(instance), getInstanceProcAddr, static_cast(device), device ? getDeviceProcAddr : nullptr); + static DynamicLoader dl; + init(instance, device, dl); } #endif // !defined(VK_NO_PROTOTYPES) diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 65cb1bc..1502bf9 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -68558,18 +68558,24 @@ namespace VULKAN_HPP_NAMESPACE #if !defined(VK_NO_PROTOTYPES) // This interface is designed to be used for per-device function pointers in combination with a linked vulkan library. - DispatchLoaderDynamic(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device) VULKAN_HPP_NOEXCEPT + template + void init(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device, DynamicLoader const& dl) VULKAN_HPP_NOEXCEPT { - init(instance, device); + PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.template getProcAddress("vkGetInstanceProcAddr"); + PFN_vkGetDeviceProcAddr getDeviceProcAddr = dl.template getProcAddress("vkGetDeviceProcAddr"); + init(static_cast(instance), getInstanceProcAddr, static_cast(device), device ? getDeviceProcAddr : nullptr); } // This interface is designed to be used for per-device function pointers in combination with a linked vulkan library. + template void init(VULKAN_HPP_NAMESPACE::Instance const& instance, VULKAN_HPP_NAMESPACE::Device const& device) VULKAN_HPP_NOEXCEPT { - static vk::DynamicLoader dl; - PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.getProcAddress("vkGetInstanceProcAddr"); - PFN_vkGetDeviceProcAddr getDeviceProcAddr = dl.getProcAddress("vkGetDeviceProcAddr"); - init(static_cast(instance), getInstanceProcAddr, static_cast(device), device ? getDeviceProcAddr : nullptr); + static DynamicLoader dl; + init(instance, device, dl); } #endif // !defined(VK_NO_PROTOTYPES)