From 164cd27be048505a9678aaaccfaeb91b0f95d659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Mon, 26 Feb 2018 15:25:08 +0100 Subject: [PATCH] Fix Deleter objects for Device and DeviceMemory. (#190) --- VulkanHppGenerator.cpp | 61 +++++++++---- vulkan/vulkan.hpp | 191 +++++++++++++++++++++++------------------ 2 files changed, 152 insertions(+), 100 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index e8329a0..5a2638c 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -706,10 +706,10 @@ const std::string deleterClassString = R"( struct AllocationCallbacks; template - class ObjectDeleter + class ObjectDestroy { public: - ObjectDeleter(OwnerType owner = OwnerType(), Optional allocator = nullptr) + ObjectDestroy(OwnerType owner = OwnerType(), Optional allocator = nullptr) : m_owner(owner) , m_allocator(allocator) {} @@ -732,10 +732,10 @@ const std::string deleterClassString = R"( class NoParent; template <> - class ObjectDeleter + class ObjectDestroy { public: - ObjectDeleter( Optional allocator = nullptr ) + ObjectDestroy( Optional allocator = nullptr ) : m_allocator( allocator ) {} @@ -752,11 +752,35 @@ const std::string deleterClassString = R"( Optional m_allocator; }; - template - class PoolDeleter + template + class ObjectFree { public: - PoolDeleter(OwnerType owner = OwnerType(), PoolType pool = PoolType()) + ObjectFree(OwnerType owner = OwnerType(), Optional allocator = nullptr) + : m_owner(owner) + , m_allocator(allocator) + {} + + OwnerType getOwner() const { return m_owner; } + Optional getAllocator() const { return m_allocator; } + + protected: + template + void destroy(T t) + { + m_owner.free(t, m_allocator); + } + + private: + OwnerType m_owner; + Optional m_allocator; + }; + + template + class PoolFree + { + public: + PoolFree(OwnerType owner = OwnerType(), PoolType pool = PoolType()) : m_owner(owner) , m_pool(pool) {} @@ -2751,10 +2775,6 @@ void VulkanHppGenerator::registerDeleter(CommandData const& commandData) default: assert(false); } - if (commandData.fullName == "destroyDevice") - { - key = "PhysicalDevice"; - } assert(m_deleterTypes[key].find(commandData.params[valueIndex].pureType) == m_deleterTypes[key].end()); m_deleterTypes[key].insert(commandData.params[valueIndex].pureType); m_deleters[commandData.params[valueIndex].pureType].call = commandData.reducedName; @@ -3192,7 +3212,7 @@ ${i} return createResultValue( result, ${typeVariable}s, VULKAN_HPP_NAMESPACE_S { "vectorSize", isCreateFunction ? "createInfos.size()" : "allocateInfo." + typeVariable + "Count" }, { "command", startUpperCase(commandData.fullName) }, { "arguments", arguments.str() }, - { "Deleter", ddit->second.pool.empty() ? "ObjectDeleter" : "PoolDeleter" }, + { "Deleter", ddit->second.pool.empty() ? "ObjectDestroy" : "PoolFree" }, { "DeleterTemplate", ddit->second.pool.empty() ? commandData.className : commandData.className + "," + ddit->second.pool }, { "deleterArg", ddit->second.pool.empty() ? "allocator" : "allocateInfo." + startLowerCase(ddit->second.pool) }, { "class", commandData.className }, @@ -3487,8 +3507,9 @@ void VulkanHppGenerator::writeFunctionBodyEnhancedReturnResultValue(std::ostream std::map::const_iterator ddit = m_deleters.find(type); assert(ddit != m_deleters.end() && ddit->second.pool.empty()); + // special handling for "createDevice", as Device is created from PhysicalDevice, but destroyed on its own os << std::endl - << indentation << " ObjectDeleter<" << (commandData.className.empty() ? "NoParent" : commandData.className) << "> deleter( " << (commandData.className.empty() ? "" : "*this, ") << "allocator );" << std::endl; + << indentation << ((commandData.fullName == "allocateMemory") ? " ObjectFree<" : " ObjectDestroy<") << ((commandData.className.empty() || (commandData.fullName == "createDevice")) ? "NoParent" : commandData.className) << "> deleter( " << (commandData.className.empty() ? "" : "*this, ") << "allocator );" << std::endl; } // if the return type is "Result" or there is at least one success code, create the Result/Value construct to return @@ -4181,10 +4202,13 @@ void VulkanHppGenerator::writeTypeCommand(std::ostream & os, DependencyData cons if (commandData.fullName == "createInstance") { // special handling for createInstance, as we need to explicitly place the forward declarations and the deleter classes here +#if !defined(NDEBUG) auto deleterTypesIt = m_deleterTypes.find(""); - assert((deleterTypesIt != m_deleterTypes.end()) && (deleterTypesIt->second.size() == 1)); + assert((deleterTypesIt != m_deleterTypes.end()) && (deleterTypesIt->second.size() == 2)); + assert(deleterTypesIt->second.find("Instance") != deleterTypesIt->second.end()); +#endif - writeUniqueTypes(os, *deleterTypesIt); + writeUniqueTypes(os, std::make_pair>("", { "Instance" })); writeTypeCommand(os, " ", commandData, false); } else @@ -4294,6 +4318,11 @@ void VulkanHppGenerator::writeTypeHandle(std::ostream & os, DependencyData const { writeUniqueTypes(os, *deleterTypesIt); } + else if (dependencyData.name == "PhysicalDevice") + { + // special handling for class Device, as it's created from PhysicalDevice, but destroys itself + writeUniqueTypes(os, std::make_pair>("", { "Device" })); + } const std::string memberName = startLowerCase(dependencyData.name); const std::string templateString = @@ -4588,7 +4617,7 @@ void VulkanHppGenerator::writeUniqueTypes(std::ostream &os, std::pair class UniqueHandleTraits<" << dt << "> {public: using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << "Deleter<" << (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first) << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ">; };\n"; + os << " template <> class UniqueHandleTraits<" << dt << "> {public: using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << ((ddit->second.call.substr(0, 4) == "free") ? "Free<" : "Destroy<") << (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first) << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ">; };\n"; os << " using Unique" << dt << " = UniqueHandle<" << dt << ">;" << std::endl; } os << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 5553b88..d80560d 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -980,10 +980,10 @@ namespace VULKAN_HPP_NAMESPACE struct AllocationCallbacks; template - class ObjectDeleter + class ObjectDestroy { public: - ObjectDeleter(OwnerType owner = OwnerType(), Optional allocator = nullptr) + ObjectDestroy(OwnerType owner = OwnerType(), Optional allocator = nullptr) : m_owner(owner) , m_allocator(allocator) {} @@ -1006,10 +1006,10 @@ namespace VULKAN_HPP_NAMESPACE class NoParent; template <> - class ObjectDeleter + class ObjectDestroy { public: - ObjectDeleter( Optional allocator = nullptr ) + ObjectDestroy( Optional allocator = nullptr ) : m_allocator( allocator ) {} @@ -1026,11 +1026,35 @@ namespace VULKAN_HPP_NAMESPACE Optional m_allocator; }; - template - class PoolDeleter + template + class ObjectFree { public: - PoolDeleter(OwnerType owner = OwnerType(), PoolType pool = PoolType()) + ObjectFree(OwnerType owner = OwnerType(), Optional allocator = nullptr) + : m_owner(owner) + , m_allocator(allocator) + {} + + OwnerType getOwner() const { return m_owner; } + Optional getAllocator() const { return m_allocator; } + + protected: + template + void destroy(T t) + { + m_owner.free(t, m_allocator); + } + + private: + OwnerType m_owner; + Optional m_allocator; + }; + + template + class PoolFree + { + public: + PoolFree(OwnerType owner = OwnerType(), PoolType pool = PoolType()) : m_owner(owner) , m_pool(pool) {} @@ -28521,59 +28545,59 @@ public: #ifndef VULKAN_HPP_NO_SMART_HANDLE class Device; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueBuffer = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueBufferView = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = PoolDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = PoolFree; }; using UniqueCommandBuffer = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueCommandPool = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueDescriptorPool = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = PoolDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = PoolFree; }; using UniqueDescriptorSet = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueDescriptorSetLayout = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueDescriptorUpdateTemplateKHR = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectFree; }; using UniqueDeviceMemory = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueEvent = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueFence = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueFramebuffer = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueImage = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueImageView = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueIndirectCommandsLayoutNVX = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueObjectTableNVX = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniquePipeline = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniquePipelineCache = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniquePipelineLayout = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueQueryPool = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueRenderPass = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueSampler = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueSamplerYcbcrConversionKHR = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueSemaphore = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueShaderModule = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueSwapchainKHR = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueValidationCacheEXT = UniqueHandle; #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -29920,7 +29944,7 @@ public: DeviceMemory memory; Result result = static_cast( d.vkAllocateMemory( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &memory ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectFree deleter( *this, allocator ); return createResultValue( result, memory, VULKAN_HPP_NAMESPACE_STRING"::Device::allocateMemoryUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30122,7 +30146,7 @@ public: Fence fence; Result result = static_cast( d.vkCreateFence( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &fence ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, fence, VULKAN_HPP_NAMESPACE_STRING"::Device::createFenceUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30217,7 +30241,7 @@ public: Semaphore semaphore; Result result = static_cast( d.vkCreateSemaphore( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &semaphore ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, semaphore, VULKAN_HPP_NAMESPACE_STRING"::Device::createSemaphoreUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30269,7 +30293,7 @@ public: Event event; Result result = static_cast( d.vkCreateEvent( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &event ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, event, VULKAN_HPP_NAMESPACE_STRING"::Device::createEventUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30366,7 +30390,7 @@ public: QueryPool queryPool; Result result = static_cast( d.vkCreateQueryPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &queryPool ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, queryPool, VULKAN_HPP_NAMESPACE_STRING"::Device::createQueryPoolUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30432,7 +30456,7 @@ public: Buffer buffer; Result result = static_cast( d.vkCreateBuffer( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &buffer ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, buffer, VULKAN_HPP_NAMESPACE_STRING"::Device::createBufferUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30484,7 +30508,7 @@ public: BufferView view; Result result = static_cast( d.vkCreateBufferView( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &view ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, view, VULKAN_HPP_NAMESPACE_STRING"::Device::createBufferViewUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30536,7 +30560,7 @@ public: Image image; Result result = static_cast( d.vkCreateImage( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &image ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, image, VULKAN_HPP_NAMESPACE_STRING"::Device::createImageUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30603,7 +30627,7 @@ public: ImageView view; Result result = static_cast( d.vkCreateImageView( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &view ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, view, VULKAN_HPP_NAMESPACE_STRING"::Device::createImageViewUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30655,7 +30679,7 @@ public: ShaderModule shaderModule; Result result = static_cast( d.vkCreateShaderModule( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &shaderModule ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, shaderModule, VULKAN_HPP_NAMESPACE_STRING"::Device::createShaderModuleUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30707,7 +30731,7 @@ public: PipelineCache pipelineCache; Result result = static_cast( d.vkCreatePipelineCache( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipelineCache ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, pipelineCache, VULKAN_HPP_NAMESPACE_STRING"::Device::createPipelineCacheUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30810,7 +30834,7 @@ public: Pipeline* buffer = reinterpret_cast( reinterpret_cast( pipelines.data() ) + createInfos.size() * ( sizeof( UniquePipeline ) - sizeof( Pipeline ) ) ); Result result = static_cast(d.vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( buffer ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); for ( size_t i=0 ; i( d.vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), 1 , reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipeline ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, pipeline, VULKAN_HPP_NAMESPACE_STRING"::Device::createGraphicsPipelineUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30860,7 +30884,7 @@ public: Pipeline* buffer = reinterpret_cast( reinterpret_cast( pipelines.data() ) + createInfos.size() * ( sizeof( UniquePipeline ) - sizeof( Pipeline ) ) ); Result result = static_cast(d.vkCreateComputePipelines( m_device, static_cast( pipelineCache ), createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( buffer ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); for ( size_t i=0 ; i( d.vkCreateComputePipelines( m_device, static_cast( pipelineCache ), 1 , reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipeline ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, pipeline, VULKAN_HPP_NAMESPACE_STRING"::Device::createComputePipelineUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30926,7 +30950,7 @@ public: PipelineLayout pipelineLayout; Result result = static_cast( d.vkCreatePipelineLayout( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &pipelineLayout ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, pipelineLayout, VULKAN_HPP_NAMESPACE_STRING"::Device::createPipelineLayoutUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -30978,7 +31002,7 @@ public: Sampler sampler; Result result = static_cast( d.vkCreateSampler( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &sampler ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, sampler, VULKAN_HPP_NAMESPACE_STRING"::Device::createSamplerUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31030,7 +31054,7 @@ public: DescriptorSetLayout setLayout; Result result = static_cast( d.vkCreateDescriptorSetLayout( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &setLayout ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, setLayout, VULKAN_HPP_NAMESPACE_STRING"::Device::createDescriptorSetLayoutUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31082,7 +31106,7 @@ public: DescriptorPool descriptorPool; Result result = static_cast( d.vkCreateDescriptorPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &descriptorPool ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, descriptorPool, VULKAN_HPP_NAMESPACE_STRING"::Device::createDescriptorPoolUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31152,7 +31176,7 @@ public: DescriptorSet* buffer = reinterpret_cast( reinterpret_cast( descriptorSets.data() ) + allocateInfo.descriptorSetCount * ( sizeof( UniqueDescriptorSet ) - sizeof( DescriptorSet ) ) ); Result result = static_cast(d.vkAllocateDescriptorSets( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( buffer ) ) ); - PoolDeleter deleter( *this, allocateInfo.descriptorPool ); + PoolFree deleter( *this, allocateInfo.descriptorPool ); for ( size_t i=0 ; i( d.vkCreateFramebuffer( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &framebuffer ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, framebuffer, VULKAN_HPP_NAMESPACE_STRING"::Device::createFramebufferUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31276,7 +31300,7 @@ public: RenderPass renderPass; Result result = static_cast( d.vkCreateRenderPass( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &renderPass ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, renderPass, VULKAN_HPP_NAMESPACE_STRING"::Device::createRenderPassUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31343,7 +31367,7 @@ public: CommandPool commandPool; Result result = static_cast( d.vkCreateCommandPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &commandPool ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, commandPool, VULKAN_HPP_NAMESPACE_STRING"::Device::createCommandPoolUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31413,7 +31437,7 @@ public: CommandBuffer* buffer = reinterpret_cast( reinterpret_cast( commandBuffers.data() ) + allocateInfo.commandBufferCount * ( sizeof( UniqueCommandBuffer ) - sizeof( CommandBuffer ) ) ); Result result = static_cast(d.vkAllocateCommandBuffers( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( buffer ) ) ); - PoolDeleter deleter( *this, allocateInfo.commandPool ); + PoolFree deleter( *this, allocateInfo.commandPool ); for ( size_t i=0 ; i( reinterpret_cast( swapchainKHRs.data() ) + createInfos.size() * ( sizeof( UniqueSwapchainKHR ) - sizeof( SwapchainKHR ) ) ); Result result = static_cast(d.vkCreateSharedSwapchainsKHR( m_device, createInfos.size() , reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( buffer ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); for ( size_t i=0 ; i( d.vkCreateSharedSwapchainsKHR( m_device, 1 , reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &swapchain ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, swapchain, VULKAN_HPP_NAMESPACE_STRING"::Device::createSharedSwapchainKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31520,7 +31544,7 @@ public: SwapchainKHR swapchain; Result result = static_cast( d.vkCreateSwapchainKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &swapchain ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, swapchain, VULKAN_HPP_NAMESPACE_STRING"::Device::createSwapchainKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31659,7 +31683,7 @@ public: IndirectCommandsLayoutNVX indirectCommandsLayout; Result result = static_cast( d.vkCreateIndirectCommandsLayoutNVX( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &indirectCommandsLayout ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, indirectCommandsLayout, VULKAN_HPP_NAMESPACE_STRING"::Device::createIndirectCommandsLayoutNVXUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -31711,7 +31735,7 @@ public: ObjectTableNVX objectTable; Result result = static_cast( d.vkCreateObjectTableNVX( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &objectTable ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, objectTable, VULKAN_HPP_NAMESPACE_STRING"::Device::createObjectTableNVXUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -32156,7 +32180,7 @@ public: DescriptorUpdateTemplateKHR descriptorUpdateTemplate; Result result = static_cast( d.vkCreateDescriptorUpdateTemplateKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &descriptorUpdateTemplate ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, descriptorUpdateTemplate, VULKAN_HPP_NAMESPACE_STRING"::Device::createDescriptorUpdateTemplateKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -32364,7 +32388,7 @@ public: SamplerYcbcrConversionKHR ycbcrConversion; Result result = static_cast( d.vkCreateSamplerYcbcrConversionKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &ycbcrConversion ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, ycbcrConversion, VULKAN_HPP_NAMESPACE_STRING"::Device::createSamplerYcbcrConversionKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -32416,7 +32440,7 @@ public: ValidationCacheEXT validationCache; Result result = static_cast( d.vkCreateValidationCacheEXT( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &validationCache ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, validationCache, VULKAN_HPP_NAMESPACE_STRING"::Device::createValidationCacheEXTUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -32532,9 +32556,8 @@ public: #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #ifndef VULKAN_HPP_NO_SMART_HANDLE - class PhysicalDevice; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueDevice = UniqueHandle; #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -33056,7 +33079,7 @@ public: Device device; Result result = static_cast( d.vkCreateDevice( m_physicalDevice, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &device ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, device, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::createDeviceUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -33969,9 +33992,9 @@ public: #ifndef VULKAN_HPP_NO_SMART_HANDLE class Instance; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueDebugReportCallbackEXT = UniqueHandle; - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueSurfaceKHR = UniqueHandle; #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34318,7 +34341,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateAndroidSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createAndroidSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34345,7 +34368,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateDisplayPlaneSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createDisplayPlaneSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34372,7 +34395,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateMirSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createMirSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34426,7 +34449,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateViSurfaceNN( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createViSurfaceNNUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34454,7 +34477,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateWaylandSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createWaylandSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34482,7 +34505,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateWin32SurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createWin32SurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34510,7 +34533,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateXlibSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createXlibSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34538,7 +34561,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateXcbSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createXcbSurfaceKHRUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34565,7 +34588,7 @@ public: DebugReportCallbackEXT callback; Result result = static_cast( d.vkCreateDebugReportCallbackEXT( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &callback ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, callback, VULKAN_HPP_NAMESPACE_STRING"::Instance::createDebugReportCallbackEXTUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34666,7 +34689,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateIOSSurfaceMVK( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createIOSSurfaceMVKUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34694,7 +34717,7 @@ public: SurfaceKHR surface; Result result = static_cast( d.vkCreateMacOSSurfaceMVK( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &surface ) ) ); - ObjectDeleter deleter( *this, allocator ); + ObjectDestroy deleter( *this, allocator ); return createResultValue( result, surface, VULKAN_HPP_NAMESPACE_STRING"::Instance::createMacOSSurfaceMVKUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34767,7 +34790,7 @@ public: #ifndef VULKAN_HPP_NO_SMART_HANDLE - template <> class UniqueHandleTraits {public: using deleter = ObjectDeleter; }; + template <> class UniqueHandleTraits {public: using deleter = ObjectDestroy; }; using UniqueInstance = UniqueHandle; #endif /*VULKAN_HPP_NO_SMART_HANDLE*/ @@ -34802,7 +34825,7 @@ public: Instance instance; Result result = static_cast( d.vkCreateInstance( reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &instance ) ) ); - ObjectDeleter deleter( allocator ); + ObjectDestroy deleter( allocator ); return createResultValue( result, instance, VULKAN_HPP_NAMESPACE_STRING"::createInstanceUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/