Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warning on "ratified" and "supported" being different for an extension. #1728

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13271,7 +13271,6 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element )
checkElements( line, children, { { "require", false } } );

ExtensionData extensionData{ .xmlLine = line };
std::vector<std::string> ratified, supported;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "depends" )
Expand Down Expand Up @@ -13363,30 +13362,28 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element )
}
else if ( attribute.first == "ratified" )
{
ratified = tokenize( attribute.second, "," );
extensionData.ratified = tokenize( attribute.second, "," );
}
else if ( attribute.first == "supported" )
{
supported = tokenize( attribute.second, "," );
extensionData.supported = tokenize( attribute.second, "," );
}
else if ( attribute.first == "type" )
{
extensionData.type = attribute.second;
}
}

checkForWarning( std::any_of( supported.begin(), supported.end(), []( std::string const & s ) { return s == "disabled"; } ) || extensionData.isDeprecated ||
ratified.empty() || ( supported == ratified ),
line,
"attribute \"ratified\" differs from attribute \"supported\"" );
bool extensionSupported = supported.empty() || std::any_of( supported.begin(), supported.end(), [this]( std::string const & s ) { return s == m_api; } );
bool extensionSupported =
extensionData.supported.empty() ||
std::any_of( extensionData.supported.begin(), extensionData.supported.end(), [this]( std::string const & s ) { return s == m_api; } );
checkForError( !extensionSupported || !extensionData.type.empty(), line, "missing attribute \"type\" for supported extension <" + extensionData.name + ">" );
for ( auto child : children )
{
readExtensionRequire( child, extensionData, extensionSupported );
}

if ( std::none_of( supported.begin(), supported.end(), []( std::string const & s ) { return s == "disabled"; } ) )
if ( std::none_of( extensionData.supported.begin(), extensionData.supported.end(), []( std::string const & s ) { return s == "disabled"; } ) )
{
// extract the tag from the name, which is supposed to look like VK_<tag>_<other>
size_t tagStart = extensionData.name.find( '_' );
Expand Down
2 changes: 2 additions & 0 deletions VulkanHppGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ class VulkanHppGenerator
std::string platform = {};
std::string promotedTo = {};
std::map<std::string, std::vector<std::vector<std::string>>> depends = {};
std::vector<std::string> ratified = {};
std::vector<RequireData> requireData = {};
std::vector<std::string> supported = {};
std::string type = {};
int xmlLine = 0;
};
Expand Down
Loading