mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2025-08-03 11:27:25 -04:00
Mark deprecated struct members as deprecated. (#2230)
This commit is contained in:
parent
cc01933661
commit
d16c62670b
@ -1533,6 +1533,11 @@ bool VulkanHppGenerator::containsArray( std::string const & type ) const
|
||||
return found;
|
||||
}
|
||||
|
||||
bool VulkanHppGenerator::containsDeprecated( std::vector<MemberData> const & members ) const
|
||||
{
|
||||
return std::ranges::any_of( members, []( auto const & member ) { return !member.deprecated.empty(); } );
|
||||
}
|
||||
|
||||
bool VulkanHppGenerator::containsFuncPointer( std::string const & type ) const
|
||||
{
|
||||
// a simple recursive check if a type contains a funcpointer
|
||||
@ -5026,11 +5031,17 @@ std::string VulkanHppGenerator::generateCommandVoid2Return( std::string const &
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateConstexprString( std::string const & structName ) const
|
||||
std::string VulkanHppGenerator::generateConstexprString( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
// structs with a VkBaseInStructure and VkBaseOutStructure can't be a constexpr!
|
||||
const bool isConstExpression = ( structName != "VkBaseInStructure" ) && ( structName != "VkBaseOutStructure" );
|
||||
return isConstExpression ? ( std::string( "VULKAN_HPP_CONSTEXPR" ) + ( ( containsUnion( structName ) || containsArray( structName ) ) ? "_14 " : " " ) ) : "";
|
||||
const bool isConstExpression = ( structData.first != "VkBaseInStructure" ) && ( structData.first != "VkBaseOutStructure" );
|
||||
return isConstExpression
|
||||
? ( std::string( "VULKAN_HPP_CONSTEXPR" ) +
|
||||
( containsDeprecated( structData.second.members )
|
||||
? "_17 "
|
||||
: ( ( containsUnion( structData.first ) || containsArray( structData.first ) || containsDeprecated( structData.second.members ) ) ? "_14 "
|
||||
: " " ) ) )
|
||||
: "";
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateConstexprDefines() const
|
||||
@ -11258,6 +11269,42 @@ std::string VulkanHppGenerator::generateStruct( std::pair<std::string, Structure
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructCastAssignments( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
std::string castAssignments;
|
||||
if ( containsDeprecated( structData.second.members ) )
|
||||
{
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
if ( member.deprecated.empty() && ( member.type.type != "VkStructureType" ) )
|
||||
{
|
||||
if ( member.type.type.starts_with( "Vk" ) )
|
||||
{
|
||||
if ( member.type.isValue() )
|
||||
{
|
||||
castAssignments += member.name + " = static_cast<" + stripPrefix( member.type.type, "Vk" ) + ">( rhs." + member.name + " );\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
castAssignments += member.name + " = reinterpret_cast<" + member.type.compose( "Vk" ) + ">( rhs." + member.name + " );\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
castAssignments += member.name + " = rhs." + member.name + ";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
castAssignments = "*this = *reinterpret_cast<" + stripPrefix( structData.first, "Vk" ) + " const *>( &rhs );\n";
|
||||
}
|
||||
assert( castAssignments.ends_with( "\n" ) );
|
||||
castAssignments.pop_back();
|
||||
return castAssignments;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
static const std::set<std::string> simpleTypes = { "char", "double", "DWORD", "float", "HANDLE", "HINSTANCE", "HMONITOR",
|
||||
@ -11271,6 +11318,8 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
|
||||
for ( size_t i = 0; i < structData.second.members.size(); i++ )
|
||||
{
|
||||
MemberData const & member = structData.second.members[i];
|
||||
if ( member.deprecated.empty() )
|
||||
{
|
||||
auto typeIt = m_types.find( member.type.type );
|
||||
assert( typeIt != m_types.end() );
|
||||
if ( ( typeIt->second.category == TypeCategory::ExternalType ) && member.type.postfix.empty() && !simpleTypes.contains( member.type.type ) )
|
||||
@ -11296,7 +11345,8 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
|
||||
assert( member.lenExpressions[0] == "null-terminated" );
|
||||
if ( member.arraySizes.empty() )
|
||||
{
|
||||
compareMembers += intro + "( ( " + member.name + " == rhs." + member.name + " ) || ( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 ) )";
|
||||
compareMembers +=
|
||||
intro + "( ( " + member.name + " == rhs." + member.name + " ) || ( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 ) )";
|
||||
|
||||
static const std::string spaceshipMemberTemplate =
|
||||
R"( if ( ${name} != rhs.${name} )
|
||||
@ -11363,6 +11413,7 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
|
||||
}
|
||||
intro = "\n && ";
|
||||
}
|
||||
}
|
||||
|
||||
std::string structName = stripPrefix( structData.first, "Vk" );
|
||||
|
||||
@ -11433,18 +11484,22 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
|
||||
{
|
||||
// the constructor with all the elements as arguments, with defaults
|
||||
// and the simple copy constructor from the corresponding vulkan structure
|
||||
static const std::string constructors = R"(${constexpr}${structName}(${arguments}) VULKAN_HPP_NOEXCEPT
|
||||
static const std::string constructors = R"(${pushIgnored}${constexpr}${structName}(${arguments}) VULKAN_HPP_NOEXCEPT
|
||||
${initializers}
|
||||
{}
|
||||
{${ignores}}
|
||||
|
||||
${constexpr}${structName}( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
${copyConstructor}
|
||||
|
||||
${structName}( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
: ${structName}( *reinterpret_cast<${structName} const *>( &rhs ) )
|
||||
{}
|
||||
|
||||
${enhancedConstructors}
|
||||
${popIgnored}
|
||||
)";
|
||||
|
||||
std::vector<std::string> arguments, initializers;
|
||||
std::string ignores;
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
// gather the arguments
|
||||
@ -11454,12 +11509,48 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
|
||||
arguments.push_back( argument );
|
||||
}
|
||||
|
||||
if ( member.deprecated.empty() )
|
||||
{
|
||||
// gather the initializers; skip members with exactly one legal value
|
||||
if ( member.value.empty() )
|
||||
{
|
||||
initializers.push_back( member.name + "{ " + member.name + "_ }" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ignores += "detail::ignore( " + member.name + "_ );\n";
|
||||
}
|
||||
}
|
||||
|
||||
std::string pushIgnored, popIgnored;
|
||||
if ( !ignores.empty() )
|
||||
{
|
||||
pushIgnored = R"(
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore this warning with MSVC
|
||||
#elif defined( __clang__ )
|
||||
// no need to ignore this warning with clang
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#else
|
||||
// unknown compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
)";
|
||||
popIgnored = R"(
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore this warning with MSVC
|
||||
#elif defined( __clang__ )
|
||||
// no need to ignore this warning with clang
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic pop
|
||||
#else
|
||||
// unknown compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
)";
|
||||
}
|
||||
|
||||
auto pNextIt = std::ranges::find_if( structData.second.members, []( MemberData const & md ) { return md.name == "pNext"; } );
|
||||
if ( pNextIt != structData.second.members.end() )
|
||||
{
|
||||
@ -11469,14 +11560,15 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
|
||||
|
||||
std::string str = replaceWithMap( constructors,
|
||||
{ { "arguments", generateList( arguments, "", ", " ) },
|
||||
{ "constexpr", generateConstexprString( structData.first ) },
|
||||
{ "constexpr", generateConstexprString( structData ) },
|
||||
{ "copyConstructor", generateStructCopyConstructor( structData ) },
|
||||
{ "enhancedConstructors", structData.second.returnedOnly ? "" : generateStructConstructorsEnhanced( structData ) },
|
||||
{ "popIgnored", popIgnored },
|
||||
{ "pushIgnored", pushIgnored },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) },
|
||||
{ "ignores", ignores },
|
||||
{ "initializers", generateList( initializers, ": ", ", " ) },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
|
||||
if ( !structData.second.returnedOnly )
|
||||
{
|
||||
str += generateStructConstructorsEnhanced( structData );
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -11542,7 +11634,7 @@ ${byString}
|
||||
|
||||
std::vector<std::string> arguments, initializers;
|
||||
bool arrayListed = false;
|
||||
std::string templateHeader, sizeChecks, copyOps;
|
||||
std::string ignores, templateHeader, sizeChecks, copyOps;
|
||||
for ( auto mit = structData.second.members.begin(); mit != structData.second.members.end(); ++mit )
|
||||
{
|
||||
// gather the initializers
|
||||
@ -11554,11 +11646,14 @@ ${byString}
|
||||
{
|
||||
auto litit = lenIts.find( mit );
|
||||
if ( litit != lenIts.end() )
|
||||
{
|
||||
if ( mit->deprecated.empty() )
|
||||
{
|
||||
// len arguments just have an initalizer, from the array size
|
||||
initializers.push_back( mit->name + "( " + generateLenInitializer( mit, litit, structData.second.mutualExclusiveLens ) + " )" );
|
||||
sizeChecks += generateSizeCheck( litit->second, stripPrefix( structData.first, "Vk" ), structData.second.mutualExclusiveLens );
|
||||
}
|
||||
}
|
||||
else if ( hasLen( *mit, structData.second.members ) )
|
||||
{
|
||||
assert( mit->type.isPointer() || !mit->arraySizes.empty() );
|
||||
@ -11601,12 +11696,19 @@ ${byString}
|
||||
arrayListed = true;
|
||||
|
||||
if ( mit->type.isPointer() )
|
||||
{
|
||||
if ( mit->deprecated.empty() )
|
||||
{
|
||||
initializers.push_back( mit->name + "( " + argumentName + ".data() )" );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( mit->arraySizes.size() == 1 );
|
||||
ignores += "detail::ignore( " + argumentName + " );\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( mit->deprecated.empty() && ( mit->arraySizes.size() == 1 ) );
|
||||
if ( mit->lenExpressions[0] == "null-terminated" )
|
||||
{
|
||||
static const std::string strcpyTemplate = R"(
|
||||
@ -11640,6 +11742,7 @@ ${byString}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( mit->deprecated.empty() );
|
||||
std::string argument = generateStructConstructorArgument( *mit, arrayListed );
|
||||
if ( !argument.empty() )
|
||||
{
|
||||
@ -11661,13 +11764,18 @@ ${byString}
|
||||
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
${templateHeader} ${structName}( ${arguments} )
|
||||
${initializers}
|
||||
{${sizeChecks}${copyOps}}
|
||||
{
|
||||
${ignores}
|
||||
${sizeChecks}
|
||||
${copyOps}
|
||||
}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
)";
|
||||
|
||||
return replaceWithMap( constructorTemplate,
|
||||
{ { "arguments", generateList( arguments, "", ", " ) },
|
||||
{ "copyOps", copyOps },
|
||||
{ "ignores", ignores },
|
||||
{ "initializers", generateList( initializers, ": ", ", " ) },
|
||||
{ "sizeChecks", sizeChecks },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) },
|
||||
@ -11720,6 +11828,77 @@ std::string VulkanHppGenerator::generateStructConstructorArgument( MemberData co
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructCopyAssignment( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
std::string copyAssignment;
|
||||
if ( containsDeprecated( structData.second.members ) )
|
||||
{
|
||||
static const std::string copyAssignmentTemplate = R"(${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
${initializers}
|
||||
}
|
||||
return *this;
|
||||
})";
|
||||
|
||||
std::vector<std::string> initializers;
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
if ( member.deprecated.empty() && ( member.type.type != "VkStructureType" ) )
|
||||
{
|
||||
initializers.push_back( member.name + " = rhs." + member.name + ";" );
|
||||
}
|
||||
}
|
||||
copyAssignment = replaceWithMap( copyAssignmentTemplate,
|
||||
{ { "initializers", generateList( initializers, "", "\n" ) }, { "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
static const std::string copyAssignmentTemplate = R"(
|
||||
${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;)";
|
||||
|
||||
copyAssignment = replaceWithMap( copyAssignmentTemplate, { { "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
}
|
||||
return copyAssignment;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructCopyConstructor( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
std::string copyConstructor;
|
||||
if ( containsDeprecated( structData.second.members ) )
|
||||
{
|
||||
static const std::string copyConstructorTemplate = R"(${constexpr}${structName}( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
${initializers}
|
||||
{})";
|
||||
|
||||
std::vector<std::string> initializers;
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
if ( member.deprecated.empty() && ( member.type.type != "VkStructureType" ) )
|
||||
{
|
||||
initializers.push_back( member.name + "{ rhs." + member.name + " }" );
|
||||
}
|
||||
}
|
||||
|
||||
copyConstructor = replaceWithMap( copyConstructorTemplate,
|
||||
{ { "constexpr", generateConstexprString( structData ) },
|
||||
{ "initializers", generateList( initializers, ": ", ", " ) },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
static const std::string copyConstructorTemplate = R"(
|
||||
${constexpr}${structName}( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
)";
|
||||
|
||||
copyConstructor = replaceWithMap( copyConstructorTemplate,
|
||||
{ { "constexpr", generateConstexprString( structData ) }, { "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
}
|
||||
|
||||
return copyConstructor;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructHashStructure( std::pair<std::string, StructureData> const & structure,
|
||||
std::set<std::string> & listedStructs ) const
|
||||
{
|
||||
@ -11799,6 +11978,8 @@ std::string VulkanHppGenerator::generateStructHashSum( std::string const & struc
|
||||
{
|
||||
std::string hashSum;
|
||||
for ( auto const & member : members )
|
||||
{
|
||||
if ( member.deprecated.empty() )
|
||||
{
|
||||
if ( !member.arraySizes.empty() )
|
||||
{
|
||||
@ -11846,6 +12027,7 @@ std::string VulkanHppGenerator::generateStructHashSum( std::string const & struc
|
||||
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + " );\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
assert( !hashSum.empty() );
|
||||
return hashSum.substr( 0, hashSum.size() - 1 );
|
||||
}
|
||||
@ -11961,18 +12143,20 @@ std::string VulkanHppGenerator::generateStructure( std::pair<std::string, Struct
|
||||
${constructors}
|
||||
${subConstructors}
|
||||
${deprecatedConstructors}
|
||||
${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
${copyAssignment}
|
||||
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
|
||||
|
||||
${structName} & operator=( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
*this = *reinterpret_cast<${structName} const *>( &rhs );
|
||||
${castAssignments}
|
||||
return *this;
|
||||
}
|
||||
)";
|
||||
|
||||
constructorsAndSetters = replaceWithMap( constructorsTemplate,
|
||||
{ { "constructors", generateStructConstructors( structure ) },
|
||||
{ { "castAssignments", generateStructCastAssignments( structure ) },
|
||||
{ "constructors", generateStructConstructors( structure ) },
|
||||
{ "copyAssignment", generateStructCopyAssignment( structure ) },
|
||||
{ "deprecatedConstructors", generateDeprecatedConstructors( structure.first ) },
|
||||
{ "structName", stripPrefix( structure.first, "Vk" ) },
|
||||
{ "subConstructors", generateStructSubConstructor( structure ) } } );
|
||||
@ -12215,6 +12399,13 @@ std::tuple<std::string, std::string, std::string, std::string>
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
members += " ";
|
||||
|
||||
if ( !member.deprecated.empty() )
|
||||
{
|
||||
assert( member.deprecated == "ignored" );
|
||||
members += "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) ";
|
||||
}
|
||||
|
||||
std::string type;
|
||||
if ( !member.bitCount.empty() && member.type.type.starts_with( "Vk" ) )
|
||||
{
|
||||
@ -12236,7 +12427,7 @@ std::tuple<std::string, std::string, std::string, std::string>
|
||||
type = generateStandardArrayWrapper( member.type.compose( "Vk" ), member.arraySizes );
|
||||
}
|
||||
members += type + " " + member.name;
|
||||
if ( !member.value.empty() )
|
||||
if ( member.deprecated.empty() && !member.value.empty() )
|
||||
{
|
||||
// special handling for members with legal value: use it as the default
|
||||
members += " = ";
|
||||
@ -12263,10 +12454,11 @@ std::tuple<std::string, std::string, std::string, std::string>
|
||||
assert( member.arraySizes.empty() || member.bitCount.empty() );
|
||||
if ( !member.bitCount.empty() )
|
||||
{
|
||||
assert( member.deprecated.empty() );
|
||||
members += " : " + member.bitCount; // except for bitfield members, where no default member initializatin
|
||||
// is supported (up to C++20)
|
||||
}
|
||||
else
|
||||
else if ( member.deprecated.empty() )
|
||||
{
|
||||
members += " = ";
|
||||
auto enumIt = m_enums.find( member.type.type );
|
||||
@ -12301,7 +12493,7 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
if ( member.type.type != "VkStructureType" ) // filter out StructureType, which is supposed to be immutable !
|
||||
{
|
||||
static const std::string templateString = R"(
|
||||
${constexpr}${structureName} & set${MemberName}( ${memberType} ${reference}${memberName}_ ) VULKAN_HPP_NOEXCEPT
|
||||
${deprecated}${constexpr}${structureName} & set${MemberName}( ${memberType} ${reference}${memberName}_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
${assignment};
|
||||
return *this;
|
||||
@ -12314,6 +12506,8 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
: ( member.arraySizes.empty() ? member.type.compose( "Vk" ) : generateStandardArray( member.type.compose( "Vk" ), member.arraySizes ) );
|
||||
const bool isReinterpretation = !member.bitCount.empty() && member.type.type.starts_with( "Vk" );
|
||||
std::string assignment;
|
||||
if ( member.deprecated.empty() )
|
||||
{
|
||||
if ( isReinterpretation )
|
||||
{
|
||||
assignment = member.name + " = " + "*reinterpret_cast<" + member.type.type + "*>(&" + member.name + "_)";
|
||||
@ -12322,10 +12516,16 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
{
|
||||
assignment = member.name + " = " + member.name + "_";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assignment = "detail::ignore( " + member.name + "_ )";
|
||||
}
|
||||
|
||||
str += replaceWithMap( templateString,
|
||||
{ { "assignment", assignment },
|
||||
{ "constexpr", isReinterpretation ? "" : "VULKAN_HPP_CONSTEXPR_14 " },
|
||||
{ "deprecated", member.deprecated.empty() ? "" : "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) " },
|
||||
{ "memberName", member.name },
|
||||
{ "MemberName", startUpperCase( member.name ) },
|
||||
{ "memberType", memberType },
|
||||
@ -12339,7 +12539,8 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
|
||||
if ( member.lenExpressions[0] == "null-terminated" )
|
||||
{
|
||||
assert( member.lenMembers.empty() && ( member.lenExpressions.size() == 1 ) && ( member.arraySizes.size() == 1 ) && ( member.type.type == "char" ) );
|
||||
assert( member.deprecated.empty() && member.lenMembers.empty() && ( member.lenExpressions.size() == 1 ) && ( member.arraySizes.size() == 1 ) &&
|
||||
( member.type.type == "char" ) );
|
||||
|
||||
static const std::string setStringTemplate = R"(
|
||||
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
@ -12365,7 +12566,7 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
else if ( ( structureName == "LayerSettingEXT" ) && ( index == 4 ) )
|
||||
{
|
||||
// VkLayerSettingEXT::pValues needs some special handling!
|
||||
assert( member.name == "pValues" );
|
||||
assert( member.deprecated.empty() && ( member.name == "pValues" ) );
|
||||
static const std::string byTypeTemplate =
|
||||
R"( LayerSettingEXT & setValues( ArrayProxyNoTemporaries<const ${type}> const & values_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
@ -12446,12 +12647,25 @@ ${byString}
|
||||
|
||||
if ( member.type.isPointer() )
|
||||
{
|
||||
std::string functionBody;
|
||||
if ( member.deprecated.empty() )
|
||||
{
|
||||
static const std::string functionBodyTemplate = R"( ${lenName} = ${lenValue};
|
||||
${memberName} = ${arrayName}_.data();)";
|
||||
|
||||
functionBody = replaceWithMap( functionBodyTemplate,
|
||||
{ { "arrayName", arrayName }, { "lenName", lenName }, { "lenValue", lenValue }, { "memberName", member.name } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
functionBody = "detail::ignore( " + arrayName + "_ );";
|
||||
}
|
||||
|
||||
static const std::string setArrayTemplate = R"(
|
||||
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
${templateHeader}${structureName} & set${ArrayName}( ArrayProxyNoTemporaries<${memberType}> const & ${arrayName}_ ) VULKAN_HPP_NOEXCEPT
|
||||
${deprecated}${templateHeader}${structureName} & set${ArrayName}( ArrayProxyNoTemporaries<${memberType}> const & ${arrayName}_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
${lenName} = ${lenValue};
|
||||
${memberName} = ${arrayName}_.data();
|
||||
${functionBody}
|
||||
return *this;
|
||||
}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
@ -12460,9 +12674,8 @@ ${byString}
|
||||
str += replaceWithMap( setArrayTemplate,
|
||||
{ { "arrayName", arrayName },
|
||||
{ "ArrayName", startUpperCase( arrayName ) },
|
||||
{ "lenName", lenName },
|
||||
{ "lenValue", lenValue },
|
||||
{ "memberName", member.name },
|
||||
{ "deprecated", member.deprecated.empty() ? "" : "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) " },
|
||||
{ "functionBody", functionBody },
|
||||
{ "memberType", memberType },
|
||||
{ "structureName", structureName },
|
||||
{ "templateHeader", templateHeader } } );
|
||||
@ -15723,10 +15936,9 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
|
||||
"member attribute <altlen> holds unknown number of data: " + std::to_string( memberData.lenExpressions.size() ) );
|
||||
memberData.lenMembers = filterNumbers( tokenizeAny( attribute.second, " /()+*" ) );
|
||||
}
|
||||
else if ( attribute.second == "deprecated" )
|
||||
else if ( attribute.first == "deprecated" )
|
||||
{
|
||||
assert( false );
|
||||
// the struct member is marked as deprecated/ignored, but still exisits -> no modifications needed here
|
||||
memberData.deprecated = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "len" )
|
||||
{
|
||||
|
@ -400,6 +400,7 @@ private:
|
||||
std::string name = {};
|
||||
std::vector<std::string> arraySizes = {};
|
||||
std::string bitCount = {};
|
||||
std::string deprecated = {};
|
||||
std::vector<std::string> lenExpressions = {};
|
||||
std::vector<std::pair<std::string, size_t>> lenMembers = {};
|
||||
bool noAutoValidity = {};
|
||||
@ -571,6 +572,7 @@ private:
|
||||
bool raii ) const;
|
||||
bool contains( std::vector<EnumValueData> const & enumValues, std::string const & name ) const;
|
||||
bool containsArray( std::string const & type ) const;
|
||||
bool containsDeprecated( std::vector<MemberData> const & members ) const;
|
||||
bool containsFuncPointer( std::string const & type ) const;
|
||||
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
||||
bool containsUnion( std::string const & type ) const;
|
||||
@ -780,7 +782,7 @@ private:
|
||||
bool definition,
|
||||
std::vector<size_t> const & returnParamIndices,
|
||||
bool raii ) const;
|
||||
std::string generateConstexprString( std::string const & structName ) const;
|
||||
std::string generateConstexprString( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateConstexprDefines() const;
|
||||
std::string generateConstexprUsings() const;
|
||||
std::string generateCppModuleFuncpointerUsings() const;
|
||||
@ -1037,10 +1039,13 @@ private:
|
||||
std::string generateStaticAssertions() const;
|
||||
std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStruct( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructCastAssignments( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structure ) const;
|
||||
std::string generateStructConstructors( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructConstructorArgument( MemberData const & memberData, bool withDefault ) const;
|
||||
std::string generateStructCopyAssignment( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructCopyConstructor( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructHashStructures() const;
|
||||
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
|
||||
|
@ -141,8 +141,9 @@
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
void ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )
|
||||
|
@ -141,6 +141,11 @@ ${vulkan_64_bit_ptr_defines}
|
||||
# else
|
||||
# define VULKAN_HPP_CONSTEXPR_14
|
||||
# endif
|
||||
# if 201603 <= __cpp_constexpr
|
||||
# define VULKAN_HPP_CONSTEXPR_17 constexpr
|
||||
# else
|
||||
# define VULKAN_HPP_CONSTEXPR_17
|
||||
# endif
|
||||
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
|
||||
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
||||
# else
|
||||
|
@ -472,7 +472,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
|
||||
int>::type = 0>
|
||||
ArrayProxyNoTemporaries( V & v ) VULKAN_HPP_NOEXCEPT
|
||||
ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( v.size() ) )
|
||||
, m_ptr( v.begin() )
|
||||
{
|
||||
@ -7360,8 +7360,9 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
void ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )
|
||||
|
@ -4393,14 +4393,6 @@ namespace std
|
||||
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.flags );
|
||||
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.queueCreateInfoCount );
|
||||
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.pQueueCreateInfos );
|
||||
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.enabledLayerCount );
|
||||
for ( size_t i = 0; i < deviceCreateInfo.enabledLayerCount; ++i )
|
||||
{
|
||||
for ( const char * p = deviceCreateInfo.ppEnabledLayerNames[i]; *p != '\0'; ++p )
|
||||
{
|
||||
VULKAN_HPP_HASH_COMBINE( seed, *p );
|
||||
}
|
||||
}
|
||||
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.enabledExtensionCount );
|
||||
for ( size_t i = 0; i < deviceCreateInfo.enabledExtensionCount; ++i )
|
||||
{
|
||||
|
@ -158,6 +158,11 @@
|
||||
# else
|
||||
# define VULKAN_HPP_CONSTEXPR_14
|
||||
# endif
|
||||
# if 201603 <= __cpp_constexpr
|
||||
# define VULKAN_HPP_CONSTEXPR_17 constexpr
|
||||
# else
|
||||
# define VULKAN_HPP_CONSTEXPR_17
|
||||
# endif
|
||||
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
|
||||
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
||||
# else
|
||||
|
@ -35995,7 +35995,18 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::eDeviceCreateInfo;
|
||||
|
||||
#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
|
||||
VULKAN_HPP_CONSTEXPR DeviceCreateInfo( DeviceCreateFlags flags_ = {},
|
||||
|
||||
# if defined( _MSC_VER )
|
||||
// no need to ignore this warning with MSVC
|
||||
# elif defined( __clang__ )
|
||||
// no need to ignore this warning with clang
|
||||
# elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
# else
|
||||
// unknown compiler... just ignore the warnings for yourselves ;)
|
||||
# endif
|
||||
VULKAN_HPP_CONSTEXPR_17 DeviceCreateInfo( DeviceCreateFlags flags_ = {},
|
||||
uint32_t queueCreateInfoCount_ = {},
|
||||
const DeviceQueueCreateInfo * pQueueCreateInfos_ = {},
|
||||
uint32_t enabledLayerCount_ = {},
|
||||
@ -36008,15 +36019,24 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
, flags{ flags_ }
|
||||
, queueCreateInfoCount{ queueCreateInfoCount_ }
|
||||
, pQueueCreateInfos{ pQueueCreateInfos_ }
|
||||
, enabledLayerCount{ enabledLayerCount_ }
|
||||
, ppEnabledLayerNames{ ppEnabledLayerNames_ }
|
||||
, enabledExtensionCount{ enabledExtensionCount_ }
|
||||
, ppEnabledExtensionNames{ ppEnabledExtensionNames_ }
|
||||
, pEnabledFeatures{ pEnabledFeatures_ }
|
||||
{
|
||||
detail::ignore( enabledLayerCount_ );
|
||||
detail::ignore( ppEnabledLayerNames_ );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR DeviceCreateInfo( DeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
VULKAN_HPP_CONSTEXPR_17 DeviceCreateInfo( DeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
: pNext{ rhs.pNext }
|
||||
, flags{ rhs.flags }
|
||||
, queueCreateInfoCount{ rhs.queueCreateInfoCount }
|
||||
, pQueueCreateInfos{ rhs.pQueueCreateInfos }
|
||||
, enabledExtensionCount{ rhs.enabledExtensionCount }
|
||||
, ppEnabledExtensionNames{ rhs.ppEnabledExtensionNames }
|
||||
, pEnabledFeatures{ rhs.pEnabledFeatures }
|
||||
{
|
||||
}
|
||||
|
||||
DeviceCreateInfo( VkDeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT : DeviceCreateInfo( *reinterpret_cast<DeviceCreateInfo const *>( &rhs ) ) {}
|
||||
|
||||
@ -36031,21 +36051,49 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
, flags( flags_ )
|
||||
, queueCreateInfoCount( static_cast<uint32_t>( queueCreateInfos_.size() ) )
|
||||
, pQueueCreateInfos( queueCreateInfos_.data() )
|
||||
, enabledLayerCount( static_cast<uint32_t>( pEnabledLayerNames_.size() ) )
|
||||
, ppEnabledLayerNames( pEnabledLayerNames_.data() )
|
||||
, enabledExtensionCount( static_cast<uint32_t>( pEnabledExtensionNames_.size() ) )
|
||||
, ppEnabledExtensionNames( pEnabledExtensionNames_.data() )
|
||||
, pEnabledFeatures( pEnabledFeatures_ )
|
||||
{
|
||||
detail::ignore( pEnabledLayerNames_ );
|
||||
}
|
||||
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
|
||||
DeviceCreateInfo & operator=( DeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
# if defined( _MSC_VER )
|
||||
// no need to ignore this warning with MSVC
|
||||
# elif defined( __clang__ )
|
||||
// no need to ignore this warning with clang
|
||||
# elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic pop
|
||||
# else
|
||||
// unknown compiler... just ignore the warnings for yourselves ;)
|
||||
# endif
|
||||
|
||||
DeviceCreateInfo & operator=( DeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
pNext = rhs.pNext;
|
||||
flags = rhs.flags;
|
||||
queueCreateInfoCount = rhs.queueCreateInfoCount;
|
||||
pQueueCreateInfos = rhs.pQueueCreateInfos;
|
||||
enabledExtensionCount = rhs.enabledExtensionCount;
|
||||
ppEnabledExtensionNames = rhs.ppEnabledExtensionNames;
|
||||
pEnabledFeatures = rhs.pEnabledFeatures;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
|
||||
|
||||
DeviceCreateInfo & operator=( VkDeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
*this = *reinterpret_cast<DeviceCreateInfo const *>( &rhs );
|
||||
pNext = rhs.pNext;
|
||||
flags = static_cast<DeviceCreateFlags>( rhs.flags );
|
||||
queueCreateInfoCount = rhs.queueCreateInfoCount;
|
||||
pQueueCreateInfos = reinterpret_cast<const DeviceQueueCreateInfo *>( rhs.pQueueCreateInfos );
|
||||
enabledExtensionCount = rhs.enabledExtensionCount;
|
||||
ppEnabledExtensionNames = rhs.ppEnabledExtensionNames;
|
||||
pEnabledFeatures = reinterpret_cast<const PhysicalDeviceFeatures *>( rhs.pEnabledFeatures );
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -36083,23 +36131,24 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 DeviceCreateInfo & setEnabledLayerCount( uint32_t enabledLayerCount_ ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_DEPRECATED( "ignored" ) VULKAN_HPP_CONSTEXPR_14 DeviceCreateInfo & setEnabledLayerCount( uint32_t enabledLayerCount_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
enabledLayerCount = enabledLayerCount_;
|
||||
detail::ignore( enabledLayerCount_ );
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_DEPRECATED( "ignored" )
|
||||
VULKAN_HPP_CONSTEXPR_14 DeviceCreateInfo & setPpEnabledLayerNames( const char * const * ppEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
ppEnabledLayerNames = ppEnabledLayerNames_;
|
||||
detail::ignore( ppEnabledLayerNames_ );
|
||||
return *this;
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
VULKAN_HPP_DEPRECATED( "ignored" )
|
||||
DeviceCreateInfo & setPEnabledLayerNames( ArrayProxyNoTemporaries<const char * const> const & pEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
enabledLayerCount = static_cast<uint32_t>( pEnabledLayerNames_.size() );
|
||||
ppEnabledLayerNames = pEnabledLayerNames_.data();
|
||||
detail::ignore( pEnabledLayerNames_ );
|
||||
return *this;
|
||||
}
|
||||
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
@ -36195,14 +36244,6 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return cmp;
|
||||
if ( auto cmp = pQueueCreateInfos <=> rhs.pQueueCreateInfos; cmp != 0 )
|
||||
return cmp;
|
||||
if ( auto cmp = enabledLayerCount <=> rhs.enabledLayerCount; cmp != 0 )
|
||||
return cmp;
|
||||
for ( size_t i = 0; i < enabledLayerCount; ++i )
|
||||
{
|
||||
if ( ppEnabledLayerNames[i] != rhs.ppEnabledLayerNames[i] )
|
||||
if ( auto cmp = strcmp( ppEnabledLayerNames[i], rhs.ppEnabledLayerNames[i] ); cmp != 0 )
|
||||
return cmp < 0 ? std::strong_ordering::less : std::strong_ordering::greater;
|
||||
}
|
||||
if ( auto cmp = enabledExtensionCount <=> rhs.enabledExtensionCount; cmp != 0 )
|
||||
return cmp;
|
||||
for ( size_t i = 0; i < enabledExtensionCount; ++i )
|
||||
@ -36221,12 +36262,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
bool operator==( DeviceCreateInfo const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( queueCreateInfoCount == rhs.queueCreateInfoCount ) &&
|
||||
( pQueueCreateInfos == rhs.pQueueCreateInfos ) && ( enabledLayerCount == rhs.enabledLayerCount ) &&
|
||||
std::equal( ppEnabledLayerNames,
|
||||
ppEnabledLayerNames + enabledLayerCount,
|
||||
rhs.ppEnabledLayerNames,
|
||||
[]( char const * left, char const * right ) { return ( left == right ) || ( strcmp( left, right ) == 0 ); } ) &&
|
||||
( enabledExtensionCount == rhs.enabledExtensionCount ) &&
|
||||
( pQueueCreateInfos == rhs.pQueueCreateInfos ) && ( enabledExtensionCount == rhs.enabledExtensionCount ) &&
|
||||
std::equal( ppEnabledExtensionNames,
|
||||
ppEnabledExtensionNames + enabledExtensionCount,
|
||||
rhs.ppEnabledExtensionNames,
|
||||
@ -36245,8 +36281,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
DeviceCreateFlags flags = {};
|
||||
uint32_t queueCreateInfoCount = {};
|
||||
const DeviceQueueCreateInfo * pQueueCreateInfos = {};
|
||||
uint32_t enabledLayerCount = {};
|
||||
const char * const * ppEnabledLayerNames = {};
|
||||
VULKAN_HPP_DEPRECATED( "ignored" ) uint32_t enabledLayerCount;
|
||||
VULKAN_HPP_DEPRECATED( "ignored" ) const char * const * ppEnabledLayerNames;
|
||||
uint32_t enabledExtensionCount = {};
|
||||
const char * const * ppEnabledExtensionNames = {};
|
||||
const PhysicalDeviceFeatures * pEnabledFeatures = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user