Merge pull request #1346 from asuessenbach/extension

Add support for comma-separated list of names for attribute "extension" of element <require> in element <extension>.
This commit is contained in:
Andreas Süßenbach 2022-07-05 08:13:13 +02:00 committed by GitHub
commit 193c8e4628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -1681,9 +1681,15 @@ void VulkanHppGenerator::checkExtensionCorrectness() const
// check for existence of any requirement
for ( auto const & require : extension.second.requireData )
{
check( require.title.empty() || ( m_features.find( require.title ) != m_features.end() ) || ( m_extensions.find( require.title ) != m_extensions.end() ),
require.xmlLine,
"extension <" + extension.first + "> lists an unknown require <" + require.title + ">" );
if ( !require.titles.empty() )
{
for ( auto const & title : require.titles )
{
check( ( m_features.find( title ) != m_features.end() ) || ( m_extensions.find( title ) != m_extensions.end() ),
require.xmlLine,
"extension <" + extension.first + "> lists an unknown require <" + title + ">" );
}
}
}
}
}
@ -11062,7 +11068,9 @@ void VulkanHppGenerator::readExtensionsExtensionRequire( tinyxml2::XMLElement co
requireTitle = attribute.second;
check( std::find_if( extensionIt->second.requireData.begin(),
extensionIt->second.requireData.end(),
[&requireTitle]( RequireData const & rd ) { return rd.title == requireTitle; } ) == extensionIt->second.requireData.end(),
[&requireTitle]( RequireData const & rd ) {
return std::find( rd.titles.begin(), rd.titles.end(), requireTitle ) != rd.titles.end();
} ) == extensionIt->second.requireData.end(),
line,
"required extension <" + requireTitle + "> already listed" );
}
@ -12910,6 +12918,8 @@ std::string VulkanHppGenerator::TypeInfo::compose( std::string const & nameSpace
( postfix.empty() ? "" : " " ) + postfix;
}
VulkanHppGenerator::RequireData::RequireData( int line, std::string const & titles_ ) : titles( tokenize( titles_, "," ) ), xmlLine( line ) {}
//
// VulkanHppGenerator local functions
//

View File

@ -177,9 +177,9 @@ private:
struct RequireData
{
RequireData( int line, std::string const & title_ ) : title( title_ ), xmlLine( line ) {}
RequireData( int line, std::string const & titles_ );
std::string title;
std::vector<std::string> titles;
std::vector<std::string> commands;
std::vector<std::string> types;
int xmlLine;