From 605be52aa069d38f2442e66d4be6b652d11703dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 15 Jul 2025 08:32:59 +0200 Subject: [PATCH] Revert PR 2215 (#2217) --- VulkanHppGenerator.cpp | 79 ++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 8b4c6ae..0c44621 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -13766,7 +13766,7 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) attributes, {}, { { "allownoqueues", { "true" } }, - { "api", { "vulkan", "vulkanbase", "vulkansc" } }, + { "api", { "vulkan", "vulkansc" } }, { "cmdbufferlevel", { "primary", "secondary" } }, { "comment", {} }, { "errorcodes", {} }, @@ -13782,12 +13782,12 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) CommandData commandData; commandData.xmlLine = line; - std::vector api; + std::string api; for ( auto const & attribute : attributes ) { if ( attribute.first == "api" ) { - api = tokenize( attribute.second, "," ); + api = attribute.second; } else if ( attribute.first == "errorcodes" ) { @@ -13827,8 +13827,7 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) } } - checkForError( api.empty() || commandData.exports.empty() || - ( ( commandData.exports.size() == 1 ) && ( std::ranges::find( api, commandData.exports.front() ) != api.end() ) ), + checkForError( api.empty() || commandData.exports.empty() || ( ( commandData.exports.size() == 1 ) && ( api == commandData.exports.front() ) ), line, "command <" + name + "> has non-empty but different attributes and " ); @@ -13860,7 +13859,7 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) line, "command <" + name + "> does not return a VkResult but specifies successcodes" ); - if ( api.empty() || ( std::ranges::find( api, m_api ) != api.end() ) ) + if ( api.empty() || ( api == m_api ) ) { checkForError( !m_commands.contains( name ), line, "command <" + name + "> already specified" ); addCommand( name, commandData ); @@ -14682,8 +14681,7 @@ void VulkanHppGenerator::readFeature( tinyxml2::XMLElement const * element ) { const int line = element->GetLineNum(); std::map attributes = getAttributes( element ); - checkAttributes( - line, attributes, { { "api", { "vulkan", "vulkanbase", "vulkansc" } }, { "comment", {} }, { "name", {} }, { "number", {} } }, { { "depends", {} } } ); + checkAttributes( line, attributes, { { "api", { "vulkan", "vulkansc" } }, { "comment", {} }, { "name", {} }, { "number", {} } }, { { "depends", {} } } ); std::vector children = getChildElements( element ); checkElements( line, children, { { "require", false } }, { "deprecate", "remove" } ); @@ -14726,28 +14724,11 @@ void VulkanHppGenerator::readFeature( tinyxml2::XMLElement const * element ) } } - if ( std::ranges::find( featureData.api, "vulkan" ) != featureData.api.end() ) - { - checkForError( featureData.name == "VK_VERSION_" + modifiedNumber, - line, - "unexpected formatting of name <" + featureData.name + ">, expected " ); - } - else if ( std::ranges::find( featureData.api, "vulkanbase" ) != featureData.api.end() ) - { - checkForError( featureData.api.size() == 1, line, "feature <" + featureData.name + "> with api must not be combined with other apis" ); - std::string const & name = featureData.name; - checkForError( ( name == "VK_BASE_VERSION_" + modifiedNumber ) || ( name == "VK_COMPUTE_VERSION_" + modifiedNumber ) || - ( name == "VK_GRAPHICS_VERSION_" + modifiedNumber ), - line, - "unexpected formatting of name <" + featureData.name + ">" ); - } - else - { - checkForError( featureData.name == "VKSC_VERSION_" + modifiedNumber, - line, - "unexpected formatting of name <" + featureData.name + ">, expected " ); - } - + checkForError( featureData.name == + ( std::ranges::any_of( featureData.api, []( std::string const & a ) { return a == "vulkan"; } ) ? "VK_VERSION_" : "VKSC_VERSION_" ) + + modifiedNumber, + line, + "unexpected formatting of name <" + featureData.name + ">" ); checkForError( !isFeature( featureData.name ), line, "feature <" + featureData.name + "> already specified" ); if ( featureSupported ) { @@ -15318,14 +15299,9 @@ void VulkanHppGenerator::readRequireEnum( } else { - checkForError( ( eedIt->alias == alias ) && ( eedIt->api == api ) && ( eedIt->protect == protect ), + checkForError( ( eedIt->alias == alias ) && ( eedIt->api == api ) && ( eedIt->protect == protect ) && ( eedIt->supported == supported ), line, "extending enum <" + extends + "> with already listed value <" + name + "> but different properties" ); - // if a previous version was not supported, make it supported now - if ( !eedIt->supported && supported ) - { - eedIt->supported = supported; - } eedIt->requiredBy.insert( requiredBy ); } } @@ -15708,7 +15684,7 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, attributes, {}, { { "altlen", {} }, - { "api", { "vulkan", "vulkanbase", "vulkansc" } }, + { "api", { "vulkan", "vulkansc" } }, { "deprecated", { "ignored" } }, { "externsync", { "maybe", "true" } }, { "featurelink", {} }, @@ -15726,12 +15702,12 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, MemberData memberData; memberData.xmlLine = line; - std::vector api; + std::string api; for ( auto const & attribute : attributes ) { if ( attribute.first == "api" ) { - api = tokenize( attribute.second, "," ); + api = attribute.second; } else if ( attribute.first == "altlen" ) { @@ -15831,7 +15807,7 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, checkForError( ( memberData.type.postfix.length() < 3 ) || !memberData.type.postfix.starts_with( "[" ) || !memberData.type.postfix.ends_with( "]" ), line, "struct member <" + name + "> has its array size <" + memberData.type.postfix + "> at the wrong position" ); - if ( api.empty() || ( std::ranges::find( api, m_api ) != api.end() ) ) + if ( api.empty() || ( api == m_api ) ) { checkForError( std::ranges::none_of( members, [&name]( MemberData const & md ) { return md.name == name; } ), line, "struct member name <" + name + "> already used" ); @@ -16114,16 +16090,14 @@ void VulkanHppGenerator::readTypeBitmask( tinyxml2::XMLElement const * element, } else { - checkAttributes( - line, attributes, { { "category", { "bitmask" } } }, { { "api", { "vulkan", "vulkanbase", "vulkansc" } }, { "bitvalues", {} }, { "requires", {} } } ); + checkAttributes( line, attributes, { { "category", { "bitmask" } } }, { { "api", { "vulkan", "vulkansc" } }, { "bitvalues", {} }, { "requires", {} } } ); - std::vector api; - std::string bitvalues, require; + std::string api, bitvalues, require; for ( auto const & attribute : attributes ) { if ( attribute.first == "api" ) { - api = tokenize( attribute.second, "," ); + api = attribute.second; } else if ( attribute.first == "bitvalues" ) { @@ -16152,7 +16126,7 @@ void VulkanHppGenerator::readTypeBitmask( tinyxml2::XMLElement const * element, require = bitvalues; } - if ( api.empty() || ( std::ranges::find( api, m_api ) != api.end() ) ) + if ( api.empty() || ( api == m_api ) ) { checkForError( m_types.insert( { nameData.name, TypeData{ TypeCategory::Bitmask, {}, line } } ).second, line, "bitmask <" + nameData.name + "> already specified" ); @@ -16208,16 +16182,15 @@ void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, s checkAttributes( line, attributes, { { "category", { "define" } } }, - { { "api", { "vulkan", "vulkanbase", "vulkansc" } }, { "comment", {} }, { "deprecated", { "true" } }, { "name", {} }, { "requires", {} } } ); + { { "api", { "vulkan", "vulkansc" } }, { "comment", {} }, { "deprecated", { "true" } }, { "name", {} }, { "requires", {} } } ); - std::vector api; - std::string name, require; - bool deprecated = false; + std::string api, name, require; + bool deprecated = false; for ( auto const & attribute : attributes ) { if ( attribute.first == "api" ) { - api = tokenize( attribute.second, "," ); + api = attribute.second; } else if ( attribute.first == "deprecated" ) { @@ -16259,7 +16232,7 @@ void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, s line, "unknown formatting of type category define" ); name = trim( child->GetText() ); - if ( ( name == "VK_HEADER_VERSION" ) && ( api.empty() || ( std::ranges::find( api, m_api ) != api.end() ) ) ) + if ( ( name == "VK_HEADER_VERSION" ) && ( api.empty() || ( api == m_api ) ) ) { m_version = trimEnd( element->LastChild()->ToText()->Value() ); } @@ -16273,7 +16246,7 @@ void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, s } assert( !name.empty() ); - if ( api.empty() || ( std::ranges::find( api, m_api ) != api.end() ) ) + if ( api.empty() || ( api == m_api ) ) { MacroVisitor definesVisitor{}; element->Accept( &definesVisitor );