diff --git a/VkCppGenerator.cpp b/VkCppGenerator.cpp index 54a05a4..e7612ff 100644 --- a/VkCppGenerator.cpp +++ b/VkCppGenerator.cpp @@ -608,11 +608,11 @@ std::string determineReturnType(CommandData const& commandData, size_t returnInd { if (commandData.arguments[returnIndex].pureType == "void") { - returnType = "std::vector"; + returnType = "std::vector"; } else { - returnType = "std::vector<" + commandData.arguments[returnIndex].pureType + ">"; + returnType = "std::vector<" + commandData.arguments[returnIndex].pureType + ",Allocator>"; } } else @@ -1995,9 +1995,16 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st ofs << indentation; if ((templateIndex != ~0) && ((templateIndex != returnIndex) || (returnType == "Result"))) { + assert(returnType.find("Allocator") == std::string::npos); ofs << "template " << std::endl << indentation; } + else if (returnType.find("Allocator") != std::string::npos) + { + assert((returnType.substr(0, 12) == "std::vector<") && (returnType.find(',') != std::string::npos) && (12 < returnType.find(','))); + ofs << "template >" << std::endl + << indentation; + } else if (!commandData.handleCommand) { ofs << "inline "; diff --git a/vulkan/vk_cpp.hpp b/vulkan/vk_cpp.hpp index 65327b4..8a02f7b 100644 --- a/vulkan/vk_cpp.hpp +++ b/vulkan/vk_cpp.hpp @@ -13097,9 +13097,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getImageSparseMemoryRequirements( Image image ) const + template > + std::vector getImageSparseMemoryRequirements( Image image ) const { - std::vector sparseMemoryRequirements; + std::vector sparseMemoryRequirements; uint32_t sparseMemoryRequirementCount; vkGetImageSparseMemoryRequirements( m_device, static_cast( image ), &sparseMemoryRequirementCount, nullptr ); sparseMemoryRequirements.resize( sparseMemoryRequirementCount ); @@ -13553,9 +13554,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getPipelineCacheData( PipelineCache pipelineCache ) const + template > + std::vector getPipelineCacheData( PipelineCache pipelineCache ) const { - std::vector data; + std::vector data; size_t dataSize; Result result = static_cast( vkGetPipelineCacheData( m_device, static_cast( pipelineCache ), &dataSize, nullptr ) ); if ( ( result == Result::eSuccess ) && dataSize ) @@ -13593,9 +13595,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector createGraphicsPipelines( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr ) const + template > + std::vector createGraphicsPipelines( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr ) const { - std::vector pipelines( createInfos.size() ); + std::vector pipelines( createInfos.size() ); Result result = static_cast( vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( pipelines.data() ) ) ); if ( result != Result::eSuccess ) { @@ -13611,9 +13614,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector createComputePipelines( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr ) const + template > + std::vector createComputePipelines( PipelineCache pipelineCache, ArrayProxy createInfos, Optional allocator = nullptr ) const { - std::vector pipelines( createInfos.size() ); + std::vector pipelines( createInfos.size() ); Result result = static_cast( vkCreateComputePipelines( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( pipelines.data() ) ) ); if ( result != Result::eSuccess ) { @@ -13779,9 +13783,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo ) const + template > + std::vector allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo ) const { - std::vector descriptorSets( allocateInfo.descriptorSetCount ); + std::vector descriptorSets( allocateInfo.descriptorSetCount ); Result result = static_cast( vkAllocateDescriptorSets( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( descriptorSets.data() ) ) ); if ( result != Result::eSuccess ) { @@ -13947,9 +13952,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo ) const + template > + std::vector allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo ) const { - std::vector commandBuffers( allocateInfo.commandBufferCount ); + std::vector commandBuffers( allocateInfo.commandBufferCount ); Result result = static_cast( vkAllocateCommandBuffers( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( commandBuffers.data() ) ) ); if ( result != Result::eSuccess ) { @@ -13977,9 +13983,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector createSharedSwapchainsKHR( ArrayProxy createInfos, Optional allocator = nullptr ) const + template > + std::vector createSharedSwapchainsKHR( ArrayProxy createInfos, Optional allocator = nullptr ) const { - std::vector swapchains( createInfos.size() ); + std::vector swapchains( createInfos.size() ); Result result = static_cast( vkCreateSharedSwapchainsKHR( m_device, createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( swapchains.data() ) ) ); if ( result != Result::eSuccess ) { @@ -14025,9 +14032,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getSwapchainImagesKHR( SwapchainKHR swapchain ) const + template > + std::vector getSwapchainImagesKHR( SwapchainKHR swapchain ) const { - std::vector swapchainImages; + std::vector swapchainImages; uint32_t swapchainImageCount; Result result; do @@ -14126,9 +14134,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getQueueFamilyProperties() const + template > + std::vector getQueueFamilyProperties() const { - std::vector queueFamilyProperties; + std::vector queueFamilyProperties; uint32_t queueFamilyPropertyCount; vkGetPhysicalDeviceQueueFamilyProperties( m_physicalDevice, &queueFamilyPropertyCount, nullptr ); queueFamilyProperties.resize( queueFamilyPropertyCount ); @@ -14221,9 +14230,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector enumerateDeviceLayerProperties() const + template > + std::vector enumerateDeviceLayerProperties() const { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -14249,9 +14259,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector enumerateDeviceExtensionProperties( Optional layerName = nullptr ) const + template > + std::vector enumerateDeviceExtensionProperties( Optional layerName = nullptr ) const { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -14277,9 +14288,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getSparseImageFormatProperties( Format format, ImageType type, SampleCountFlagBits samples, ImageUsageFlags usage, ImageTiling tiling ) const + template > + std::vector getSparseImageFormatProperties( Format format, ImageType type, SampleCountFlagBits samples, ImageUsageFlags usage, ImageTiling tiling ) const { - std::vector properties; + std::vector properties; uint32_t propertyCount; vkGetPhysicalDeviceSparseImageFormatProperties( m_physicalDevice, static_cast( format ), static_cast( type ), static_cast( samples ), static_cast( usage ), static_cast( tiling ), &propertyCount, nullptr ); properties.resize( propertyCount ); @@ -14294,9 +14306,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getDisplayPropertiesKHR() const + template > + std::vector getDisplayPropertiesKHR() const { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -14322,9 +14335,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getDisplayPlanePropertiesKHR() const + template > + std::vector getDisplayPlanePropertiesKHR() const { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -14350,9 +14364,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex ) const + template > + std::vector getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex ) const { - std::vector displays; + std::vector displays; uint32_t displayCount; Result result; do @@ -14378,9 +14393,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getDisplayModePropertiesKHR( DisplayKHR display ) const + template > + std::vector getDisplayModePropertiesKHR( DisplayKHR display ) const { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -14493,9 +14509,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getSurfaceFormatsKHR( SurfaceKHR surface ) const + template > + std::vector getSurfaceFormatsKHR( SurfaceKHR surface ) const { - std::vector surfaceFormats; + std::vector surfaceFormats; uint32_t surfaceFormatCount; Result result; do @@ -14521,9 +14538,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector getSurfacePresentModesKHR( SurfaceKHR surface ) const + template > + std::vector getSurfacePresentModesKHR( SurfaceKHR surface ) const { - std::vector presentModes; + std::vector presentModes; uint32_t presentModeCount; Result result; do @@ -14783,9 +14801,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - std::vector enumeratePhysicalDevices() const + template > + std::vector enumeratePhysicalDevices() const { - std::vector physicalDevices; + std::vector physicalDevices; uint32_t physicalDeviceCount; Result result; do @@ -15074,9 +15093,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - inline std::vector enumerateInstanceLayerProperties() + template > + std::vector enumerateInstanceLayerProperties() { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do @@ -15102,9 +15122,10 @@ namespace vk } #ifndef VKCPP_DISABLE_ENHANCED_MODE - inline std::vector enumerateInstanceExtensionProperties( Optional layerName = nullptr ) + template > + std::vector enumerateInstanceExtensionProperties( Optional layerName = nullptr ) { - std::vector properties; + std::vector properties; uint32_t propertyCount; Result result; do