Skip to content

Commit

Permalink
Remove deprecation message on promoted extensions. (#1938)
Browse files Browse the repository at this point in the history
  • Loading branch information
asuessenbach authored Aug 7, 2024
1 parent 6a11b18 commit fde7e0f
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 311 deletions.
24 changes: 6 additions & 18 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5209,14 +5209,12 @@ std::string VulkanHppGenerator::generateConstexprDefines() const

auto extensionConstexprs = std::string{};

static auto const extensionTemplate = std::string{ R"(${deprecated}VULKAN_HPP_CONSTEXPR_INLINE auto ${var} = ${macro};
static auto const extensionTemplate = std::string{ R"(${deprecated}VULKAN_HPP_CONSTEXPR_INLINE auto ${var} = ${macro};
)" };
static auto const deprecatedPrefixTemplate = std::string{ R"(VULKAN_HPP_DEPRECATED( ${message} ) )" };
static auto const deprecatedByMessageTemplate = std::string{ R"("The ${extensionName} extension has been deprecated by ${deprecatedBy}.")" };
static auto const deprecatedMessageTemplate = std::string{ R"("The ${extensionName} extension has been deprecated.")" };
static auto const obsoletedMessageTemplate = std::string{ R"("The ${extensionName} extension has been obsoleted by ${obsoletedBy}.")" };
static auto const promotedVersionMessageTemplate = std::string{ R"("The ${extensionName} extension has been promoted to core in version ${promotedTo}." )" };
static auto const promotedExtensionMessageTemplate = std::string{ R"("The ${extensionName} extension has been promoted to ${promotedTo}.")" };
static auto const deprecatedPrefixTemplate = std::string{ R"(VULKAN_HPP_DEPRECATED( ${message} ) )" };
static auto const deprecatedByMessageTemplate = std::string{ R"("The ${extensionName} extension has been deprecated by ${deprecatedBy}.")" };
static auto const deprecatedMessageTemplate = std::string{ R"("The ${extensionName} extension has been deprecated.")" };
static auto const obsoletedMessageTemplate = std::string{ R"("The ${extensionName} extension has been obsoleted by ${obsoletedBy}.")" };

// I really, really wish C++ had discards for structured bindings...
for ( auto const & extension : m_extensions )
Expand Down Expand Up @@ -5265,17 +5263,7 @@ std::string VulkanHppGenerator::generateConstexprDefines() const
}
else if ( !extension.promotedTo.empty() )
{
if ( extension.promotedTo.starts_with( "VK_VERSION_" ) )
{
auto version = stripPrefix( extension.promotedTo, "VK_VERSION_" );
std::replace( version.begin(), version.end(), '_', '.' );
deprecationMessage = replaceWithMap( promotedVersionMessageTemplate, { { "extensionName", extension.name }, { "promotedTo", version } } );
}
else
{
deprecationMessage =
replaceWithMap( promotedExtensionMessageTemplate, { { "extensionName", extension.name }, { "promotedTo", extension.promotedTo } } );
}
// promoted extensions are _not_ deprecated!
}
auto const deprecatedPrefix = deprecationMessage.empty() ? "" : replaceWithMap( deprecatedPrefixTemplate, { { "message", deprecationMessage } } );

Expand Down
Loading

0 comments on commit fde7e0f

Please sign in to comment.