From 20cb37e39f91426b735673020dbaf2a45a1b0e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Mon, 17 Apr 2023 13:51:24 +0200 Subject: [PATCH] Add support of new extension attribute "ratified". (#1563) --- VulkanHppGenerator.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 7d740b0..c9b62f1 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -5722,14 +5722,15 @@ std::string VulkanHppGenerator::generateExtensionDependencies() const std::string VulkanHppGenerator::generateExtensionDependsByVersion( bool definition ) const { - if (m_api != "vulkan") + if ( m_api != "vulkan" ) { return ""; } if ( definition ) { - const std::string generateExtensionDependsTemplate = R"( VULKAN_HPP_INLINE std::pair const &> getExtensionDepends( std::string const & version, std::string const & extension ) + const std::string generateExtensionDependsTemplate = + R"( VULKAN_HPP_INLINE std::pair const &> getExtensionDepends( std::string const & version, std::string const & extension ) { #if !defined( NDEBUG ) static std::set versions = { ${versions} }; @@ -5759,7 +5760,7 @@ std::string VulkanHppGenerator::generateExtensionDependsByVersion( bool definiti )"; std::string versions; - for (auto const& feature : m_features) + for ( auto const & feature : m_features ) { versions += "\"" + feature.name + "\", "; } @@ -11810,13 +11811,14 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element ) { "platform", {} }, { "promotedto", {} }, { "provisional", { "true" } }, + { "ratified", { "vulkan", "vulkansc" } }, { "sortorder", { "1" } }, { "specialuse", { "cadsupport", "d3demulation", "debugging", "devtools", "glemulation" } }, { "type", { "device", "instance" } } } ); checkElements( line, children, { { "require", false } } ); ExtensionData extensionData{ .xmlLine = line }; - std::vector supported; + std::vector ratified, supported; for ( auto const & attribute : attributes ) { if ( attribute.first == "depends" ) @@ -11900,6 +11902,10 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element ) "while attribute is set to \"true\", attribute is not set to \"provisional\" but to \"" + extensionData.platform + "\"" ); } + else if ( attribute.first == "ratified" ) + { + ratified = tokenize( attribute.second, "," ); + } else if ( attribute.first == "supported" ) { supported = tokenize( attribute.second, "," ); @@ -11910,6 +11916,10 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element ) } } + checkForWarning( ( std::find( supported.begin(), supported.end(), "disabled" ) != supported.end() ) || extensionData.isDeprecated || ratified.empty() || + ( supported == ratified ), + line, + "attribute \"ratified\" differs from attribute \"supported\"" ); bool extensionSupported = supported.empty() || ( std::find( supported.begin(), supported.end(), m_api ) != supported.end() ); checkForError( !extensionSupported || !extensionData.type.empty(), line, "missing attribute \"type\" for supported extension <" + extensionData.name + ">" ); for ( auto child : children )