Merge pull request #1184 from asuessenbach/function

Generalize command generation for a specific type of commands
This commit is contained in:
Andreas Süßenbach 2022-02-01 09:26:42 +01:00 committed by GitHub
commit ab43775b5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2461,9 +2461,11 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamD
{ {
argumentList += ", "; argumentList += ", ";
} }
std::string type = ( params[sp].type.type == "void" ) std::string type =
? "Uint8_t" ( templatedParams.find( sp ) != templatedParams.end() )
: startUpperCase( stripPrefix( params[sp].type.type, "Vk" ) ); ? ( stripPrefix( params[sp].name, "p" ) + "Type" )
: ( ( params[sp].type.type == "void" ) ? "Uint8_t"
: startUpperCase( stripPrefix( params[sp].type.type, "Vk" ) ) );
argumentList += type + "Allocator & " + startLowerCase( type ) + "Allocator"; argumentList += type + "Allocator & " + startLowerCase( type ) + "Allocator";
encounteredArgument = true; encounteredArgument = true;
} }
@ -5791,8 +5793,6 @@ std::string VulkanHppGenerator::generateCommandVoid2Return( std::string const &
std::vector<size_t> const & returnParamIndices ) const std::vector<size_t> const & returnParamIndices ) const
{ {
if ( commandData.params[returnParamIndices[0]].type.type == "uint32_t" ) if ( commandData.params[returnParamIndices[0]].type.type == "uint32_t" )
{
if ( isStructureChainAnchor( commandData.params[returnParamIndices[1]].type.type ) )
{ {
std::map<size_t, size_t> vectorParams = determineVectorParams( commandData.params ); std::map<size_t, size_t> vectorParams = determineVectorParams( commandData.params );
if ( vectorParams.size() == 1 ) if ( vectorParams.size() == 1 )
@ -5800,6 +5800,8 @@ std::string VulkanHppGenerator::generateCommandVoid2Return( std::string const &
if ( returnParamIndices[0] == vectorParams.begin()->second ) if ( returnParamIndices[0] == vectorParams.begin()->second )
{ {
if ( returnParamIndices[1] == vectorParams.begin()->first ) if ( returnParamIndices[1] == vectorParams.begin()->first )
{
if ( isStructureChainAnchor( commandData.params[returnParamIndices[1]].type.type ) )
{ {
return generateCommandSetStandardEnhancedWithAllocatorChained( return generateCommandSetStandardEnhancedWithAllocatorChained(
definition, definition,
@ -5813,18 +5815,7 @@ std::string VulkanHppGenerator::generateCommandVoid2Return( std::string const &
generateCommandVoidEnumerateChained( generateCommandVoidEnumerateChained(
name, commandData, initialSkipCount, definition, *vectorParams.begin(), returnParamIndices, true ) ); name, commandData, initialSkipCount, definition, *vectorParams.begin(), returnParamIndices, true ) );
} }
} else if ( !isHandleType( commandData.params[returnParamIndices[1]].type.type ) )
}
}
else if ( ( commandData.params[returnParamIndices[1]].type.type != "void" ) &&
!isHandleType( commandData.params[returnParamIndices[1]].type.type ) )
{
std::map<size_t, size_t> vectorParams = determineVectorParams( commandData.params );
if ( vectorParams.size() == 1 )
{
if ( returnParamIndices[0] == vectorParams.begin()->second )
{
if ( returnParamIndices[1] == vectorParams.begin()->first )
{ {
return generateCommandSetStandardEnhancedWithAllocator( return generateCommandSetStandardEnhancedWithAllocator(
definition, definition,
@ -5849,32 +5840,46 @@ std::string VulkanHppGenerator::generateCommandVoidEnumerate( std::string const
std::vector<size_t> const & returnParamIndices, std::vector<size_t> const & returnParamIndices,
bool withAllocators ) const bool withAllocators ) const
{ {
assert( commandData.params[0].type.type == commandData.handle && ( commandData.returnType == "void" ) &&
commandData.successCodes.empty() && commandData.errorCodes.empty() );
std::set<size_t> skippedParams = std::set<size_t> skippedParams =
determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false ); determineSkippedParams( commandData.params, initialSkipCount, { vectorParamIndex }, returnParamIndices, false );
std::string argumentList = std::set<size_t> templatedParams = determineVoidPointerParams( commandData.params );
generateArgumentListEnhanced( commandData.params, skippedParams, {}, {}, definition, withAllocators, false, true ); std::string argumentList = generateArgumentListEnhanced(
commandData.params, skippedParams, {}, templatedParams, definition, withAllocators, false, true );
std::string argumentTemplates = generateArgumentTemplates( commandData.params, templatedParams, false );
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags ); std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, m_tags );
std::string vectorElementType = stripPrefix( commandData.params[vectorParamIndex.first].type.type, "Vk" ); std::string vectorElementType = ( templatedParams.find( vectorParamIndex.first ) == templatedParams.end() )
? stripPrefix( commandData.params[vectorParamIndex.first].type.type, "Vk" )
: ( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) + "Type" );
if ( definition ) if ( definition )
{ {
const std::string functionTemplate = const std::string functionTemplate =
R"( template <typename ${vectorElementType}Allocator, typename Dispatch${typenameCheck}> R"( template <${argumentTemplates}typename ${vectorElementType}Allocator, typename Dispatch${typenameCheck}>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${className}${classSeparator}${commandName}( ${argumentList} ) const VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${className}${classSeparator}${commandName}( ${argumentList} ) const
{ {
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${vectorName}${vectorAllocator}; std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${vectorName}${vectorAllocator};
${counterType} ${counterName}; ${counterType} ${counterName};
d.${vkCommand}( ${firstCallArguments} ); d.${vkCommand}( ${firstCallArguments} );${templateArgumentSizeAssert}
${vectorName}.resize( ${counterName} ); ${vectorName}.resize( ${vectorSize} );
d.${vkCommand}( ${secondCallArguments} ); d.${vkCommand}( ${secondCallArguments} );
VULKAN_HPP_ASSERT( ${counterName} <= ${vectorName}.size() ); VULKAN_HPP_ASSERT( ${counterName} <= ${vectorName}.size()${timesTemplateTypeSize} );
return ${vectorName}; return ${vectorName};
})"; })";
std::string counterName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.second].name, "p" ) );
std::string templateArgumentSizeAssert, timesTemplateTypeSize, vectorSize;
if ( templatedParams.find( vectorParamIndex.first ) == templatedParams.end() )
{
vectorSize = counterName;
}
else
{
templateArgumentSizeAssert =
"\n VULKAN_HPP_ASSERT( " + counterName + " % sizeof( " + vectorElementType + " ) == 0 );";
timesTemplateTypeSize = " * sizeof( " + vectorElementType + " )";
vectorSize = counterName + " / sizeof( " + vectorElementType + " )";
}
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) ); std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].name, "p" ) );
std::string typenameCheck = withAllocators std::string typenameCheck = withAllocators
? ( ", typename B, typename std::enable_if<std::is_same<typename B::value_type, " + ? ( ", typename B, typename std::enable_if<std::is_same<typename B::value_type, " +
@ -5884,28 +5889,30 @@ std::string VulkanHppGenerator::generateCommandVoidEnumerate( std::string const
return replaceWithMap( return replaceWithMap(
functionTemplate, functionTemplate,
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "argumentTemplates", argumentTemplates },
{ "className", { "className",
initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "" }, initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "" },
{ "classSeparator", commandData.handle.empty() ? "" : "::" }, { "classSeparator", commandData.handle.empty() ? "" : "::" },
{ "commandName", commandName }, { "commandName", commandName },
{ "counterName", startLowerCase( stripPrefix( commandData.params[vectorParamIndex.second].name, "p" ) ) }, { "counterName", counterName },
{ "counterType", commandData.params[vectorParamIndex.second].type.type }, { "counterType", commandData.params[vectorParamIndex.second].type.type },
{ "firstCallArguments", generateCallArgumentsEnhanced( commandData, initialSkipCount, true, {}, {}, false ) }, { "firstCallArguments",
{ "secondCallArguments", generateCallArgumentsEnhanced( commandData, initialSkipCount, false, {}, {}, false ) }, generateCallArgumentsEnhanced( commandData, initialSkipCount, true, {}, templatedParams, false ) },
{ "secondCallArguments",
generateCallArgumentsEnhanced( commandData, initialSkipCount, false, {}, templatedParams, false ) },
{ "templateArgumentSizeAssert", templateArgumentSizeAssert },
{ "timesTemplateTypeSize", timesTemplateTypeSize },
{ "typenameCheck", typenameCheck }, { "typenameCheck", typenameCheck },
{ "vectorAllocator", { "vectorAllocator", withAllocators ? ( "( " + startLowerCase( vectorElementType ) + "Allocator )" ) : "" },
withAllocators
? ( "( " + startLowerCase( stripPrefix( commandData.params[vectorParamIndex.first].type.type, "Vk" ) ) +
"Allocator )" )
: "" },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
{ "vectorName", vectorName }, { "vectorName", vectorName },
{ "vectorSize", vectorSize },
{ "vkCommand", name } } ); { "vkCommand", name } } );
} }
else else
{ {
const std::string functionTemplate = const std::string functionTemplate =
R"( template <typename ${vectorElementType}Allocator = std::allocator<${vectorElementType}>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}> R"( template <${argumentTemplates}typename ${vectorElementType}Allocator = std::allocator<${vectorElementType}>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE${typenameCheck}>
VULKAN_HPP_NODISCARD std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${commandName}( ${argumentList} ) const;)"; VULKAN_HPP_NODISCARD std::vector<${vectorElementType}, ${vectorElementType}Allocator> ${commandName}( ${argumentList} ) const;)";
std::string typenameCheck = withAllocators std::string typenameCheck = withAllocators
@ -5916,6 +5923,7 @@ std::string VulkanHppGenerator::generateCommandVoidEnumerate( std::string const
return replaceWithMap( functionTemplate, return replaceWithMap( functionTemplate,
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "argumentTemplates", argumentTemplates },
{ "commandName", commandName }, { "commandName", commandName },
{ "typenameCheck", typenameCheck }, { "typenameCheck", typenameCheck },
{ "vectorElementType", vectorElementType } } ); { "vectorElementType", vectorElementType } } );
@ -6853,7 +6861,8 @@ std::string VulkanHppGenerator::generateFunctionCall( std::string const &
assert( commandData.params[it->first].type.postfix.back() == '*' ); assert( commandData.params[it->first].type.postfix.back() == '*' );
if ( ( returnParam == it->first ) && twoStep && firstCall ) if ( ( returnParam == it->first ) && twoStep && firstCall )
{ {
// this parameter is the return parameter, and it's the first call of a two-step algorithm -> just just nullptr // this parameter is the return parameter, and it's the first call of a two-step algorithm -> just just
// nullptr
str += "nullptr"; str += "nullptr";
} }
else else
@ -6888,7 +6897,8 @@ std::string VulkanHppGenerator::generateFunctionCall( std::string const &
// this parameter is a count parameter for a vector parameter // this parameter is a count parameter for a vector parameter
// the corresponding vector parameter is not the return parameter, or it's not a two-step algorithm // the corresponding vector parameter is not the return parameter, or it's not a two-step algorithm
// for the non-singular version, the count is the size of the vector parameter // for the non-singular version, the count is the size of the vector parameter
// -> use the vector parameter name without leading 'p' to get the size (in number of elements, not in bytes) // -> use the vector parameter name without leading 'p' to get the size (in number of elements, not in
// bytes)
assert( commandData.params[it->first].name[0] == 'p' ); assert( commandData.params[it->first].name[0] == 'p' );
str += startLowerCase( stripPrefix( commandData.params[it->first].name, "p" ) ) + ".size() "; str += startLowerCase( stripPrefix( commandData.params[it->first].name, "p" ) ) + ".size() ";
if ( it->first == templateParamIndex ) if ( it->first == templateParamIndex )
@ -9778,9 +9788,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid(
break; break;
case 2: case 2:
if ( commandIt->second.params[returnParamIndices[0]].type.type == "uint32_t" ) if ( commandIt->second.params[returnParamIndices[0]].type.type == "uint32_t" )
{
if ( ( commandIt->second.params[returnParamIndices[1]].type.type != "void" ) &&
!isHandleType( commandIt->second.params[returnParamIndices[1]].type.type ) )
{ {
std::map<size_t, size_t> vectorParams = determineVectorParams( commandIt->second.params ); std::map<size_t, size_t> vectorParams = determineVectorParams( commandIt->second.params );
if ( vectorParams.size() == 1 ) if ( vectorParams.size() == 1 )
@ -9800,7 +9807,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid(
} }
} }
} }
}
break; break;
} }
return str; return str;
@ -10074,28 +10080,30 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid2ReturnEnumerateVal
std::vector<size_t> const & returnParamIndices, std::vector<size_t> const & returnParamIndices,
bool definition ) const bool definition ) const
{ {
assert( returnParamIndices.size() == 2 );
assert( vectorParams.size() == 1 );
std::set<size_t> skippedParams = std::set<size_t> skippedParams =
determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, returnParamIndices, false ); determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, returnParamIndices, false );
std::string argumentList = std::set<size_t> templatedParams = determineVoidPointerParams( commandIt->second.params );
generateArgumentListEnhanced( commandIt->second.params, skippedParams, {}, {}, definition, false, false, false ); std::string argumentList = generateArgumentListEnhanced(
commandIt->second.params, skippedParams, {}, templatedParams, definition, false, false, false );
std::string argumentTemplates = generateArgumentTemplates( commandIt->second.params, templatedParams, true );
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 = std::string vectorElementType =
stripPostfix( commandIt->second.params[vectorParams.begin()->first].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ); ( templatedParams.find( vectorParams.begin()->first ) == templatedParams.end() )
? stripPostfix( commandIt->second.params[vectorParams.begin()->first].type.compose( "VULKAN_HPP_NAMESPACE" ),
"*" )
: ( stripPrefix( commandIt->second.params[vectorParams.begin()->first].name, "p" ) + "Type" );
if ( definition ) if ( definition )
{ {
const std::string definitionTemplate = const std::string definitionTemplate =
R"( R"(${argumentTemplates}
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<${vectorElementType}> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
{${functionPointerCheck} {${functionPointerCheck}
${counterType} ${counterName}; ${counterType} ${counterName};
getDispatcher()->${vkCommand}( ${firstCallArguments} ); getDispatcher()->${vkCommand}( ${firstCallArguments} );${templateArgumentSizeAssert}
std::vector<${vectorElementType}> ${vectorName}( ${counterName} ); std::vector<${vectorElementType}> ${vectorName}( ${vectorSize} );
getDispatcher()->${vkCommand}( ${secondCallArguments} ); getDispatcher()->${vkCommand}( ${secondCallArguments} );
VULKAN_HPP_ASSERT( ${counterName} == ${vectorName}.size() ); VULKAN_HPP_ASSERT( ${counterName} == ${vectorName}.size()${timesTemplateTypeSize} );
return ${vectorName}; return ${vectorName};
} }
)"; )";
@ -10103,15 +10111,28 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid2ReturnEnumerateVal
std::string counterName = std::string counterName =
startLowerCase( stripPrefix( commandIt->second.params[vectorParams.begin()->second].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[vectorParams.begin()->second].name, "p" ) );
std::string firstCallArguments = std::string firstCallArguments =
generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, true, {}, {}, true ); generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, true, {}, templatedParams, true );
std::string secondCallArguments = std::string secondCallArguments =
generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, {}, true ); generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, templatedParams, true );
std::string templateArgumentSizeAssert, timesTemplateTypeSize, vectorSize;
if ( templatedParams.find( vectorParams.begin()->first ) == templatedParams.end() )
{
vectorSize = counterName;
}
else
{
templateArgumentSizeAssert =
"\n VULKAN_HPP_ASSERT( " + counterName + " % sizeof( " + vectorElementType + " ) == 0 );";
timesTemplateTypeSize = " * sizeof( " + vectorElementType + " )";
vectorSize = counterName + " / sizeof( " + vectorElementType + " )";
}
std::string vectorName = std::string vectorName =
startLowerCase( stripPrefix( commandIt->second.params[vectorParams.begin()->first].name, "p" ) ); startLowerCase( stripPrefix( commandIt->second.params[vectorParams.begin()->first].name, "p" ) );
return replaceWithMap( return replaceWithMap(
definitionTemplate, definitionTemplate,
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "argumentTemplates", argumentTemplates },
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
{ "commandName", commandName }, { "commandName", commandName },
{ "counterName", counterName }, { "counterName", counterName },
@ -10119,19 +10140,23 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandVoid2ReturnEnumerateVal
{ "firstCallArguments", firstCallArguments }, { "firstCallArguments", firstCallArguments },
{ "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) }, { "functionPointerCheck", generateFunctionPointerCheck( commandIt->first, commandIt->second.referencedIn ) },
{ "secondCallArguments", secondCallArguments }, { "secondCallArguments", secondCallArguments },
{ "templateArgumentSizeAssert", templateArgumentSizeAssert },
{ "timesTemplateTypeSize", timesTemplateTypeSize },
{ "vectorElementType", vectorElementType }, { "vectorElementType", vectorElementType },
{ "vectorName", vectorName }, { "vectorName", vectorName },
{ "vectorSize", vectorSize },
{ "vkCommand", commandIt->first } } ); { "vkCommand", commandIt->first } } );
} }
else else
{ {
std::string const declarationTemplate = std::string const declarationTemplate =
R"( R"(${argumentTemplates}
VULKAN_HPP_NODISCARD std::vector<${vectorElementType}> ${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT; VULKAN_HPP_NODISCARD std::vector<${vectorElementType}> ${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT;
)"; )";
return replaceWithMap( declarationTemplate, return replaceWithMap( declarationTemplate,
{ { "argumentList", argumentList }, { { "argumentList", argumentList },
{ "argumentTemplates", argumentTemplates },
{ "commandName", commandName }, { "commandName", commandName },
{ "vectorElementType", vectorElementType } } ); { "vectorElementType", vectorElementType } } );
} }
@ -12326,12 +12351,13 @@ std::tuple<std::string, std::string, std::string, std::string>
} }
else else
{ {
// as we don't have any meaningful default initialization values, everything can be initialized by just '{}' ! // as we don't have any meaningful default initialization values, everything can be initialized by just '{}'
// !
assert( member.arraySizes.empty() || member.bitCount.empty() ); assert( member.arraySizes.empty() || member.bitCount.empty() );
if ( !member.bitCount.empty() ) if ( !member.bitCount.empty() )
{ {
members += " : " + member.bitCount; // except for bitfield members, where no default member initializatin is members += " : " + member.bitCount; // except for bitfield members, where no default member initializatin
// supported (up to C++20) // is supported (up to C++20)
} }
else else
{ {
@ -12566,8 +12592,8 @@ std::string VulkanHppGenerator::generateUnion( std::pair<std::string, StructureD
{ {
if ( listedTypes.insert( memberIt->type ).second ) if ( listedTypes.insert( memberIt->type ).second )
{ {
// VkBool32 is aliased to uint32_t. Don't create a VkBool32 constructor if the union also contains a uint32_t // VkBool32 is aliased to uint32_t. Don't create a VkBool32 constructor if the union also contains a
// constructor. // uint32_t constructor.
if ( memberIt->type.type == "VkBool32" ) if ( memberIt->type.type == "VkBool32" )
{ {
if ( findStructMemberItByType( "uint32_t", structure.second.members ) != structure.second.members.end() ) if ( findStructMemberItByType( "uint32_t", structure.second.members ) != structure.second.members.end() )
@ -13533,8 +13559,8 @@ void VulkanHppGenerator::readExtensionsExtension( tinyxml2::XMLElement const * e
{ {
if ( platform.empty() ) if ( platform.empty() )
{ {
// for now, having the attribute provisional="true" implies attribute platform="provisional" to get stuff // for now, having the attribute provisional="true" implies attribute platform="provisional" to get
// protected by VK_ENABLE_BETA_EXTENSIONS // stuff protected by VK_ENABLE_BETA_EXTENSIONS
platform = "provisional"; platform = "provisional";
} }
check( check(
@ -15791,8 +15817,8 @@ void checkAttributes( int line,
std::map<std::string, std::set<std::string>> const & required, std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional ) std::map<std::string, std::set<std::string>> const & optional )
{ {
// check if all required attributes are included and if there is a set of allowed values, check if the actual value // check if all required attributes are included and if there is a set of allowed values, check if the actual
// is part of that set // value is part of that set
for ( auto const & r : required ) for ( auto const & r : required )
{ {
auto attributesIt = attributes.find( r.first ); auto attributesIt = attributes.find( r.first );
@ -15801,8 +15827,8 @@ void checkAttributes( int line,
line, line,
"unexpected attribute value <" + attributesIt->second + "> in attribute <" + r.first + ">" ); "unexpected attribute value <" + attributesIt->second + "> in attribute <" + r.first + ">" );
} }
// check if all not required attributes or optional, and if there is a set of allowed values, check if the actual // check if all not required attributes or optional, and if there is a set of allowed values, check if the
// value is part of that set // actual value is part of that set
for ( auto const & a : attributes ) for ( auto const & a : attributes )
{ {
if ( required.find( a.first ) == required.end() ) if ( required.find( a.first ) == required.end() )
@ -15913,7 +15939,8 @@ std::pair<std::string, std::string>
prefix = toUpperCase( name ) + "_"; prefix = toUpperCase( name ) + "_";
} }
// if the enum name contains a tag move it from the prefix to the postfix to generate correct enum value names. // if the enum name contains a tag move it from the prefix to the postfix to generate correct enum value
// names.
for ( auto const & tag : tags ) for ( auto const & tag : tags )
{ {
if ( endsWith( prefix, tag + "_" ) ) if ( endsWith( prefix, tag + "_" ) )
@ -16003,8 +16030,8 @@ std::string generateStandardArrayWrapper( std::string const & type, std::vector<
std::string generateSuccessCode( std::string const & code, std::set<std::string> const & tags ) std::string generateSuccessCode( std::string const & code, std::set<std::string> const & tags )
{ {
std::string tag = findTag( tags, code ); std::string tag = findTag( tags, code );
// on each success code: prepend 'VULKAN_HPP_NAMESPACE::Result::e', strip "VK_" and a tag, convert it to camel case, // on each success code: prepend 'VULKAN_HPP_NAMESPACE::Result::e', strip "VK_" and a tag, convert it to camel
// and add the tag again // case, and add the tag again
return "VULKAN_HPP_NAMESPACE::Result::e" + toCamelCase( stripPostfix( stripPrefix( code, "VK_" ), tag ) ) + tag; return "VULKAN_HPP_NAMESPACE::Result::e" + toCamelCase( stripPostfix( stripPrefix( code, "VK_" ), tag ) ) + tag;
} }