Minor cleanup work.

This commit is contained in:
asuessenbach 2021-11-03 09:01:24 +01:00
parent b7ce8315be
commit 2a55e8ef2f
3 changed files with 37 additions and 47 deletions

View File

@ -7733,15 +7733,14 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const bool definition ) const
{ {
std::set<size_t> skippedParameters = determineSkippedParams( std::set<size_t> skippedParameters =
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false ); determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, false );
std::string argumentList = std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false ); generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ); std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
std::string vectorElementType = commandIt->second.params[vectorParamIndices.begin()->first].type.type; std::string vectorElementType = commandIt->second.params[vectorParamIndices.begin()->first].type.type;
if ( !isHandleType( vectorElementType ) ) if ( !isHandleType( vectorElementType ) )
{ {
@ -7874,11 +7873,11 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const bool definition ) const
{ {
std::set<size_t> skippedParameters = determineSkippedParams( std::set<size_t> skippedParameters =
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false ); determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, false );
std::string argumentList = std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false ); generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
auto firstVectorParamIt = vectorParamIndices.begin(); auto firstVectorParamIt = vectorParamIndices.begin();
@ -8117,11 +8116,11 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const bool definition ) const
{ {
std::set<size_t> skippedParameters = determineSkippedParams( std::set<size_t> skippedParameters =
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false ); determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParamIndices, returnParamIndices, false );
std::string argumentList = std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false ); generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ); std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
@ -8145,10 +8144,10 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
)"; )";
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true ); std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
std::string returnType = stripPostfix( std::string returnType =
commandIt->second.params[nonConstPointerParamIndices[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ); stripPostfix( commandIt->second.params[returnParamIndices[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
std::string returnVariable = std::string returnVariable =
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[returnParamIndices[0]].name, "p" ) );
return replaceWithMap( return replaceWithMap(
functionTemplate, functionTemplate,
@ -8191,7 +8190,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
{ {
case 0: case 0:
str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, returnParamIndex, definition );
break; break;
case 1: case 1:
if ( returnParamIndex == vectorParamIndices.begin()->first ) if ( returnParamIndex == vectorParamIndices.begin()->first )
@ -8201,7 +8200,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector( str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition );
str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, returnParamIndex, definition );
} }
} }
break; break;
@ -8217,7 +8216,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector( str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition );
str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, returnParamIndex, definition );
} }
} }
} }
@ -8268,7 +8267,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
if ( vectorParamIndices.empty() ) if ( vectorParamIndices.empty() )
{ {
str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, returnParamIndex, definition );
str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition );
} }
@ -8279,7 +8278,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
{ {
case 0: case 0:
str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( str = generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue(
commandIt, initialSkipCount, vectorParamIndices, { returnParamIndex }, definition ); commandIt, initialSkipCount, vectorParamIndices, returnParamIndex, definition );
break; break;
case 2: case 2:
if ( returnParamIndex == std::next( vectorParamIndices.begin() )->first ) if ( returnParamIndex == std::next( vectorParamIndices.begin() )->first )
@ -8310,18 +8309,16 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, size_t returnParamIndex,
bool definition ) const bool definition ) const
{ {
assert( nonConstPointerParamIndices.size() == 1 );
std::set<size_t> skippedParameters = determineSkippedParams( std::set<size_t> skippedParameters = determineSkippedParams(
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, false ); commandIt->second.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, false );
std::string argumentList = std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false ); generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ); std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
std::string returnType = stripPostfix( std::string returnType =
commandIt->second.params[nonConstPointerParamIndices[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ); stripPostfix( commandIt->second.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" );
std::string typenameT; std::string typenameT;
if ( returnType == "void" ) if ( returnType == "void" )
{ {
@ -8346,8 +8343,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
)"; )";
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true ); std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, true );
std::string valueName = std::string valueName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) );
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
return replaceWithMap( return replaceWithMap(
definitionTemplate, definitionTemplate,
@ -8397,9 +8393,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
commandIt->second.params, skippedParameters, singularParams, definition, false, false, false ); commandIt->second.params, skippedParameters, singularParams, definition, false, false, false );
std::string commandName = std::string commandName =
stripPluralS( generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ) ); stripPluralS( generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ) );
assert( beginsWith( commandIt->second.params[returnParamIndex].type.type, "Vk" ) );
std::string dataType = std::string dataType =
"VULKAN_HPP_NAMESPACE::" + stripPrefix( commandIt->second.params[returnParamIndex].type.type, "Vk" ); stripPostfix( commandIt->second.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
if ( definition ) if ( definition )
{ {
@ -8459,9 +8454,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
std::string argumentList = std::string argumentList =
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false ); generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags ); std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
assert( beginsWith( commandIt->second.params[returnParamIndex].type.type, "Vk" ) );
std::string elementType = std::string elementType =
"VULKAN_HPP_NAMESPACE::" + stripPrefix( commandIt->second.params[returnParamIndex].type.type, "Vk" ); stripPostfix( commandIt->second.params[returnParamIndex].type.compose( "VULKAN_HPP_NAMESPACE" ), " *" );
if ( definition ) if ( definition )
{ {
@ -8511,14 +8505,12 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, size_t returnParamIndex,
bool definition ) const bool definition ) const
{ {
assert( nonConstPointerParamIndices.size() == 1 );
std::set<size_t> skippedParameters = determineSkippedParams( std::set<size_t> skippedParameters = determineSkippedParams(
commandIt->second.params, initialSkipCount, vectorParamIndices, nonConstPointerParamIndices, true ); commandIt->second.params, initialSkipCount, vectorParamIndices, { returnParamIndex }, true );
std::set<size_t> singularParams = determineSingularParams( nonConstPointerParamIndices[0], vectorParamIndices ); std::set<size_t> singularParams = determineSingularParams( returnParamIndex, vectorParamIndices );
std::string argumentList = generateArgumentListEnhanced( std::string argumentList = generateArgumentListEnhanced(
commandIt->second.params, skippedParameters, singularParams, definition, false, false, false ); commandIt->second.params, skippedParameters, singularParams, definition, false, false, false );
std::string commandName = std::string commandName =
@ -8543,8 +8535,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
std::string callArguments = std::string callArguments =
generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, true ); generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, true );
std::string dataName = std::string dataName = startLowerCase( stripPrefix( commandIt->second.params[returnParamIndex].name, "p" ) );
startLowerCase( stripPrefix( commandIt->second.params[nonConstPointerParamIndices[0]].name, "p" ) );
return replaceWithMap( return replaceWithMap(
singularDefinitionTemplate, singularDefinitionTemplate,

View File

@ -942,7 +942,7 @@ private:
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const; bool definition ) const;
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return(
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
@ -953,7 +953,7 @@ private:
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const; bool definition ) const;
std::string generateRAIIHandleCommandResultSingleSuccessNoErrors( std::string generateRAIIHandleCommandResultSingleSuccessNoErrors(
std::map<std::string, CommandData>::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::map<std::string, CommandData>::const_iterator commandIt, size_t initialSkipCount, bool definition ) const;
@ -973,7 +973,7 @@ private:
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const; bool definition ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1Return( std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1Return(
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
@ -984,7 +984,7 @@ private:
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValueSingular( std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValueSingular(
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
@ -1002,7 +1002,7 @@ private:
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector( std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector(
std::map<std::string, CommandData>::const_iterator commandIt, std::map<std::string, CommandData>::const_iterator commandIt,

View File

@ -1165,8 +1165,7 @@ namespace vk
{ {
#if defined( NDEBUG ) #if defined( NDEBUG )
// in non-debug mode just use the InstanceCreateInfo for instance creation // in non-debug mode just use the InstanceCreateInfo for instance creation
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { {}, &applicationInfo, layers, extensions } );
{ {}, &applicationInfo, layers, extensions } );
#else #else
// in debug mode, addionally use the debugUtilsMessengerCallback in instance creation! // in debug mode, addionally use the debugUtilsMessengerCallback in instance creation!
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning | vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |