Mark deprecated struct members as deprecated. (#2230)

This commit is contained in:
Andreas Süßenbach 2025-07-30 09:36:58 +02:00 committed by GitHub
parent cc01933661
commit d16c62670b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 453 additions and 196 deletions

View File

@ -1533,6 +1533,11 @@ bool VulkanHppGenerator::containsArray( std::string const & type ) const
return found; 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 bool VulkanHppGenerator::containsFuncPointer( std::string const & type ) const
{ {
// a simple recursive check if a type contains a funcpointer // a simple recursive check if a type contains a funcpointer
@ -5026,11 +5031,17 @@ std::string VulkanHppGenerator::generateCommandVoid2Return( std::string const &
return ""; 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! // structs with a VkBaseInStructure and VkBaseOutStructure can't be a constexpr!
const bool isConstExpression = ( structName != "VkBaseInStructure" ) && ( structName != "VkBaseOutStructure" ); const bool isConstExpression = ( structData.first != "VkBaseInStructure" ) && ( structData.first != "VkBaseOutStructure" );
return isConstExpression ? ( std::string( "VULKAN_HPP_CONSTEXPR" ) + ( ( containsUnion( structName ) || containsArray( structName ) ) ? "_14 " : " " ) ) : ""; 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 std::string VulkanHppGenerator::generateConstexprDefines() const
@ -9507,7 +9518,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
handleType += "s"; handleType += "s";
} }
std::string decoratedReturnType = returnType; std::string decoratedReturnType = returnType;
if (!commandData.errorCodes.empty()) if ( !commandData.errorCodes.empty() )
{ {
decoratedReturnType = "typename ResultValueType<" + returnType + ">::type"; decoratedReturnType = "typename ResultValueType<" + returnType + ">::type";
} }
@ -11258,6 +11269,42 @@ std::string VulkanHppGenerator::generateStruct( std::pair<std::string, Structure
return str; 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 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", static const std::set<std::string> simpleTypes = { "char", "double", "DWORD", "float", "HANDLE", "HINSTANCE", "HMONITOR",
@ -11271,97 +11318,101 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
for ( size_t i = 0; i < structData.second.members.size(); i++ ) for ( size_t i = 0; i < structData.second.members.size(); i++ )
{ {
MemberData const & member = structData.second.members[i]; MemberData const & member = structData.second.members[i];
auto typeIt = m_types.find( member.type.type ); if ( member.deprecated.empty() )
assert( typeIt != m_types.end() );
if ( ( typeIt->second.category == TypeCategory::ExternalType ) && member.type.postfix.empty() && !simpleTypes.contains( member.type.type ) )
{ {
nonDefaultCompare = true; auto typeIt = m_types.find( member.type.type );
// this type might support operator==() or operator<=>()... that is, use memcmp assert( typeIt != m_types.end() );
compareMembers += intro + "( memcmp( &" + member.name + ", &rhs." + member.name + ", sizeof( " + member.type.type + " ) ) == 0 )"; if ( ( typeIt->second.category == TypeCategory::ExternalType ) && member.type.postfix.empty() && !simpleTypes.contains( member.type.type ) )
{
nonDefaultCompare = true;
// this type might support operator==() or operator<=>()... that is, use memcmp
compareMembers += intro + "( memcmp( &" + member.name + ", &rhs." + member.name + ", sizeof( " + member.type.type + " ) ) == 0 )";
static const std::string spaceshipMemberTemplate = static const std::string spaceshipMemberTemplate =
R"( if ( auto cmp = memcmp( &${name}, &rhs.${name}, sizeof( ${type} ) ); cmp != 0 ) R"( if ( auto cmp = memcmp( &${name}, &rhs.${name}, sizeof( ${type} ) ); cmp != 0 )
return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater; return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater;
)"; )";
spaceshipMembers += spaceshipMembers +=
replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering }, { "type", member.type.type } } ); replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering }, { "type", member.type.type } } );
} }
else if ( member.type.type == "char" && !member.lenExpressions.empty() ) else if ( member.type.type == "char" && !member.lenExpressions.empty() )
{
// compare null-terminated strings
nonDefaultCompare = true;
assert( member.lenExpressions.size() < 3 );
if ( member.lenExpressions.size() == 1 )
{ {
assert( member.lenExpressions[0] == "null-terminated" ); // compare null-terminated strings
if ( member.arraySizes.empty() ) nonDefaultCompare = true;
assert( member.lenExpressions.size() < 3 );
if ( member.lenExpressions.size() == 1 )
{ {
compareMembers += intro + "( ( " + member.name + " == rhs." + member.name + " ) || ( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 ) )"; assert( member.lenExpressions[0] == "null-terminated" );
if ( member.arraySizes.empty() )
{
compareMembers +=
intro + "( ( " + member.name + " == rhs." + member.name + " ) || ( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 ) )";
static const std::string spaceshipMemberTemplate = static const std::string spaceshipMemberTemplate =
R"( if ( ${name} != rhs.${name} ) R"( if ( ${name} != rhs.${name} )
if ( auto cmp = strcmp( ${name}, rhs.${name} ); cmp != 0 ) if ( auto cmp = strcmp( ${name}, rhs.${name} ); cmp != 0 )
return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater; return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater;
)"; )";
spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering } } ); spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering } } );
}
else
{
assert( member.arraySizes.size() == 1 );
compareMembers += intro + "( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 )";
static const std::string spaceshipMemberTemplate =
R"( if ( auto cmp = strcmp( ${name}, rhs.${name} ); cmp != 0 )
return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater;
)";
spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering } } );
}
} }
else else
{ {
assert( member.arraySizes.size() == 1 ); assert( member.lenExpressions[1] == "null-terminated" );
compareMembers += intro + "( strcmp( " + member.name + ", rhs." + member.name + " ) == 0 )"; assert( ( member.type.prefix == "const" ) && ( member.type.postfix == "* const *" ) );
static const std::string compareMemberTemplate =
R"(std::equal( ${name}, ${name} + ${count}, rhs.${name}, []( char const * left, char const * right ) { return ( left == right ) || ( strcmp( left, right ) == 0 ); } ))";
compareMembers += intro + replaceWithMap( compareMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name } } );
static const std::string spaceshipMemberTemplate = static const std::string spaceshipMemberTemplate = R"( for ( size_t i = 0; i < ${count}; ++i )
R"( if ( auto cmp = strcmp( ${name}, rhs.${name} ); cmp != 0 )
return ( cmp < 0 ) ? ${ordering}::less : ${ordering}::greater;
)";
spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "name", member.name }, { "ordering", spaceshipOrdering } } );
}
}
else
{
assert( member.lenExpressions[1] == "null-terminated" );
assert( ( member.type.prefix == "const" ) && ( member.type.postfix == "* const *" ) );
static const std::string compareMemberTemplate =
R"(std::equal( ${name}, ${name} + ${count}, rhs.${name}, []( char const * left, char const * right ) { return ( left == right ) || ( strcmp( left, right ) == 0 ); } ))";
compareMembers += intro + replaceWithMap( compareMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name } } );
static const std::string spaceshipMemberTemplate = R"( for ( size_t i = 0; i < ${count}; ++i )
{ {
if ( ${name}[i] != rhs.${name}[i] ) if ( ${name}[i] != rhs.${name}[i] )
if ( auto cmp = strcmp( ${name}[i], rhs.${name}[i] ); cmp != 0 ) if ( auto cmp = strcmp( ${name}[i], rhs.${name}[i] ); cmp != 0 )
return cmp < 0 ? ${ordering}::less : ${ordering}::greater; return cmp < 0 ? ${ordering}::less : ${ordering}::greater;
} }
)"; )";
spaceshipMembers += spaceshipMembers +=
replaceWithMap( spaceshipMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name }, { "ordering", spaceshipOrdering } } ); replaceWithMap( spaceshipMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name }, { "ordering", spaceshipOrdering } } );
}
} }
} else if ( !member.arraySizes.empty() && !member.lenExpressions.empty() )
else if ( !member.arraySizes.empty() && !member.lenExpressions.empty() ) {
{ nonDefaultCompare = true;
nonDefaultCompare = true;
assert( ( member.arraySizes.size() == 1 ) && ( member.lenExpressions.size() == 1 ) ); assert( ( member.arraySizes.size() == 1 ) && ( member.lenExpressions.size() == 1 ) );
assert( std::ranges::any_of( structData.second.members, [&member]( MemberData const & m ) { return m.name == member.lenExpressions[0]; } ) ); assert( std::ranges::any_of( structData.second.members, [&member]( MemberData const & m ) { return m.name == member.lenExpressions[0]; } ) );
std::string type = member.type.compose( "Vk" ); std::string type = member.type.compose( "Vk" );
static const std::string compareMemberTemplate = R"(( memcmp( ${name}, rhs.${name}, ${count} * sizeof( ${type} ) ) == 0 ))"; static const std::string compareMemberTemplate = R"(( memcmp( ${name}, rhs.${name}, ${count} * sizeof( ${type} ) ) == 0 ))";
compareMembers += intro + replaceWithMap( compareMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name }, { "type", type } } ); compareMembers += intro + replaceWithMap( compareMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name }, { "type", type } } );
static const std::string spaceshipMemberTemplate = R"( for ( size_t i = 0; i < ${count}; ++i ) static const std::string spaceshipMemberTemplate = R"( for ( size_t i = 0; i < ${count}; ++i )
{ {
if ( auto cmp = ${name}[i] <=> rhs.${name}[i]; cmp != 0 ) return cmp; if ( auto cmp = ${name}[i] <=> rhs.${name}[i]; cmp != 0 ) return cmp;
} }
)"; )";
spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name } } ); spaceshipMembers += replaceWithMap( spaceshipMemberTemplate, { { "count", member.lenExpressions[0] }, { "name", member.name } } );
}
else
{
// for all others, we use the operator== of that type
compareMembers += intro + "( " + member.name + " == rhs." + member.name + " )";
spaceshipMembers += " if ( auto cmp = " + member.name + " <=> rhs." + member.name + "; cmp != 0 ) return cmp;\n";
}
intro = "\n && ";
} }
else
{
// for all others, we use the operator== of that type
compareMembers += intro + "( " + member.name + " == rhs." + member.name + " )";
spaceshipMembers += " if ( auto cmp = " + member.name + " <=> rhs." + member.name + "; cmp != 0 ) return cmp;\n";
}
intro = "\n && ";
} }
std::string structName = stripPrefix( structData.first, "Vk" ); 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 // the constructor with all the elements as arguments, with defaults
// and the simple copy constructor from the corresponding vulkan structure // 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} ${initializers}
{} {${ignores}}
${constexpr}${structName}( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default; ${copyConstructor}
${structName}( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT ${structName}( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
: ${structName}( *reinterpret_cast<${structName} const *>( &rhs ) ) : ${structName}( *reinterpret_cast<${structName} const *>( &rhs ) )
{} {}
${enhancedConstructors}
${popIgnored}
)"; )";
std::vector<std::string> arguments, initializers; std::vector<std::string> arguments, initializers;
std::string ignores;
for ( auto const & member : structData.second.members ) for ( auto const & member : structData.second.members )
{ {
// gather the arguments // gather the arguments
@ -11454,12 +11509,48 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
arguments.push_back( argument ); arguments.push_back( argument );
} }
// gather the initializers; skip members with exactly one legal value if ( member.deprecated.empty() )
if ( member.value.empty() )
{ {
initializers.push_back( member.name + "{ " + member.name + "_ }" ); // 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"; } ); auto pNextIt = std::ranges::find_if( structData.second.members, []( MemberData const & md ) { return md.name == "pNext"; } );
if ( pNextIt != structData.second.members.end() ) if ( pNextIt != structData.second.members.end() )
{ {
@ -11469,14 +11560,15 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
std::string str = replaceWithMap( constructors, std::string str = replaceWithMap( constructors,
{ { "arguments", generateList( arguments, "", ", " ) }, { { "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, ": ", ", " ) }, { "initializers", generateList( initializers, ": ", ", " ) },
{ "structName", stripPrefix( structData.first, "Vk" ) } } ); { "structName", stripPrefix( structData.first, "Vk" ) } } );
if ( !structData.second.returnedOnly )
{
str += generateStructConstructorsEnhanced( structData );
}
return str; return str;
} }
@ -11542,7 +11634,7 @@ ${byString}
std::vector<std::string> arguments, initializers; std::vector<std::string> arguments, initializers;
bool arrayListed = false; 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 ) for ( auto mit = structData.second.members.begin(); mit != structData.second.members.end(); ++mit )
{ {
// gather the initializers // gather the initializers
@ -11555,9 +11647,12 @@ ${byString}
auto litit = lenIts.find( mit ); auto litit = lenIts.find( mit );
if ( litit != lenIts.end() ) if ( litit != lenIts.end() )
{ {
// len arguments just have an initalizer, from the array size if ( mit->deprecated.empty() )
initializers.push_back( mit->name + "( " + generateLenInitializer( mit, litit, structData.second.mutualExclusiveLens ) + " )" ); {
sizeChecks += generateSizeCheck( litit->second, stripPrefix( structData.first, "Vk" ), structData.second.mutualExclusiveLens ); // 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 ) ) else if ( hasLen( *mit, structData.second.members ) )
{ {
@ -11602,11 +11697,18 @@ ${byString}
if ( mit->type.isPointer() ) if ( mit->type.isPointer() )
{ {
initializers.push_back( mit->name + "( " + argumentName + ".data() )" ); if ( mit->deprecated.empty() )
{
initializers.push_back( mit->name + "( " + argumentName + ".data() )" );
}
else
{
ignores += "detail::ignore( " + argumentName + " );\n";
}
} }
else else
{ {
assert( mit->arraySizes.size() == 1 ); assert( mit->deprecated.empty() && ( mit->arraySizes.size() == 1 ) );
if ( mit->lenExpressions[0] == "null-terminated" ) if ( mit->lenExpressions[0] == "null-terminated" )
{ {
static const std::string strcpyTemplate = R"( static const std::string strcpyTemplate = R"(
@ -11640,6 +11742,7 @@ ${byString}
} }
else else
{ {
assert( mit->deprecated.empty() );
std::string argument = generateStructConstructorArgument( *mit, arrayListed ); std::string argument = generateStructConstructorArgument( *mit, arrayListed );
if ( !argument.empty() ) if ( !argument.empty() )
{ {
@ -11661,13 +11764,18 @@ ${byString}
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
${templateHeader} ${structName}( ${arguments} ) ${templateHeader} ${structName}( ${arguments} )
${initializers} ${initializers}
{${sizeChecks}${copyOps}} {
${ignores}
${sizeChecks}
${copyOps}
}
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
)"; )";
return replaceWithMap( constructorTemplate, return replaceWithMap( constructorTemplate,
{ { "arguments", generateList( arguments, "", ", " ) }, { { "arguments", generateList( arguments, "", ", " ) },
{ "copyOps", copyOps }, { "copyOps", copyOps },
{ "ignores", ignores },
{ "initializers", generateList( initializers, ": ", ", " ) }, { "initializers", generateList( initializers, ": ", ", " ) },
{ "sizeChecks", sizeChecks }, { "sizeChecks", sizeChecks },
{ "structName", stripPrefix( structData.first, "Vk" ) }, { "structName", stripPrefix( structData.first, "Vk" ) },
@ -11720,6 +11828,77 @@ std::string VulkanHppGenerator::generateStructConstructorArgument( MemberData co
return str; 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::string VulkanHppGenerator::generateStructHashStructure( std::pair<std::string, StructureData> const & structure,
std::set<std::string> & listedStructs ) const std::set<std::string> & listedStructs ) const
{ {
@ -11800,50 +11979,53 @@ std::string VulkanHppGenerator::generateStructHashSum( std::string const & struc
std::string hashSum; std::string hashSum;
for ( auto const & member : members ) for ( auto const & member : members )
{ {
if ( !member.arraySizes.empty() ) if ( member.deprecated.empty() )
{ {
assert( member.arraySizes.size() < 3 ); if ( !member.arraySizes.empty() )
hashSum += " for ( size_t i = 0; i < " + member.arraySizes[0] + "; ++i )\n";
hashSum += " {\n";
if ( member.arraySizes.size() == 1 )
{ {
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i] );\n"; assert( member.arraySizes.size() < 3 );
hashSum += " for ( size_t i = 0; i < " + member.arraySizes[0] + "; ++i )\n";
hashSum += " {\n";
if ( member.arraySizes.size() == 1 )
{
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i] );\n";
}
else
{
hashSum += " for ( size_t j=0; j < " + member.arraySizes[1] + "; ++j )\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i][j] );\n";
hashSum += " }\n";
}
hashSum += " }\n";
}
else if ( member.type.type == "char" && !member.lenExpressions.empty() )
{
assert( member.lenExpressions.size() < 3 );
if ( member.lenExpressions.size() == 1 )
{
assert( member.lenExpressions[0] == "null-terminated" );
hashSum += " for ( const char* p = " + structName + "." + member.name + "; *p != '\\0'; ++p )\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n";
hashSum += " }\n";
}
else
{
assert( member.lenExpressions[1] == "null-terminated" );
hashSum += " for ( size_t i = 0; i < " + structName + "." + member.lenExpressions[0] + "; ++i )\n";
hashSum += " {\n";
hashSum += " for ( const char* p = " + structName + "." + member.name + "[i]; *p != '\\0'; ++p )\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n";
hashSum += " }\n";
hashSum += " }\n";
}
} }
else else
{ {
hashSum += " for ( size_t j=0; j < " + member.arraySizes[1] + "; ++j )\n"; hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + " );\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i][j] );\n";
hashSum += " }\n";
} }
hashSum += " }\n";
}
else if ( member.type.type == "char" && !member.lenExpressions.empty() )
{
assert( member.lenExpressions.size() < 3 );
if ( member.lenExpressions.size() == 1 )
{
assert( member.lenExpressions[0] == "null-terminated" );
hashSum += " for ( const char* p = " + structName + "." + member.name + "; *p != '\\0'; ++p )\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n";
hashSum += " }\n";
}
else
{
assert( member.lenExpressions[1] == "null-terminated" );
hashSum += " for ( size_t i = 0; i < " + structName + "." + member.lenExpressions[0] + "; ++i )\n";
hashSum += " {\n";
hashSum += " for ( const char* p = " + structName + "." + member.name + "[i]; *p != '\\0'; ++p )\n";
hashSum += " {\n";
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n";
hashSum += " }\n";
hashSum += " }\n";
}
}
else
{
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + " );\n";
} }
} }
assert( !hashSum.empty() ); assert( !hashSum.empty() );
@ -11961,18 +12143,20 @@ std::string VulkanHppGenerator::generateStructure( std::pair<std::string, Struct
${constructors} ${constructors}
${subConstructors} ${subConstructors}
${deprecatedConstructors} ${deprecatedConstructors}
${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default; ${copyAssignment}
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/ #endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
${structName} & operator=( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT ${structName} & operator=( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
{ {
*this = *reinterpret_cast<${structName} const *>( &rhs ); ${castAssignments}
return *this; return *this;
} }
)"; )";
constructorsAndSetters = replaceWithMap( constructorsTemplate, constructorsAndSetters = replaceWithMap( constructorsTemplate,
{ { "constructors", generateStructConstructors( structure ) }, { { "castAssignments", generateStructCastAssignments( structure ) },
{ "constructors", generateStructConstructors( structure ) },
{ "copyAssignment", generateStructCopyAssignment( structure ) },
{ "deprecatedConstructors", generateDeprecatedConstructors( structure.first ) }, { "deprecatedConstructors", generateDeprecatedConstructors( structure.first ) },
{ "structName", stripPrefix( structure.first, "Vk" ) }, { "structName", stripPrefix( structure.first, "Vk" ) },
{ "subConstructors", generateStructSubConstructor( structure ) } } ); { "subConstructors", generateStructSubConstructor( structure ) } } );
@ -12215,6 +12399,13 @@ std::tuple<std::string, std::string, std::string, std::string>
for ( auto const & member : structData.second.members ) for ( auto const & member : structData.second.members )
{ {
members += " "; members += " ";
if ( !member.deprecated.empty() )
{
assert( member.deprecated == "ignored" );
members += "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) ";
}
std::string type; std::string type;
if ( !member.bitCount.empty() && member.type.type.starts_with( "Vk" ) ) 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 ); type = generateStandardArrayWrapper( member.type.compose( "Vk" ), member.arraySizes );
} }
members += type + " " + member.name; 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 // special handling for members with legal value: use it as the default
members += " = "; members += " = ";
@ -12263,10 +12454,11 @@ std::tuple<std::string, std::string, std::string, std::string>
assert( member.arraySizes.empty() || member.bitCount.empty() ); assert( member.arraySizes.empty() || member.bitCount.empty() );
if ( !member.bitCount.empty() ) if ( !member.bitCount.empty() )
{ {
assert( member.deprecated.empty() );
members += " : " + member.bitCount; // except for bitfield members, where no default member initializatin members += " : " + member.bitCount; // except for bitfield members, where no default member initializatin
// is supported (up to C++20) // is supported (up to C++20)
} }
else else if ( member.deprecated.empty() )
{ {
members += " = "; members += " = ";
auto enumIt = m_enums.find( member.type.type ); 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 ! if ( member.type.type != "VkStructureType" ) // filter out StructureType, which is supposed to be immutable !
{ {
static const std::string templateString = R"( 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}; ${assignment};
return *this; return *this;
@ -12314,18 +12506,26 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
: ( member.arraySizes.empty() ? member.type.compose( "Vk" ) : generateStandardArray( member.type.compose( "Vk" ), member.arraySizes ) ); : ( 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" ); const bool isReinterpretation = !member.bitCount.empty() && member.type.type.starts_with( "Vk" );
std::string assignment; std::string assignment;
if ( isReinterpretation ) if ( member.deprecated.empty() )
{ {
assignment = member.name + " = " + "*reinterpret_cast<" + member.type.type + "*>(&" + member.name + "_)"; if ( isReinterpretation )
{
assignment = member.name + " = " + "*reinterpret_cast<" + member.type.type + "*>(&" + member.name + "_)";
}
else
{
assignment = member.name + " = " + member.name + "_";
}
} }
else else
{ {
assignment = member.name + " = " + member.name + "_"; assignment = "detail::ignore( " + member.name + "_ )";
} }
str += replaceWithMap( templateString, str += replaceWithMap( templateString,
{ { "assignment", assignment }, { { "assignment", assignment },
{ "constexpr", isReinterpretation ? "" : "VULKAN_HPP_CONSTEXPR_14 " }, { "constexpr", isReinterpretation ? "" : "VULKAN_HPP_CONSTEXPR_14 " },
{ "deprecated", member.deprecated.empty() ? "" : "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) " },
{ "memberName", member.name }, { "memberName", member.name },
{ "MemberName", startUpperCase( member.name ) }, { "MemberName", startUpperCase( member.name ) },
{ "memberType", memberType }, { "memberType", memberType },
@ -12339,7 +12539,8 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
if ( member.lenExpressions[0] == "null-terminated" ) 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"( static const std::string setStringTemplate = R"(
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #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 ) ) else if ( ( structureName == "LayerSettingEXT" ) && ( index == 4 ) )
{ {
// VkLayerSettingEXT::pValues needs some special handling! // VkLayerSettingEXT::pValues needs some special handling!
assert( member.name == "pValues" ); assert( member.deprecated.empty() && ( member.name == "pValues" ) );
static const std::string byTypeTemplate = static const std::string byTypeTemplate =
R"( LayerSettingEXT & setValues( ArrayProxyNoTemporaries<const ${type}> const & values_ ) VULKAN_HPP_NOEXCEPT R"( LayerSettingEXT & setValues( ArrayProxyNoTemporaries<const ${type}> const & values_ ) VULKAN_HPP_NOEXCEPT
{ {
@ -12446,12 +12647,25 @@ ${byString}
if ( member.type.isPointer() ) 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"( static const std::string setArrayTemplate = R"(
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #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}; ${functionBody}
${memberName} = ${arrayName}_.data();
return *this; return *this;
} }
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -12460,9 +12674,8 @@ ${byString}
str += replaceWithMap( setArrayTemplate, str += replaceWithMap( setArrayTemplate,
{ { "arrayName", arrayName }, { { "arrayName", arrayName },
{ "ArrayName", startUpperCase( arrayName ) }, { "ArrayName", startUpperCase( arrayName ) },
{ "lenName", lenName }, { "deprecated", member.deprecated.empty() ? "" : "VULKAN_HPP_DEPRECATED( \"" + member.deprecated + "\" ) " },
{ "lenValue", lenValue }, { "functionBody", functionBody },
{ "memberName", member.name },
{ "memberType", memberType }, { "memberType", memberType },
{ "structureName", structureName }, { "structureName", structureName },
{ "templateHeader", templateHeader } } ); { "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() ) ); "member attribute <altlen> holds unknown number of data: " + std::to_string( memberData.lenExpressions.size() ) );
memberData.lenMembers = filterNumbers( tokenizeAny( attribute.second, " /()+*" ) ); memberData.lenMembers = filterNumbers( tokenizeAny( attribute.second, " /()+*" ) );
} }
else if ( attribute.second == "deprecated" ) else if ( attribute.first == "deprecated" )
{ {
assert( false ); memberData.deprecated = attribute.second;
// the struct member is marked as deprecated/ignored, but still exisits -> no modifications needed here
} }
else if ( attribute.first == "len" ) else if ( attribute.first == "len" )
{ {

View File

@ -400,6 +400,7 @@ private:
std::string name = {}; std::string name = {};
std::vector<std::string> arraySizes = {}; std::vector<std::string> arraySizes = {};
std::string bitCount = {}; std::string bitCount = {};
std::string deprecated = {};
std::vector<std::string> lenExpressions = {}; std::vector<std::string> lenExpressions = {};
std::vector<std::pair<std::string, size_t>> lenMembers = {}; std::vector<std::pair<std::string, size_t>> lenMembers = {};
bool noAutoValidity = {}; bool noAutoValidity = {};
@ -571,6 +572,7 @@ private:
bool raii ) const; bool raii ) const;
bool contains( std::vector<EnumValueData> const & enumValues, std::string const & name ) const; bool contains( std::vector<EnumValueData> const & enumValues, std::string const & name ) const;
bool containsArray( std::string const & type ) const; bool containsArray( std::string const & type ) const;
bool containsDeprecated( std::vector<MemberData> const & members ) const;
bool containsFuncPointer( std::string const & type ) const; bool containsFuncPointer( std::string const & type ) const;
bool containsFloatingPoints( std::vector<MemberData> const & members ) const; bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
bool containsUnion( std::string const & type ) const; bool containsUnion( std::string const & type ) const;
@ -780,7 +782,7 @@ private:
bool definition, bool definition,
std::vector<size_t> const & returnParamIndices, std::vector<size_t> const & returnParamIndices,
bool raii ) const; 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 generateConstexprDefines() const;
std::string generateConstexprUsings() const; std::string generateConstexprUsings() const;
std::string generateCppModuleFuncpointerUsings() const; std::string generateCppModuleFuncpointerUsings() const;
@ -1037,10 +1039,13 @@ private:
std::string generateStaticAssertions() const; std::string generateStaticAssertions() const;
std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) 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 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 generateStructCompareOperators( std::pair<std::string, StructureData> const & structure ) const;
std::string generateStructConstructors( std::pair<std::string, StructureData> const & structData ) 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 generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructConstructorArgument( MemberData const & memberData, bool withDefault ) 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 generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
std::string generateStructHashStructures() const; std::string generateStructHashStructures() const;
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const; std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;

View File

@ -141,8 +141,9 @@
namespace detail namespace detail
{ {
template <typename T> 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 ) VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )

View File

@ -141,6 +141,11 @@ ${vulkan_64_bit_ptr_defines}
# else # else
# define VULKAN_HPP_CONSTEXPR_14 # define VULKAN_HPP_CONSTEXPR_14
# endif # 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 ) ) # if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr # define VULKAN_HPP_CONSTEXPR_20 constexpr
# else # else

View File

@ -472,7 +472,7 @@ namespace VULKAN_HPP_NAMESPACE
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value && 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, std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
int>::type = 0> int>::type = 0>
ArrayProxyNoTemporaries( V & v ) VULKAN_HPP_NOEXCEPT ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( v.size() ) ) : m_count( static_cast<uint32_t>( v.size() ) )
, m_ptr( v.begin() ) , m_ptr( v.begin() )
{ {
@ -7360,8 +7360,9 @@ namespace VULKAN_HPP_NAMESPACE
namespace detail namespace detail
{ {
template <typename T> 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 ) VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )

View File

@ -4393,14 +4393,6 @@ namespace std
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.flags ); VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.flags );
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.queueCreateInfoCount ); VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.queueCreateInfoCount );
VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.pQueueCreateInfos ); 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 ); VULKAN_HPP_HASH_COMBINE( seed, deviceCreateInfo.enabledExtensionCount );
for ( size_t i = 0; i < deviceCreateInfo.enabledExtensionCount; ++i ) for ( size_t i = 0; i < deviceCreateInfo.enabledExtensionCount; ++i )
{ {

View File

@ -158,6 +158,11 @@
# else # else
# define VULKAN_HPP_CONSTEXPR_14 # define VULKAN_HPP_CONSTEXPR_14
# endif # 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 ) ) # if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr # define VULKAN_HPP_CONSTEXPR_20 constexpr
# else # else

View File

@ -35995,28 +35995,48 @@ namespace VULKAN_HPP_NAMESPACE
static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::eDeviceCreateInfo; static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::eDeviceCreateInfo;
#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS ) #if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
VULKAN_HPP_CONSTEXPR DeviceCreateInfo( DeviceCreateFlags flags_ = {},
uint32_t queueCreateInfoCount_ = {}, # if defined( _MSC_VER )
const DeviceQueueCreateInfo * pQueueCreateInfos_ = {}, // no need to ignore this warning with MSVC
uint32_t enabledLayerCount_ = {}, # elif defined( __clang__ )
const char * const * ppEnabledLayerNames_ = {}, // no need to ignore this warning with clang
uint32_t enabledExtensionCount_ = {}, # elif defined( __GNUC__ )
const char * const * ppEnabledExtensionNames_ = {}, # pragma GCC diagnostic push
const PhysicalDeviceFeatures * pEnabledFeatures_ = {}, # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT # 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_ = {},
const char * const * ppEnabledLayerNames_ = {},
uint32_t enabledExtensionCount_ = {},
const char * const * ppEnabledExtensionNames_ = {},
const PhysicalDeviceFeatures * pEnabledFeatures_ = {},
const void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT
: pNext{ pNext_ } : pNext{ pNext_ }
, flags{ flags_ } , flags{ flags_ }
, queueCreateInfoCount{ queueCreateInfoCount_ } , queueCreateInfoCount{ queueCreateInfoCount_ }
, pQueueCreateInfos{ pQueueCreateInfos_ } , pQueueCreateInfos{ pQueueCreateInfos_ }
, enabledLayerCount{ enabledLayerCount_ }
, ppEnabledLayerNames{ ppEnabledLayerNames_ }
, enabledExtensionCount{ enabledExtensionCount_ } , enabledExtensionCount{ enabledExtensionCount_ }
, ppEnabledExtensionNames{ ppEnabledExtensionNames_ } , ppEnabledExtensionNames{ ppEnabledExtensionNames_ }
, pEnabledFeatures{ pEnabledFeatures_ } , 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 ) ) {} DeviceCreateInfo( VkDeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT : DeviceCreateInfo( *reinterpret_cast<DeviceCreateInfo const *>( &rhs ) ) {}
@ -36031,21 +36051,49 @@ namespace VULKAN_HPP_NAMESPACE
, flags( flags_ ) , flags( flags_ )
, queueCreateInfoCount( static_cast<uint32_t>( queueCreateInfos_.size() ) ) , queueCreateInfoCount( static_cast<uint32_t>( queueCreateInfos_.size() ) )
, pQueueCreateInfos( queueCreateInfos_.data() ) , pQueueCreateInfos( queueCreateInfos_.data() )
, enabledLayerCount( static_cast<uint32_t>( pEnabledLayerNames_.size() ) )
, ppEnabledLayerNames( pEnabledLayerNames_.data() )
, enabledExtensionCount( static_cast<uint32_t>( pEnabledExtensionNames_.size() ) ) , enabledExtensionCount( static_cast<uint32_t>( pEnabledExtensionNames_.size() ) )
, ppEnabledExtensionNames( pEnabledExtensionNames_.data() ) , ppEnabledExtensionNames( pEnabledExtensionNames_.data() )
, pEnabledFeatures( pEnabledFeatures_ ) , pEnabledFeatures( pEnabledFeatures_ )
{ {
detail::ignore( pEnabledLayerNames_ );
} }
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ # 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*/ #endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
DeviceCreateInfo & operator=( VkDeviceCreateInfo const & rhs ) VULKAN_HPP_NOEXCEPT 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; return *this;
} }
@ -36083,23 +36131,24 @@ namespace VULKAN_HPP_NAMESPACE
} }
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ # 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; return *this;
} }
VULKAN_HPP_DEPRECATED( "ignored" )
VULKAN_HPP_CONSTEXPR_14 DeviceCreateInfo & setPpEnabledLayerNames( const char * const * ppEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT VULKAN_HPP_CONSTEXPR_14 DeviceCreateInfo & setPpEnabledLayerNames( const char * const * ppEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT
{ {
ppEnabledLayerNames = ppEnabledLayerNames_; detail::ignore( ppEnabledLayerNames_ );
return *this; return *this;
} }
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) # if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
VULKAN_HPP_DEPRECATED( "ignored" )
DeviceCreateInfo & setPEnabledLayerNames( ArrayProxyNoTemporaries<const char * const> const & pEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT DeviceCreateInfo & setPEnabledLayerNames( ArrayProxyNoTemporaries<const char * const> const & pEnabledLayerNames_ ) VULKAN_HPP_NOEXCEPT
{ {
enabledLayerCount = static_cast<uint32_t>( pEnabledLayerNames_.size() ); detail::ignore( pEnabledLayerNames_ );
ppEnabledLayerNames = pEnabledLayerNames_.data();
return *this; return *this;
} }
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ # endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -36195,14 +36244,6 @@ namespace VULKAN_HPP_NAMESPACE
return cmp; return cmp;
if ( auto cmp = pQueueCreateInfos <=> rhs.pQueueCreateInfos; cmp != 0 ) if ( auto cmp = pQueueCreateInfos <=> rhs.pQueueCreateInfos; cmp != 0 )
return cmp; 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 ) if ( auto cmp = enabledExtensionCount <=> rhs.enabledExtensionCount; cmp != 0 )
return cmp; return cmp;
for ( size_t i = 0; i < enabledExtensionCount; ++i ) 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 bool operator==( DeviceCreateInfo const & rhs ) const VULKAN_HPP_NOEXCEPT
{ {
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( queueCreateInfoCount == rhs.queueCreateInfoCount ) && return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( queueCreateInfoCount == rhs.queueCreateInfoCount ) &&
( pQueueCreateInfos == rhs.pQueueCreateInfos ) && ( enabledLayerCount == rhs.enabledLayerCount ) && ( pQueueCreateInfos == rhs.pQueueCreateInfos ) && ( enabledExtensionCount == rhs.enabledExtensionCount ) &&
std::equal( ppEnabledLayerNames,
ppEnabledLayerNames + enabledLayerCount,
rhs.ppEnabledLayerNames,
[]( char const * left, char const * right ) { return ( left == right ) || ( strcmp( left, right ) == 0 ); } ) &&
( enabledExtensionCount == rhs.enabledExtensionCount ) &&
std::equal( ppEnabledExtensionNames, std::equal( ppEnabledExtensionNames,
ppEnabledExtensionNames + enabledExtensionCount, ppEnabledExtensionNames + enabledExtensionCount,
rhs.ppEnabledExtensionNames, rhs.ppEnabledExtensionNames,
@ -36240,13 +36276,13 @@ namespace VULKAN_HPP_NAMESPACE
} }
public: public:
StructureType sType = StructureType::eDeviceCreateInfo; StructureType sType = StructureType::eDeviceCreateInfo;
const void * pNext = {}; const void * pNext = {};
DeviceCreateFlags flags = {}; DeviceCreateFlags flags = {};
uint32_t queueCreateInfoCount = {}; uint32_t queueCreateInfoCount = {};
const DeviceQueueCreateInfo * pQueueCreateInfos = {}; const DeviceQueueCreateInfo * pQueueCreateInfos = {};
uint32_t enabledLayerCount = {}; VULKAN_HPP_DEPRECATED( "ignored" ) uint32_t enabledLayerCount;
const char * const * ppEnabledLayerNames = {}; VULKAN_HPP_DEPRECATED( "ignored" ) const char * const * ppEnabledLayerNames;
uint32_t enabledExtensionCount = {}; uint32_t enabledExtensionCount = {};
const char * const * ppEnabledExtensionNames = {}; const char * const * ppEnabledExtensionNames = {};
const PhysicalDeviceFeatures * pEnabledFeatures = {}; const PhysicalDeviceFeatures * pEnabledFeatures = {};