From 87f930b684708dca04bd791b0b2eb4b6c7b5b4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Wed, 30 Apr 2025 16:00:02 +0200 Subject: [PATCH] For a RAII factory function generating an aliased handle, generate the aliasing handle instead (#2150) --- VulkanHppGenerator.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index d071224..56db0cb 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -9326,13 +9326,22 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co if ( ( vectorParams.size() == 1 ) && vectorParams.begin()->second.byStructure ) { assert( vectorParams.begin()->first == returnParams.back() ); - handleType = vectorMemberByStructure( commandData.params.back().type.type ).type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE" ); + handleType = vectorMemberByStructure( commandData.params.back().type.type ).type.type; } else { - handleType = commandData.params[returnParams.back()].type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE" ); + handleType = commandData.params[returnParams.back()].type.type; } - handleType = stripPostfix( handleType, " *" ); + auto handleIt = findByNameOrAlias( m_handles, handleType ); + assert( handleIt != m_handles.end() ); + + // in case the handle to create is an alias of an other handle, use the other handle + if ( handleIt->first != handleType ) + { + handleType = handleIt->first; + } + + handleType = "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::" + stripPrefix( handleType, "Vk" ); std::string noexceptString = enumerating ? "" : "VULKAN_HPP_RAII_CREATE_NOEXCEPT"; std::string returnType = handleType; if ( vectorParams.contains( returnParams.back() ) && !singular )