diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 7a1991da1..3c1b9fbd8 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -5493,6 +5493,43 @@ std::string VulkanHppGenerator::generateConstexprUsings() const return constexprUsings; } +std::string VulkanHppGenerator::generateCppModuleFuncpointerUsings() const +{ + std::string funcpointerUsings = R"( + //==================== + //=== FUNCPOINTERs === + //==================== +)"; + + auto const generateUsingsAndProtection = [this]( std::vector const & requireData, std::string const & title ) + { + auto usings = std::string{}; + for ( auto const & require : requireData ) + { + for ( auto const & type : require.types ) + { + if ( auto const & funcpointerIt = m_funcPointers.find( type.name ); funcpointerIt != m_funcPointers.end() ) + { + usings += " using VULKAN_HPP_NAMESPACE::PFN_" + stripPrefix( funcpointerIt->first, "PFN_vk" ) + ";\n"; + } + } + } + return addTitleAndProtection( title, usings ); + }; + + for ( auto const & feature : m_features ) + { + funcpointerUsings += generateUsingsAndProtection( feature.requireData, feature.name ); + } + + for ( auto const & extension : m_extensions ) + { + funcpointerUsings += generateUsingsAndProtection( extension.requireData, extension.name ); + } + + return funcpointerUsings; +} + std::string VulkanHppGenerator::generateCppModuleHandleUsings() const { auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${className}; @@ -5980,6 +6017,7 @@ std::string VulkanHppGenerator::generateCppModuleUsings() const usings += "\n" + generateConstexprUsings() + "\n"; // structs, handles, UniqueHandles, etc + usings += generateCppModuleFuncpointerUsings(); usings += generateCppModuleStructUsings(); usings += generateCppModuleHandleUsings(); usings += generateCppModuleUniqueHandleUsings(); diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 05a5b0c00..4cc2d6217 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -745,6 +745,7 @@ class VulkanHppGenerator std::string generateConstexprString( std::string const & structName ) const; std::string generateConstexprDefines() const; std::string generateConstexprUsings() const; + std::string generateCppModuleFuncpointerUsings() const; std::string generateCppModuleHandleUsings() const; std::string generateCppModuleStructUsings() const; std::string generateCppModuleUniqueHandleUsings() const; diff --git a/vulkan/vulkan.cppm b/vulkan/vulkan.cppm index 0a55ca229..e48a65309 100644 --- a/vulkan/vulkan.cppm +++ b/vulkan/vulkan.cppm @@ -2688,6 +2688,30 @@ export namespace VULKAN_HPP_NAMESPACE using VULKAN_HPP_NAMESPACE::ApiVersion14; using VULKAN_HPP_NAMESPACE::HeaderVersionComplete; + //==================== + //=== FUNCPOINTERs === + //==================== + + //=== VK_VERSION_1_0 === + using VULKAN_HPP_NAMESPACE::PFN_AllocationFunction; + using VULKAN_HPP_NAMESPACE::PFN_FreeFunction; + using VULKAN_HPP_NAMESPACE::PFN_InternalAllocationNotification; + using VULKAN_HPP_NAMESPACE::PFN_InternalFreeNotification; + using VULKAN_HPP_NAMESPACE::PFN_ReallocationFunction; + using VULKAN_HPP_NAMESPACE::PFN_VoidFunction; + + //=== VK_EXT_debug_report === + using VULKAN_HPP_NAMESPACE::PFN_DebugReportCallbackEXT; + + //=== VK_EXT_debug_utils === + using VULKAN_HPP_NAMESPACE::PFN_DebugUtilsMessengerCallbackEXT; + + //=== VK_EXT_device_memory_report === + using VULKAN_HPP_NAMESPACE::PFN_DeviceMemoryReportCallbackEXT; + + //=== VK_LUNARG_direct_driver_loading === + using VULKAN_HPP_NAMESPACE::PFN_GetInstanceProcAddrLUNARG; + //=============== //=== STRUCTs === //===============