From b35993287ed79dfec5ab3006157db7ca722273b3 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Tue, 24 May 2022 09:01:00 +0200 Subject: [PATCH] Combine two types of commands into one generation function --- VulkanHppGenerator.cpp | 53 +----------------------------------------- VulkanHppGenerator.hpp | 4 ---- vulkan/vulkan_raii.hpp | 5 ++-- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index a87f564..c3c7b2e 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -6310,63 +6310,12 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessNoErr switch ( returnParams.size() ) { case 0: - return generateRAIIHandleCommandResultMultiSuccessNoErrors0Return( - commandIt, initialSkipCount, determineVectorParams( commandIt->second.params ), definition ); + return generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, returnParams, determineVectorParams( commandIt->second.params ), definition ); case 2: return generateRAIIHandleCommandResultMultiSuccessNoErrors2Return( commandIt, initialSkipCount, definition, returnParams ); } return ""; } -std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessNoErrors0Return( std::map::const_iterator commandIt, - size_t initialSkipCount, - std::map const & vectorParams, - bool definition ) const -{ - std::set skippedParams = determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, {}, false ); - std::string argumentList = generateArgumentListEnhanced( commandIt->second.params, {}, vectorParams, skippedParams, {}, {}, definition, false, false, false ); - std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags, false, false ); - - if ( definition ) - { - std::string const definitionTemplate = - R"( - VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT - {${functionPointerCheck} -${vectorSizeCheck} - return static_cast( getDispatcher()->${vkCommand}( ${callArguments} ) ); - } -)"; - - std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, {}, true ); - std::pair>> vectorSizeCheck = needsVectorSizeCheck( commandIt->second.params, vectorParams, {}, {} ); - std::string vectorSizeCheckString = - vectorSizeCheck.first ? generateRAIIHandleVectorSizeCheck( commandIt->first, commandIt->second, initialSkipCount, vectorSizeCheck.second, skippedParams ) - : ""; - - return replaceWithMap( definitionTemplate, - { { "argumentList", argumentList }, - { "callArguments", callArguments }, - { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, - { "commandName", commandName }, - { "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) }, - { "vectorSizeCheck", vectorSizeCheckString }, - { "vkCommand", commandIt->first } } ); - } - else - { - std::string const declarationTemplate = - R"( - VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result ${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT; -)"; - - return replaceWithMap( declarationTemplate, - { - { "argumentList", argumentList }, - { "commandName", commandName }, - } ); - } -} - std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessNoErrors2Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index dad05fb..d13f1ca 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -693,10 +693,6 @@ private: std::string generateRAIIHandleCommandResultMultiSuccessNoErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; - std::string generateRAIIHandleCommandResultMultiSuccessNoErrors0Return( std::map::const_iterator commandIt, - size_t initialSkipCount, - std::map const & vectorParamIndices, - bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessNoErrors2Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, diff --git a/vulkan/vulkan_raii.hpp b/vulkan/vulkan_raii.hpp index adcff25..91119e9 100644 --- a/vulkan/vulkan_raii.hpp +++ b/vulkan/vulkan_raii.hpp @@ -16367,8 +16367,9 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_ASSERT( getDispatcher()->vkGetDeferredOperationResultKHR && "Function needs extension enabled!" ); - return static_cast( - getDispatcher()->vkGetDeferredOperationResultKHR( static_cast( m_device ), static_cast( m_operation ) ) ); + VkResult result = + getDispatcher()->vkGetDeferredOperationResultKHR( static_cast( m_device ), static_cast( m_operation ) ); + return static_cast( result ); } VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result DeferredOperationKHR::join() const