mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-12-04 01:01:08 +00:00
Adjustments for update to 1.3.302 (#1999)
This commit is contained in:
parent
cdfa83ab79
commit
ab4a7ced0f
@ -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,30 +454,63 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
|
||||
{
|
||||
int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string name, value;
|
||||
for ( auto const & attribute : attributes )
|
||||
if ( attributes.contains( "alias" ) )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
checkAttributes( line, attributes, { { "alias", {} }, { "deprecated", { "aliased" } }, { "name", {} } }, {} );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string alias, name;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "value" )
|
||||
{
|
||||
value = attribute.second;
|
||||
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 ), {} );
|
||||
|
||||
std::string prefix = toUpperCase( enumIt->first ) + "_";
|
||||
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 + ">" );
|
||||
std::string name, value;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "value" )
|
||||
{
|
||||
value = attribute.second;
|
||||
}
|
||||
}
|
||||
|
||||
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 } );
|
||||
std::string prefix = toUpperCase( enumIt->first ) + "_";
|
||||
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; } ),
|
||||
line,
|
||||
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
|
||||
enumIt->second.values.push_back( { {}, name, value, line } );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )
|
||||
|
@ -42,9 +42,10 @@ private:
|
||||
|
||||
struct EnumValueData
|
||||
{
|
||||
std::string name = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
std::vector<std::pair<std::string, int>> aliases = {};
|
||||
std::string name = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct EnumData
|
||||
|
@ -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" } },
|
||||
|
@ -258,6 +258,7 @@ private:
|
||||
|
||||
struct RequireData
|
||||
{
|
||||
std::string api = {};
|
||||
std::string depends = {};
|
||||
std::vector<NameLine> commands = {};
|
||||
std::map<std::string, std::string> enumConstants = {};
|
||||
|
Loading…
Reference in New Issue
Block a user