Identify delete commands starting with "vkRelease" (#1697)

This commit is contained in:
Andreas Süßenbach 2023-10-16 16:01:35 +02:00 committed by GitHub
parent d2134fefe2
commit 962979c679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 53 deletions

View File

@ -15194,17 +15194,32 @@ TypeInfo VulkanHppGenerator::readTypeInfo( tinyxml2::XMLElement const * element
void VulkanHppGenerator::registerDeleter( std::string const & commandName, CommandData const & commandData )
{
if ( ( commandName.substr( 2, 7 ) == "Destroy" ) || ( commandName.substr( 2, 4 ) == "Free" ) )
// some special handling for release functions that don't release an object
const std::set<std::string> noDeleterFunctions = { "vkReleaseFullScreenExclusiveModeEXT", "vkReleaseProfilingLockKHR", "vkReleaseSwapchainImagesEXT" };
if ( ( commandName.substr( 2, 7 ) == "Destroy" ) || ( commandName.substr( 2, 4 ) == "Free" ) ||
( ( commandName.substr( 2, 7 ) == "Release" ) && !noDeleterFunctions.contains( commandName ) ) )
{
std::string key;
size_t valueIndex;
switch ( commandData.params.size() )
{
case 2:
if ( commandData.params.back().type.type == "VkAllocationCallbacks" )
{
key = "";
valueIndex = 0;
}
else
{
key = commandData.params[0].type.type;
valueIndex = 1;
}
break;
case 3:
assert( commandData.params.back().type.type == "VkAllocationCallbacks" );
key = ( commandData.params.size() == 2 ) ? "" : commandData.params[0].type.type;
valueIndex = commandData.params.size() - 2;
key = commandData.params[0].type.type;
valueIndex = 1;
break;
case 4:
key = commandData.params[0].type.type;

View File

@ -2874,6 +2874,9 @@ export namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_swapchain ===
using VULKAN_HPP_NAMESPACE::UniqueSwapchainKHR;
//=== VK_KHR_display ===
using VULKAN_HPP_NAMESPACE::UniqueDisplayKHR;
//=== VK_EXT_debug_report ===
using VULKAN_HPP_NAMESPACE::UniqueDebugReportCallbackEXT;
@ -2897,6 +2900,9 @@ export namespace VULKAN_HPP_NAMESPACE
//=== VK_NV_ray_tracing ===
using VULKAN_HPP_NAMESPACE::UniqueAccelerationStructureNV;
//=== VK_INTEL_performance_query ===
using VULKAN_HPP_NAMESPACE::UniquePerformanceConfigurationINTEL;
//=== VK_KHR_deferred_host_operations ===
using VULKAN_HPP_NAMESPACE::UniqueDeferredOperationKHR;

View File

@ -2095,6 +2095,16 @@ namespace VULKAN_HPP_NAMESPACE
using UniqueSwapchainKHR = UniqueHandle<SwapchainKHR, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_KHR_display ===
template <typename Dispatch>
class UniqueHandleTraits<DisplayKHR, Dispatch>
{
public:
using deleter = ObjectDestroy<PhysicalDevice, Dispatch>;
};
using UniqueDisplayKHR = UniqueHandle<DisplayKHR, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_EXT_debug_report ===
template <typename Dispatch>
class UniqueHandleTraits<DebugReportCallbackEXT, Dispatch>
@ -2183,6 +2193,16 @@ namespace VULKAN_HPP_NAMESPACE
using UniqueAccelerationStructureNV = UniqueHandle<AccelerationStructureNV, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_INTEL_performance_query ===
template <typename Dispatch>
class UniqueHandleTraits<PerformanceConfigurationINTEL, Dispatch>
{
public:
using deleter = ObjectDestroy<Device, Dispatch>;
};
using UniquePerformanceConfigurationINTEL = UniqueHandle<PerformanceConfigurationINTEL, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_KHR_deferred_host_operations ===
template <typename Dispatch>
class UniqueHandleTraits<DeferredOperationKHR, Dispatch>

View File

@ -708,6 +708,17 @@ namespace VULKAN_HPP_NAMESPACE
using SharedSwapchainKHR = SharedHandle<SwapchainKHR>;
//=== VK_KHR_display ===
template <>
class SharedHandleTraits<DisplayKHR>
{
public:
using DestructorType = PhysicalDevice;
using deleter = ObjectDestroyShared<DisplayKHR>;
};
using SharedDisplayKHR = SharedHandle<DisplayKHR>;
//=== VK_EXT_debug_report ===
template <>
class SharedHandleTraits<DebugReportCallbackEXT>
@ -805,6 +816,17 @@ namespace VULKAN_HPP_NAMESPACE
using SharedAccelerationStructureNV = SharedHandle<AccelerationStructureNV>;
//=== VK_INTEL_performance_query ===
template <>
class SharedHandleTraits<PerformanceConfigurationINTEL>
{
public:
using DestructorType = Device;
using deleter = ObjectDestroyShared<PerformanceConfigurationINTEL>;
};
using SharedPerformanceConfigurationINTEL = SharedHandle<PerformanceConfigurationINTEL>;
//=== VK_KHR_deferred_host_operations ===
template <>
class SharedHandleTraits<DeferredOperationKHR>
@ -1015,22 +1037,6 @@ namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_display ===
template <>
class SharedHandle<DisplayKHR> : public SharedHandleBaseNoDestroy<DisplayKHR, SharedPhysicalDevice>
{
friend SharedHandleBase<DisplayKHR, SharedPhysicalDevice>;
public:
SharedHandle() = default;
explicit SharedHandle( DisplayKHR handle, SharedPhysicalDevice parent ) noexcept
: SharedHandleBaseNoDestroy<DisplayKHR, SharedPhysicalDevice>( handle, std::move( parent ) )
{
}
};
using SharedDisplayKHR = SharedHandle<DisplayKHR>;
template <>
class SharedHandle<DisplayModeKHR> : public SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR>
{
@ -1046,24 +1052,6 @@ namespace VULKAN_HPP_NAMESPACE
};
using SharedDisplayModeKHR = SharedHandle<DisplayModeKHR>;
//=== VK_INTEL_performance_query ===
template <>
class SharedHandle<PerformanceConfigurationINTEL> : public SharedHandleBaseNoDestroy<PerformanceConfigurationINTEL, SharedDevice>
{
friend SharedHandleBase<PerformanceConfigurationINTEL, SharedDevice>;
public:
SharedHandle() = default;
explicit SharedHandle( PerformanceConfigurationINTEL handle, SharedDevice parent ) noexcept
: SharedHandleBaseNoDestroy<PerformanceConfigurationINTEL, SharedDevice>( handle, std::move( parent ) )
{
}
};
using SharedPerformanceConfigurationINTEL = SharedHandle<PerformanceConfigurationINTEL>;
#endif // !VULKAN_HPP_NO_SMART_HANDLE
} // namespace VULKAN_HPP_NAMESPACE
#endif // VULKAN_SHARED_HPP

View File

@ -1347,6 +1347,9 @@ export namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_surface ===
using VULKAN_HPP_NAMESPACE::UniqueSurfaceKHR;
//=== VK_KHR_display ===
using VULKAN_HPP_NAMESPACE::UniqueDisplayKHR;
//=== VK_EXT_debug_utils ===
using VULKAN_HPP_NAMESPACE::UniqueDebugUtilsMessengerEXT;
using VULKAN_HPP_NAMESPACE::UniqueHandleTraits;

View File

@ -991,6 +991,16 @@ namespace VULKAN_HPP_NAMESPACE
using UniqueSurfaceKHR = UniqueHandle<SurfaceKHR, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_KHR_display ===
template <typename Dispatch>
class UniqueHandleTraits<DisplayKHR, Dispatch>
{
public:
using deleter = ObjectDestroy<PhysicalDevice, Dispatch>;
};
using UniqueDisplayKHR = UniqueHandle<DisplayKHR, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>;
//=== VK_EXT_debug_utils ===
template <typename Dispatch>
class UniqueHandleTraits<DebugUtilsMessengerEXT, Dispatch>

View File

@ -636,6 +636,17 @@ namespace VULKAN_HPP_NAMESPACE
using SharedSurfaceKHR = SharedHandle<SurfaceKHR>;
//=== VK_KHR_display ===
template <>
class SharedHandleTraits<DisplayKHR>
{
public:
using DestructorType = PhysicalDevice;
using deleter = ObjectDestroyShared<DisplayKHR>;
};
using SharedDisplayKHR = SharedHandle<DisplayKHR>;
//=== VK_EXT_debug_utils ===
template <>
class SharedHandleTraits<DebugUtilsMessengerEXT>
@ -886,22 +897,6 @@ namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_display ===
template <>
class SharedHandle<DisplayKHR> : public SharedHandleBaseNoDestroy<DisplayKHR, SharedPhysicalDevice>
{
friend SharedHandleBase<DisplayKHR, SharedPhysicalDevice>;
public:
SharedHandle() = default;
explicit SharedHandle( DisplayKHR handle, SharedPhysicalDevice parent ) noexcept
: SharedHandleBaseNoDestroy<DisplayKHR, SharedPhysicalDevice>( handle, std::move( parent ) )
{
}
};
using SharedDisplayKHR = SharedHandle<DisplayKHR>;
template <>
class SharedHandle<DisplayModeKHR> : public SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR>
{