Skip to content

Commit

Permalink
Allow the <feature>'s "name" to be a list of members (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
asuessenbach authored Oct 17, 2024
1 parent 8592ed9 commit 64f5bbf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
22 changes: 13 additions & 9 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14792,12 +14792,13 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
checkAttributes( line, attributes, { { "name", {} }, { "struct", {} } }, {} );
checkElements( line, getChildElements( element ), {} );

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

return { name, structure, line };
}
Expand Down
6 changes: 3 additions & 3 deletions VulkanHppGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ class VulkanHppGenerator

struct RequireFeature
{
std::string name = {};
std::string structure = {};
int xmlLine = {};
std::vector<std::string> name = {};
std::string structure = {};
int xmlLine = {};
};

struct RemoveData
Expand Down

0 comments on commit 64f5bbf

Please sign in to comment.