Adjustments for update to 1.3.302 (#1999)

This commit is contained in:
Andreas Süßenbach 2024-11-27 09:56:57 +01:00 committed by GitHub
parent cdfa83ab79
commit ab4a7ced0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 72 additions and 27 deletions

View File

@ -184,6 +184,14 @@ std::string VideoHppGenerator::generateEnum( std::pair<std::string, EnumData> co
std::string valueName = "e" + toCamelCase( stripPrefix( value.name, prefix ), true );
assert( valueToNameMap.insert( { valueName, value.name } ).second );
enumValues += " " + valueName + " = " + value.name + ",\n";
for ( auto const & alias : value.aliases )
{
std::string aliasName = "e" + toCamelCase( stripPrefix( alias.first, prefix ), true );
assert( valueToNameMap.insert( { aliasName, alias.first } ).second );
enumValues += " " + aliasName + " VULKAN_HPP_DEPRECATED_17( \"" + aliasName + " is deprecated, " + valueName +
" should be used instead.\" ) = " + alias.first + ",\n";
}
}
if ( !enumValues.empty() )
@ -446,6 +454,37 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
{
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
if ( attributes.contains( "alias" ) )
{
checkAttributes( line, attributes, { { "alias", {} }, { "deprecated", { "aliased" } }, { "name", {} } }, {} );
checkElements( line, getChildElements( element ), {} );
std::string alias, name;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "alias" )
{
alias = attribute.second;
}
else if ( attribute.first == "name" )
{
name = attribute.second;
}
}
assert( !name.empty() );
auto valueIt =
std::find_if( enumIt->second.values.begin(), enumIt->second.values.end(), [&alias]( EnumValueData const & evd ) { return evd.name == alias; } );
checkForError( valueIt != enumIt->second.values.end(), line, "enum value <" + name + "> uses unknown alias <" + alias + ">" );
checkForError( std::find_if( valueIt->aliases.begin(), valueIt->aliases.end(), [&name]( auto const & alias ) { return alias.first == name; } ) ==
valueIt->aliases.end(),
line,
"enum alias <" + name + "> already listed for enum value <" + alias + ">" );
valueIt->aliases.push_back( { name, line } );
}
else
{
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
checkElements( line, getChildElements( element ), {} );
@ -466,10 +505,12 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
checkForError( std::none_of( enumIt->second.values.begin(), enumIt->second.values.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
checkForError(
std::none_of( enumIt->second.values.begin(), enumIt->second.values.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
line,
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
enumIt->second.values.push_back( { name, value, line } );
enumIt->second.values.push_back( { {}, name, value, line } );
}
}
void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )

View File

@ -42,6 +42,7 @@ private:
struct EnumValueData
{
std::vector<std::pair<std::string, int>> aliases = {};
std::string name = {};
std::string value = {};
int xmlLine = {};

View File

@ -13859,17 +13859,16 @@ void VulkanHppGenerator::readExtensionRequire( tinyxml2::XMLElement const * elem
{
const int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
checkAttributes( line, attributes, {}, { { "api", { "vulkansc" } }, { "comment", {} }, { "depends", {} } } );
checkAttributes( line, attributes, {}, { { "api", { "vulkan", "vulkansc" } }, { "comment", {} }, { "depends", {} } } );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, {}, { "command", "comment", "enum", "feature", "type" } );
RequireData requireData{ .xmlLine = line };
std::string api;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "api" )
{
api = attribute.second;
requireData.api = attribute.second;
}
else if ( attribute.first == "depends" )
{
@ -13877,13 +13876,14 @@ void VulkanHppGenerator::readExtensionRequire( tinyxml2::XMLElement const * elem
requireData.depends = attribute.second;
checkForWarning( std::none_of( extensionData.requireData.begin(),
extensionData.requireData.end(),
[&requireData]( RequireData const & rd ) { return rd.depends == requireData.depends; } ),
[&requireData]( RequireData const & rd )
{ return ( rd.api == requireData.api ) && ( rd.depends == requireData.depends ); } ),
line,
"required dependency <" + requireData.depends + "> already listed for extension <" + extensionData.name + ">" );
"required dependency <" + requireData.depends + "> already listed for extension <" + extensionData.name + "> with the same api" );
}
}
const bool requireSupported = api.empty() || ( api == m_api );
const bool requireSupported = requireData.api.empty() || ( requireData.api == m_api );
for ( auto child : children )
{
std::string value = child->Value();
@ -13944,6 +13944,7 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element )
{ "contact", {} },
{ "depends", {} },
{ "deprecatedby", {} },
{ "nofeatures", { "true" } },
{ "obsoletedby", {} },
{ "platform", {} },
{ "promotedto", {} },
@ -15075,6 +15076,7 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
{ "api", { "vulkan", "vulkansc" } },
{ "deprecated", { "ignored" } },
{ "externsync", { "true" } },
{ "featurelink", {} },
{ "len", {} },
{ "limittype", { "bitmask", "bits", "exact", "max", "min", "mul", "noauto", "not", "pot", "range", "struct" } },
{ "noautovalidity", { "true" } },

View File

@ -258,6 +258,7 @@ private:
struct RequireData
{
std::string api = {};
std::string depends = {};
std::vector<NameLine> commands = {};
std::map<std::string, std::string> enumConstants = {};