Allow the <feature>'s "name" to be a list of members (#1973)

This commit is contained in:
Andreas Süßenbach 2024-10-17 08:19:47 +02:00 committed by GitHub
parent 8592ed9743
commit 64f5bbf55c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View File

@ -14792,12 +14792,13 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
checkAttributes( line, attributes, { { "name", {} }, { "struct", {} } }, {} ); checkAttributes( line, attributes, { { "name", {} }, { "struct", {} } }, {} );
checkElements( line, getChildElements( element ), {} ); checkElements( line, getChildElements( element ), {} );
std::string name, structure; std::vector<std::string> name;
std::string structure;
for ( auto const & attribute : attributes ) for ( auto const & attribute : attributes )
{ {
if ( attribute.first == "name" ) if ( attribute.first == "name" )
{ {
name = attribute.second; name = tokenize( attribute.second, "," );
} }
else if ( attribute.first == "struct" ) else if ( attribute.first == "struct" )
{ {
@ -14826,13 +14827,16 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
structIt = m_structs.find( aliasIt->second.name ); structIt = m_structs.find( aliasIt->second.name );
assert( structIt != m_structs.end() ); assert( structIt != m_structs.end() );
} }
for (auto const& n : name)
{
auto memberIt = auto memberIt =
std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&name]( MemberData const & md ) { return md.name == name; } ); std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&n]( MemberData const & md ) { return md.name == n; } );
checkForError( checkForError(
memberIt != structIt->second.members.end(), line, "required feature name <" + name + "> not part of the required feature struct <" + structure + ">" ); memberIt != structIt->second.members.end(), line, "required feature name <" + n + "> not part of the required feature struct <" + structure + ">" );
checkForError( ( memberIt->type.isValue() && ( memberIt->type.type == "VkBool32" ) ), checkForError( ( memberIt->type.isValue() && ( memberIt->type.type == "VkBool32" ) ),
line, line,
"required feature name <" + name + "> is not a VkBool32 member of the required feature struct <" + structure + ">" ); "required feature name <" + n + "> is not a VkBool32 member of the required feature struct <" + structure + ">" );
}
return { name, structure, line }; return { name, structure, line };
} }

View File

@ -242,7 +242,7 @@ private:
struct RequireFeature struct RequireFeature
{ {
std::string name = {}; std::vector<std::string> name = {};
std::string structure = {}; std::string structure = {};
int xmlLine = {}; int xmlLine = {};
}; };