Add new extension inspection functions getExtensionObsoletedBy() and isExtensionObsoleted() (#1555)
This commit is contained in:
parent
bf8bee64e1
commit
a4841bc2f0
@ -136,9 +136,11 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
//======================================
|
//======================================
|
||||||
|
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
||||||
|
|
||||||
@ -152,6 +154,12 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
${deprecatedBy}
|
${deprecatedBy}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name )
|
||||||
|
{
|
||||||
|
${voidName}
|
||||||
|
${obsoletedBy}
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
||||||
{
|
{
|
||||||
${promotedTo}
|
${promotedTo}
|
||||||
@ -168,6 +176,12 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return ${deprecatedTest};
|
return ${deprecatedTest};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name )
|
||||||
|
{
|
||||||
|
${voidName}
|
||||||
|
return ${obsoletedTest};
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
||||||
{
|
{
|
||||||
return ${promotedTest};
|
return ${promotedTest};
|
||||||
@ -182,15 +196,24 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
#endif
|
#endif
|
||||||
)";
|
)";
|
||||||
|
|
||||||
std::string str = replaceWithMap( vulkanExtensionInspectionHppTemplate,
|
std::string str =
|
||||||
|
replaceWithMap( vulkanExtensionInspectionHppTemplate,
|
||||||
{ { "api", m_api },
|
{ { "api", m_api },
|
||||||
{ "deviceTest", generateExtensionTypeTest( "device" ) },
|
{ "deviceTest", generateExtensionTypeTest( "device" ) },
|
||||||
{ "deprecatedBy", generateExtensionDeprecatedBy() },
|
{ "deprecatedBy",
|
||||||
{ "deprecatedTest", generateExtensionDeprecatedTest() },
|
generateExtensionReplacedBy( []( ExtensionData const & extension ) { return extension.isDeprecated; },
|
||||||
|
[]( ExtensionData const & extension ) { return extension.deprecatedBy; } ) },
|
||||||
|
{ "deprecatedTest", generateExtensionReplacedTest( []( ExtensionData const & extension ) { return extension.isDeprecated; } ) },
|
||||||
{ "instanceTest", generateExtensionTypeTest( "instance" ) },
|
{ "instanceTest", generateExtensionTypeTest( "instance" ) },
|
||||||
{ "licenseHeader", m_vulkanLicenseHeader },
|
{ "licenseHeader", m_vulkanLicenseHeader },
|
||||||
{ "promotedTest", generateExtensionPromotedTest() },
|
{ "obsoletedBy",
|
||||||
{ "promotedTo", generateExtensionPromotedTo() },
|
generateExtensionReplacedBy( []( ExtensionData const & extension ) { return !extension.obsoletedBy.empty(); },
|
||||||
|
[]( ExtensionData const & extension ) { return extension.obsoletedBy; } ) },
|
||||||
|
{ "obsoletedTest", generateExtensionReplacedTest( []( ExtensionData const & extension ) { return !extension.obsoletedBy.empty(); } ) },
|
||||||
|
{ "promotedTest", generateExtensionReplacedTest( []( ExtensionData const & extension ) { return !extension.promotedTo.empty(); } ) },
|
||||||
|
{ "promotedTo",
|
||||||
|
generateExtensionReplacedBy( []( ExtensionData const & extension ) { return !extension.promotedTo.empty(); },
|
||||||
|
[]( ExtensionData const & extension ) { return extension.promotedTo; } ) },
|
||||||
{ "voidName", ( m_api == "vulkan" ) ? "" : "(void)name;" } } );
|
{ "voidName", ( m_api == "vulkan" ) ? "" : "(void)name;" } } );
|
||||||
|
|
||||||
writeToFile( str, vulkan_extension_inspection_hpp );
|
writeToFile( str, vulkan_extension_inspection_hpp );
|
||||||
@ -5587,99 +5610,59 @@ std::string VulkanHppGenerator::generateEnumValueName( std::string const & enumN
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateExtensionDeprecatedBy() const
|
template <class Predicate, class Extraction>
|
||||||
|
std::string VulkanHppGenerator::generateExtensionReplacedBy( Predicate p, Extraction e ) const
|
||||||
{
|
{
|
||||||
std::string deprecatedBy, previousEnter, previousLeave;
|
std::string replacedBy, previousEnter, previousLeave;
|
||||||
for ( auto const & extension : m_extensions )
|
for ( auto const & extension : m_extensions )
|
||||||
{
|
{
|
||||||
if ( extension.isDeprecated )
|
if ( p( extension ) )
|
||||||
{
|
{
|
||||||
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
||||||
deprecatedBy += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + " if ( name == \"" + extension.name + "\" ) { return \"" +
|
replacedBy += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + " if ( name == \"" + extension.name + "\" ) { return \"" +
|
||||||
extension.deprecatedBy + "\"; }";
|
e( extension ) + "\"; }";
|
||||||
previousEnter = enter;
|
previousEnter = enter;
|
||||||
previousLeave = leave;
|
previousLeave = leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !previousLeave.empty() )
|
if ( !previousLeave.empty() )
|
||||||
{
|
{
|
||||||
deprecatedBy += "\n" + previousLeave;
|
replacedBy += "\n" + previousLeave;
|
||||||
}
|
}
|
||||||
deprecatedBy += "\n return \"\";";
|
replacedBy += "\n return \"\";";
|
||||||
return deprecatedBy;
|
return replacedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateExtensionDeprecatedTest() const
|
template <class Predicate>
|
||||||
|
std::string VulkanHppGenerator::generateExtensionReplacedTest( Predicate p ) const
|
||||||
{
|
{
|
||||||
std::string deprecatedTest, previousEnter, previousLeave;
|
std::string replacedTest, previousEnter, previousLeave;
|
||||||
|
bool unprotectedEntry = false;
|
||||||
for ( auto const & extension : m_extensions )
|
for ( auto const & extension : m_extensions )
|
||||||
{
|
{
|
||||||
if ( extension.isDeprecated )
|
if ( p( extension ) )
|
||||||
{
|
{
|
||||||
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
||||||
deprecatedTest += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + "( name == \"" + extension.name + "\" ) || ";
|
unprotectedEntry |= enter.empty();
|
||||||
|
replacedTest += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + "( name == \"" + extension.name + "\" ) || ";
|
||||||
previousEnter = enter;
|
previousEnter = enter;
|
||||||
previousLeave = leave;
|
previousLeave = leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( m_api == "vulkan" )
|
if ( unprotectedEntry )
|
||||||
{
|
{
|
||||||
assert( deprecatedTest.ends_with( " || " ) );
|
assert( replacedTest.ends_with( " || " ) );
|
||||||
deprecatedTest = deprecatedTest.substr( 0, deprecatedTest.length() - 4 );
|
replacedTest = replacedTest.substr( 0, replacedTest.length() - 4 );
|
||||||
}
|
}
|
||||||
if ( !previousLeave.empty() )
|
if ( !previousLeave.empty() )
|
||||||
{
|
{
|
||||||
deprecatedTest += "\n" + previousLeave;
|
replacedTest += "\n" + previousLeave;
|
||||||
}
|
}
|
||||||
if ( m_api != "vulkan" )
|
if ( !unprotectedEntry )
|
||||||
{
|
{
|
||||||
deprecatedTest += "false"; // there might be no deprecations at all, so add a "false" at the end...
|
replacedTest += "false"; // there might be no replacements at all, so add a "false" at the end...
|
||||||
}
|
}
|
||||||
return deprecatedTest;
|
return replacedTest;
|
||||||
}
|
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateExtensionPromotedTest() const
|
|
||||||
{
|
|
||||||
std::string promotedTest, previousEnter, previousLeave;
|
|
||||||
for ( auto const & extension : m_extensions )
|
|
||||||
{
|
|
||||||
if ( !extension.promotedTo.empty() )
|
|
||||||
{
|
|
||||||
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
|
||||||
promotedTest += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + "( name == \"" + extension.name + "\" ) || ";
|
|
||||||
previousEnter = enter;
|
|
||||||
previousLeave = leave;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert( promotedTest.ends_with( " || " ) );
|
|
||||||
promotedTest = promotedTest.substr( 0, promotedTest.length() - 4 );
|
|
||||||
if ( !previousLeave.empty() )
|
|
||||||
{
|
|
||||||
promotedTest += "\n" + previousLeave;
|
|
||||||
}
|
|
||||||
return promotedTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateExtensionPromotedTo() const
|
|
||||||
{
|
|
||||||
std::string promotedTo, previousEnter, previousLeave;
|
|
||||||
for ( auto const & extension : m_extensions )
|
|
||||||
{
|
|
||||||
if ( !extension.promotedTo.empty() )
|
|
||||||
{
|
|
||||||
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
|
|
||||||
promotedTo += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + " if ( name == \"" + extension.name + "\" ) { return \"" +
|
|
||||||
extension.promotedTo + "\"; }";
|
|
||||||
previousEnter = enter;
|
|
||||||
previousLeave = leave;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !previousLeave.empty() )
|
|
||||||
{
|
|
||||||
promotedTo += "\n" + previousLeave;
|
|
||||||
}
|
|
||||||
promotedTo += "\n return \"\";";
|
|
||||||
return promotedTo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateExtensionTypeTest( std::string const & type ) const
|
std::string VulkanHppGenerator::generateExtensionTypeTest( std::string const & type ) const
|
||||||
|
@ -693,10 +693,10 @@ private:
|
|||||||
std::string generateEnumToString( std::pair<std::string, EnumData> const & enumData ) const;
|
std::string generateEnumToString( std::pair<std::string, EnumData> const & enumData ) const;
|
||||||
std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask ) const;
|
std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask ) const;
|
||||||
std::string generateEnumValueName( std::string const & enumName, std::string const & valueName, bool bitmask ) const;
|
std::string generateEnumValueName( std::string const & enumName, std::string const & valueName, bool bitmask ) const;
|
||||||
std::string generateExtensionDeprecatedBy() const;
|
template <class Predicate, class Extraction>
|
||||||
std::string generateExtensionDeprecatedTest() const;
|
std::string generateExtensionReplacedBy( Predicate p, Extraction e ) const;
|
||||||
std::string generateExtensionPromotedTest() const;
|
template <class Predicate>
|
||||||
std::string generateExtensionPromotedTo() const;
|
std::string generateExtensionReplacedTest( Predicate p ) const;
|
||||||
std::string generateExtensionTypeTest( std::string const & type ) const;
|
std::string generateExtensionTypeTest( std::string const & type ) const;
|
||||||
std::string generateFailureCheck( std::vector<std::string> const & successCodes ) const;
|
std::string generateFailureCheck( std::vector<std::string> const & successCodes ) const;
|
||||||
std::string generateFormatTraits() const;
|
std::string generateFormatTraits() const;
|
||||||
|
@ -17,9 +17,11 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
//======================================
|
//======================================
|
||||||
|
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
||||||
|
|
||||||
@ -98,6 +100,15 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name )
|
||||||
|
{
|
||||||
|
if ( name == "VK_AMD_negative_viewport_height" )
|
||||||
|
{
|
||||||
|
return "VK_KHR_maintenance1";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
||||||
{
|
{
|
||||||
if ( name == "VK_KHR_sampler_mirror_clamp_to_edge" )
|
if ( name == "VK_KHR_sampler_mirror_clamp_to_edge" )
|
||||||
@ -581,6 +592,11 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
( name == "VK_AMD_gpu_shader_int16" ) || ( name == "VK_EXT_buffer_device_address" );
|
( name == "VK_AMD_gpu_shader_int16" ) || ( name == "VK_EXT_buffer_device_address" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name )
|
||||||
|
{
|
||||||
|
return ( name == "VK_AMD_negative_viewport_height" );
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
||||||
{
|
{
|
||||||
return ( name == "VK_KHR_sampler_mirror_clamp_to_edge" ) || ( name == "VK_EXT_debug_marker" ) || ( name == "VK_AMD_draw_indirect_count" ) ||
|
return ( name == "VK_KHR_sampler_mirror_clamp_to_edge" ) || ( name == "VK_EXT_debug_marker" ) || ( name == "VK_AMD_draw_indirect_count" ) ||
|
||||||
|
@ -17,9 +17,11 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
//======================================
|
//======================================
|
||||||
|
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionDeprecatedBy( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isDeviceExtension( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionDeprecated( std::string const & name );
|
||||||
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name );
|
||||||
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & name );
|
||||||
|
|
||||||
@ -41,6 +43,13 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionObsoletedBy( std::string const & name )
|
||||||
|
{
|
||||||
|
(void)name;
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string getExtensionPromotedTo( std::string const & name )
|
||||||
{
|
{
|
||||||
if ( name == "VK_EXT_texture_compression_astc_hdr" )
|
if ( name == "VK_EXT_texture_compression_astc_hdr" )
|
||||||
@ -139,6 +148,12 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
false;
|
false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionObsoleted( std::string const & name )
|
||||||
|
{
|
||||||
|
(void)name;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isExtensionPromoted( std::string const & name )
|
||||||
{
|
{
|
||||||
return ( name == "VK_EXT_texture_compression_astc_hdr" ) || ( name == "VK_EXT_global_priority" ) || ( name == "VK_KHR_shader_terminate_invocation" ) ||
|
return ( name == "VK_EXT_texture_compression_astc_hdr" ) || ( name == "VK_EXT_global_priority" ) || ( name == "VK_KHR_shader_terminate_invocation" ) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user