Combine two types of commands into one generation function

This commit is contained in:
asuessenbach 2022-05-24 09:01:00 +02:00
parent 5ac2e21a1a
commit b35993287e
3 changed files with 4 additions and 58 deletions

View File

@ -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<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParams,
bool definition ) const
{
std::set<size_t> 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<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
}
)";
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, {}, true );
std::pair<bool, std::map<size_t, std::vector<size_t>>> 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<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,

View File

@ -693,10 +693,6 @@ private:
std::string generateRAIIHandleCommandResultMultiSuccessNoErrors( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition ) const;
std::string generateRAIIHandleCommandResultMultiSuccessNoErrors0Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
bool definition ) const;
std::string generateRAIIHandleCommandResultMultiSuccessNoErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,

View File

@ -16367,8 +16367,9 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_ASSERT( getDispatcher()->vkGetDeferredOperationResultKHR &&
"Function <vkGetDeferredOperationResultKHR> needs extension <VK_KHR_deferred_host_operations> enabled!" );
return static_cast<VULKAN_HPP_NAMESPACE::Result>(
getDispatcher()->vkGetDeferredOperationResultKHR( static_cast<VkDevice>( m_device ), static_cast<VkDeferredOperationKHR>( m_operation ) ) );
VkResult result =
getDispatcher()->vkGetDeferredOperationResultKHR( static_cast<VkDevice>( m_device ), static_cast<VkDeferredOperationKHR>( m_operation ) );
return static_cast<VULKAN_HPP_NAMESPACE::Result>( result );
}
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result DeferredOperationKHR::join() const