Add support for multiply aliased structs in <require>-<feature> tags. (#1958)

This commit is contained in:
Andreas Süßenbach 2024-09-05 17:44:31 +02:00 committed by GitHub
parent 6abd3f42a8
commit 4e6e8d3fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -580,8 +580,8 @@ ${macros}
#endif)"; #endif)";
std::string str = replaceWithMap( std::string str =
macrosTemplate, replaceWithMap( macrosTemplate,
{ { "licenseHeader", m_vulkanLicenseHeader }, { { "licenseHeader", m_vulkanLicenseHeader },
{ "macros", { "macros",
replaceWithMap( readSnippet( "macros.hpp" ), replaceWithMap( readSnippet( "macros.hpp" ),
@ -1437,7 +1437,7 @@ void VulkanHppGenerator::checkFeatureCorrectness() const
{ {
// check that each require depends actually is an extension // check that each require depends actually is an extension
// remove this check temporarily ! // remove this check temporarily !
//for ( auto const & feature : m_features ) // for ( auto const & feature : m_features )
//{ //{
// for ( auto const & require : feature.requireData ) // for ( auto const & require : feature.requireData )
// { // {
@ -14539,6 +14539,17 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
auto aliasIt = std::find_if( auto aliasIt = std::find_if(
m_structsAliases.begin(), m_structsAliases.end(), [&structure]( std::pair<std::string, AliasData> const & ad ) { return ad.first == structure; } ); m_structsAliases.begin(), m_structsAliases.end(), [&structure]( std::pair<std::string, AliasData> const & ad ) { return ad.first == structure; } );
checkForError( aliasIt != m_structsAliases.end(), line, "encountered unknown required feature struct <" + structure + ">" ); checkForError( aliasIt != m_structsAliases.end(), line, "encountered unknown required feature struct <" + structure + ">" );
auto nextAliasIt = aliasIt;
do
{
nextAliasIt = std::find_if( m_structsAliases.begin(),
m_structsAliases.end(),
[&structure = aliasIt->second.name]( std::pair<std::string, AliasData> const & ad ) { return ad.first == structure; } );
if ( nextAliasIt != m_structsAliases.end() )
{
aliasIt = nextAliasIt;
}
} while ( nextAliasIt != m_structsAliases.end() );
structIt = m_structs.find( aliasIt->second.name ); structIt = m_structs.find( aliasIt->second.name );
assert( structIt != m_structs.end() ); assert( structIt != m_structs.end() );
} }