Introduce support of std::hash for vk-structures.

This commit is contained in:
asuessenbach 2021-12-02 12:21:30 +01:00
parent bc7a5b56b9
commit 3515c720fc
7 changed files with 17287 additions and 593 deletions

View File

@ -591,6 +591,10 @@ By default, a little helper class ```DynamicLoader``` is used to dynamically loa
By default, the member ```m_mask``` of the ```Flags``` template class is private. This is to prevent accidentally setting a ```Flags``` with some inappropriate value. But it also prevents using a ```Flags```, or a structure holding a ```Flags```, to be used as a non-type template parameter. If you really need that functionality, and accept the reduced security, you can use this define to change the access specifier for m_mask from private to public, which allows using a ```Flags``` as a non-type template parameter. By default, the member ```m_mask``` of the ```Flags``` template class is private. This is to prevent accidentally setting a ```Flags``` with some inappropriate value. But it also prevents using a ```Flags```, or a structure holding a ```Flags```, to be used as a non-type template parameter. If you really need that functionality, and accept the reduced security, you can use this define to change the access specifier for m_mask from private to public, which allows using a ```Flags``` as a non-type template parameter.
#### VULKAN_HPP_HASH_COMBINE
This define can be used to specify your own hash combiner function. In order to determine the hash of a vk-structure, the hashes of the members of that struct are to be combined. This is done by this define, which by default is identical to what the function ```boost::hash_combine()``` does. It gets the type of the to-be-combined value, the seed, which is the combined value up to that point, and finally the to-be-combined value. This hash calculation determines a "shallow" hash, as it takes the hashes of any pointer in a structure, and not the hash of a pointed-to value.
#### VULKAN_HPP_INLINE #### VULKAN_HPP_INLINE
This is set to be the compiler-dependent attribute used to mark functions as inline. If your compiler happens to need some different attribute, you can set this define accordingly before including vulkan.hpp. This is set to be the compiler-dependent attribute used to mark functions as inline. If your compiler happens to need some different attribute, you can set this define accordingly before including vulkan.hpp.

View File

@ -695,7 +695,7 @@ std::string VulkanHppGenerator::generateHandles() const
return str; return str;
} }
std::string VulkanHppGenerator::generateHashStructures() const std::string VulkanHppGenerator::generateHandleHashStructures() const
{ {
const std::string hashesTemplate = R"( const std::string hashesTemplate = R"(
//======================= //=======================
@ -705,24 +705,14 @@ std::string VulkanHppGenerator::generateHashStructures() const
${hashes} ${hashes}
)"; )";
// start with the hash on Flags<BitType> std::string hashes;
std::string hashes = R"(
template <typename BitType> struct hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
{
std::size_t operator()(VULKAN_HPP_NAMESPACE::Flags<BitType> const& flags) const VULKAN_HPP_NOEXCEPT
{
return std::hash<typename std::underlying_type<BitType>::type>{}(static_cast<typename std::underlying_type<BitType>::type>(flags));
}
};
)";
for ( auto const & feature : m_features ) for ( auto const & feature : m_features )
{ {
hashes += generateHashStructures( feature.second.requireData, feature.first ); hashes += generateHandleHashStructures( feature.second.requireData, feature.first );
} }
for ( auto const & extIt : m_extensionsByNumber ) for ( auto const & extIt : m_extensionsByNumber )
{ {
hashes += generateHashStructures( extIt.second->second.requireData, extIt.second->first ); hashes += generateHandleHashStructures( extIt.second->second.requireData, extIt.second->first );
} }
return replaceWithMap( hashesTemplate, { { "hashes", hashes } } ); return replaceWithMap( hashesTemplate, { { "hashes", hashes } } );
} }
@ -1804,9 +1794,7 @@ void VulkanHppGenerator::checkStructMemberCorrectness( std::string const &
// check that there's a 1-1 connection between the specified selections and the values of that enum // check that there's a 1-1 connection between the specified selections and the values of that enum
if ( !member.selector.empty() ) if ( !member.selector.empty() )
{ {
std::string const & selector = member.selector; auto selectorIt = findStructMemberIt( member.selector, members );
auto selectorIt = std::find_if(
members.begin(), members.end(), [&selector]( MemberData const & md ) { return md.name == selector; } );
assert( selectorIt != members.end() ); assert( selectorIt != members.end() );
auto selectorEnumIt = m_enums.find( selectorIt->type.type ); auto selectorEnumIt = m_enums.find( selectorIt->type.type );
assert( selectorEnumIt != m_enums.end() ); assert( selectorEnumIt != m_enums.end() );
@ -2027,16 +2015,10 @@ std::vector<std::map<std::string, VulkanHppGenerator::CommandData>::const_iterat
if ( pd.type.type != destructorParam.type.type ) if ( pd.type.type != destructorParam.type.type )
{ {
// check if the destructor param type equals a structure member type // check if the destructor param type equals a structure member type
auto isStructureMemberType = [&destructorParam]( MemberData const & md )
{
return md.type.type == destructorParam.type.type;
};
auto structureIt = m_structures.find( pd.type.type ); auto structureIt = m_structures.find( pd.type.type );
return ( structureIt != m_structures.end() ) && return ( structureIt != m_structures.end() ) &&
( std::find_if( structureIt->second.members.begin(), ( findStructMemberItByType( destructorParam.type.type, structureIt->second.members ) !=
structureIt->second.members.end(), structureIt->second.members.end() );
isStructureMemberType ) != structureIt->second.members.end() );
} }
return true; return true;
}; };
@ -2247,6 +2229,21 @@ std::string VulkanHppGenerator::findBaseName( std::string
return baseName; return baseName;
} }
std::vector<VulkanHppGenerator::MemberData>::const_iterator
VulkanHppGenerator::findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const
{
return std::find_if(
memberData.begin(), memberData.end(), [&name]( MemberData const & md ) { return md.name == name; } );
}
std::vector<VulkanHppGenerator::MemberData>::const_iterator
VulkanHppGenerator::findStructMemberItByType( std::string const & type,
std::vector<MemberData> const & memberData ) const
{
return std::find_if(
memberData.begin(), memberData.end(), [&type]( MemberData const & md ) { return md.type.type == type; } );
}
std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamData> const & params, std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams, std::set<size_t> const & skippedParams,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
@ -7366,7 +7363,7 @@ std::string VulkanHppGenerator::generateHandleEmpty( HandleData const & handleDa
return str; return str;
} }
std::string VulkanHppGenerator::generateHashStructures( std::vector<RequireData> const & requireData, std::string VulkanHppGenerator::generateHandleHashStructures( std::vector<RequireData> const & requireData,
std::string const & title ) const std::string const & title ) const
{ {
const std::string hashTemplate = R"( const std::string hashTemplate = R"(
@ -10607,10 +10604,8 @@ std::string VulkanHppGenerator::generateRAIIHandleConstructorInitializationList(
auto structureIt = m_structures.find( constructorParam.type.type ); auto structureIt = m_structures.find( constructorParam.type.type );
if ( structureIt != m_structures.end() ) if ( structureIt != m_structures.end() )
{ {
auto structureMemberIt = std::find_if( structureIt->second.members.begin(), auto structureMemberIt =
structureIt->second.members.end(), findStructMemberItByType( destructorParam.type.type, structureIt->second.members );
[&destructorParam]( MemberData const & md )
{ return md.type.type == destructorParam.type.type; } );
if ( structureMemberIt != structureIt->second.members.end() ) if ( structureMemberIt != structureIt->second.members.end() )
{ {
assert( constructorParam.type.isConstPointer() && constructorParam.arraySizes.empty() && assert( constructorParam.type.isConstPointer() && constructorParam.arraySizes.empty() &&
@ -10936,10 +10931,7 @@ std::string VulkanHppGenerator::generateRAIIHandleConstructorVector(
assert( lenIt != constructorIt->second.params.end() ); assert( lenIt != constructorIt->second.params.end() );
auto structureIt = m_structures.find( lenIt->type.type ); auto structureIt = m_structures.find( lenIt->type.type );
assert( structureIt != m_structures.end() ); assert( structureIt != m_structures.end() );
assert( std::find_if( structureIt->second.members.begin(), assert( isStructMember( lenParts[1], structureIt->second.members ) );
structureIt->second.members.end(),
[&lenParts]( MemberData const & md )
{ return md.name == lenParts[1]; } ) != structureIt->second.members.end() );
assert( constructorIt->second.successCodes.size() == 1 ); assert( constructorIt->second.successCodes.size() == 1 );
#endif #endif
vectorSize = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1]; vectorSize = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1];
@ -11468,10 +11460,7 @@ std::string VulkanHppGenerator::generateRAIIHandleSingularConstructorArguments(
auto structureIt = m_structures.find( constructorParam.type.type ); auto structureIt = m_structures.find( constructorParam.type.type );
if ( structureIt != m_structures.end() ) if ( structureIt != m_structures.end() )
{ {
auto memberIt = std::find_if( structureIt->second.members.begin(), auto memberIt = findStructMemberItByType( destructorParam.type.type, structureIt->second.members );
structureIt->second.members.end(),
[&destructorParam]( MemberData const & md )
{ return md.type.type == destructorParam.type.type; } );
if ( memberIt != structureIt->second.members.end() ) if ( memberIt != structureIt->second.members.end() )
{ {
#if !defined( NDEBUG ) #if !defined( NDEBUG )
@ -11782,8 +11771,7 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced(
for ( auto const & mit : memberIts ) for ( auto const & mit : memberIts )
{ {
std::string lenName = ( mit->len.front() == "codeSize / 4" ) ? "codeSize" : mit->len.front(); std::string lenName = ( mit->len.front() == "codeSize / 4" ) ? "codeSize" : mit->len.front();
auto lenIt = std::find_if( auto lenIt = findStructMemberIt( lenName, structData.second.members );
structData.second.members.begin(), mit, [&lenName]( MemberData const & md ) { return md.name == lenName; } );
assert( lenIt != mit ); assert( lenIt != mit );
lenIts[lenIt].push_back( mit ); lenIts[lenIt].push_back( mit );
} }
@ -11907,6 +11895,44 @@ std::string VulkanHppGenerator::generateStructConstructorArgument( bool
return str; return str;
} }
std::string VulkanHppGenerator::generateStructHashSum( std::string const & structName,
std::vector<MemberData> const & members ) const
{
std::string hashSum;
for ( auto const & member : members )
{
if ( !member.arraySizes.empty() )
{
assert( member.arraySizes.size() < 3 );
std::string memberType = member.type.compose( "VULKAN_HPP_NAMESPACE" );
hashSum += " for ( size_t i = 0; i < " + member.arraySizes[0] + "; ++i )\n";
hashSum += " {\n";
if ( member.arraySizes.size() == 1 )
{
hashSum +=
" VULKAN_HPP_HASH_COMBINE( " + memberType + ", 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( " + memberType + ", seed, " + structName + "." + member.name +
"[i][j] );\n";
hashSum += " }\n";
}
hashSum += " }\n";
}
else
{
std::string memberType =
member.bitCount.empty() ? member.type.compose( "VULKAN_HPP_NAMESPACE" ) : member.type.type;
hashSum += " VULKAN_HPP_HASH_COMBINE( " + memberType + ", seed, " + structName + "." + member.name + " );\n";
}
}
assert( !hashSum.empty() );
return hashSum.substr( 0, hashSum.size() - 1 );
}
std::string VulkanHppGenerator::generateStructure( std::pair<std::string, StructureData> const & structure ) const std::string VulkanHppGenerator::generateStructure( std::pair<std::string, StructureData> const & structure ) const
{ {
auto [enter, leave] = generateProtection( auto [enter, leave] = generateProtection(
@ -11944,22 +11970,22 @@ std::string VulkanHppGenerator::generateStructure( std::pair<std::string, Struct
std::string members, sTypeValue; std::string members, sTypeValue;
std::tie( members, sTypeValue ) = generateStructMembers( structure, " " ); std::tie( members, sTypeValue ) = generateStructMembers( structure, " " );
static const std::string structureTemplate = R"( struct ${structureName} static const std::string structureTemplate = R"( struct ${structureType}
{ {
using NativeType = Vk${structureName}; using NativeType = Vk${structureType};
${allowDuplicate} ${allowDuplicate}
${structureType} ${typeValue}
${constructorAndSetters} ${constructorAndSetters}
operator ${vkName} const &() const VULKAN_HPP_NOEXCEPT operator Vk${structureType} const &() const VULKAN_HPP_NOEXCEPT
{ {
return *reinterpret_cast<const ${vkName}*>( this ); return *reinterpret_cast<const Vk${structureType}*>( this );
} }
operator ${vkName} &() VULKAN_HPP_NOEXCEPT operator Vk${structureType} &() VULKAN_HPP_NOEXCEPT
{ {
return *reinterpret_cast<${vkName}*>( this ); return *reinterpret_cast<Vk${structureType}*>( this );
} }
${compareOperators} ${compareOperators}
@ -11967,28 +11993,27 @@ ${compareOperators}
public: public:
${members} ${members}
}; };
VULKAN_HPP_STATIC_ASSERT( sizeof( VULKAN_HPP_NAMESPACE::${structureName} ) == sizeof( ${vkName} ), "struct and wrapper have different size!" ); VULKAN_HPP_STATIC_ASSERT( sizeof( VULKAN_HPP_NAMESPACE::${structureType} ) == sizeof( Vk${structureType} ), "struct and wrapper have different size!" );
VULKAN_HPP_STATIC_ASSERT( std::is_standard_layout<VULKAN_HPP_NAMESPACE::${structureName}>::value, "struct wrapper is not a standard layout!" ); VULKAN_HPP_STATIC_ASSERT( std::is_standard_layout<VULKAN_HPP_NAMESPACE::${structureType}>::value, "struct wrapper is not a standard layout!" );
VULKAN_HPP_STATIC_ASSERT( std::is_nothrow_move_constructible<VULKAN_HPP_NAMESPACE::${structureName}>::value, "${structureName} is not nothrow_move_constructible!" ); VULKAN_HPP_STATIC_ASSERT( std::is_nothrow_move_constructible<VULKAN_HPP_NAMESPACE::${structureType}>::value, "${structureType} is not nothrow_move_constructible!" );
)"; )";
std::string structureName = stripPrefix( structure.first, "Vk" ); std::string structureType = stripPrefix( structure.first, "Vk" );
std::string allowDuplicate, structureType; std::string allowDuplicate, typeValue;
if ( !sTypeValue.empty() ) if ( !sTypeValue.empty() )
{ {
allowDuplicate = std::string( " static const bool allowDuplicate = " ) + allowDuplicate = std::string( " static const bool allowDuplicate = " ) +
( structure.second.allowDuplicate ? "true;" : "false;" ); ( structure.second.allowDuplicate ? "true;" : "false;" );
structureType = typeValue =
" static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::" + sTypeValue + ";\n"; " static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::" + sTypeValue + ";\n";
} }
str += replaceWithMap( structureTemplate, str += replaceWithMap( structureTemplate,
{ { "allowDuplicate", allowDuplicate }, { { "allowDuplicate", allowDuplicate },
{ "structureName", structureName },
{ "structureType", structureType },
{ "constructorAndSetters", constructorAndSetters }, { "constructorAndSetters", constructorAndSetters },
{ "vkName", structure.first },
{ "compareOperators", compareOperators }, { "compareOperators", compareOperators },
{ "members", members } } ); { "members", members },
{ "structureType", structureType },
{ "typeValue", typeValue } } );
if ( !sTypeValue.empty() ) if ( !sTypeValue.empty() )
{ {
@ -11996,10 +12021,10 @@ ${members}
template <> template <>
struct CppType<StructureType, StructureType::${sTypeValue}> struct CppType<StructureType, StructureType::${sTypeValue}>
{ {
using Type = ${structureName}; using Type = ${structureType};
}; };
)"; )";
str += replaceWithMap( cppTypeTemplate, { { "sTypeValue", sTypeValue }, { "structureName", structureName } } ); str += replaceWithMap( cppTypeTemplate, { { "sTypeValue", sTypeValue }, { "structureType", structureType } } );
} }
auto aliasIt = m_structureAliasesInverse.find( structure.first ); auto aliasIt = m_structureAliasesInverse.find( structure.first );
@ -12007,10 +12032,36 @@ ${members}
{ {
for ( std::string const & alias : aliasIt->second ) for ( std::string const & alias : aliasIt->second )
{ {
str += " using " + stripPrefix( alias, "Vk" ) + " = " + structureName + ";\n"; str += " using " + stripPrefix( alias, "Vk" ) + " = " + structureType + ";\n";
} }
} }
if ( !containsUnion( structure.first ) )
{
static const std::string hashTemplate = R"(
} // VULKAN_HPP_NAMESPACE
template <> struct std::hash<VULKAN_HPP_NAMESPACE::${structureType}>
{
std::size_t operator()(VULKAN_HPP_NAMESPACE::${structureType} const & ${structureName}) const VULKAN_HPP_NOEXCEPT
{
std::size_t seed = 0;
${hashSum}
return seed;
}
};
namespace VULKAN_HPP_NAMESPACE
{
)";
std::string structureName = startLowerCase( structureType );
str += replaceWithMap( hashTemplate,
{ { "hashSum", generateStructHashSum( structureName, structure.second.members ) },
{ "structureName", structureName },
{ "structureType", structureType } } );
}
str += leave; str += leave;
return str; return str;
} }
@ -12251,8 +12302,7 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const &
lenValue += " * sizeof(T)"; lenValue += " * sizeof(T)";
} }
auto lenMember = std::find_if( auto lenMember = findStructMemberIt( lenName, memberData );
memberData.begin(), memberData.end(), [&lenName]( MemberData const & md ) { return md.name == lenName; } );
assert( lenMember != memberData.end() && lenMember->type.prefix.empty() && lenMember->type.postfix.empty() ); assert( lenMember != memberData.end() && lenMember->type.prefix.empty() && lenMember->type.postfix.empty() );
if ( lenMember->type.type != "size_t" ) if ( lenMember->type.type != "size_t" )
{ {
@ -12388,11 +12438,7 @@ std::string VulkanHppGenerator::generateUnion( std::pair<std::string, StructureD
// constructor. // constructor.
if ( memberIt->type.type == "VkBool32" ) if ( memberIt->type.type == "VkBool32" )
{ {
if ( std::find_if( structure.second.members.begin(), if ( findStructMemberItByType( "uint32_t", structure.second.members ) != structure.second.members.end() )
structure.second.members.end(),
[]( MemberData const & member ) {
return member.type.type == std::string( "uint32_t" );
} ) != structure.second.members.end() )
{ {
continue; continue;
} }
@ -12769,10 +12815,7 @@ bool VulkanHppGenerator::isLenByStructMember( std::string const & name, std::vec
#if !defined( NDEBUG ) #if !defined( NDEBUG )
auto structureIt = m_structures.find( paramIt->type.type ); auto structureIt = m_structures.find( paramIt->type.type );
assert( structureIt != m_structures.end() ); assert( structureIt != m_structures.end() );
assert( std::find_if( structureIt->second.members.begin(), assert( isStructMember( nameParts[1], structureIt->second.members ) );
structureIt->second.members.end(),
[&n = nameParts[1]]( MemberData const & md )
{ return md.name == n; } ) != structureIt->second.members.end() );
#endif #endif
return true; return true;
} }
@ -12794,10 +12837,7 @@ bool VulkanHppGenerator::isLenByStructMember( std::string const & name, ParamDat
#if !defined( NDEBUG ) #if !defined( NDEBUG )
auto structureIt = m_structures.find( param.type.type ); auto structureIt = m_structures.find( param.type.type );
assert( structureIt != m_structures.end() ); assert( structureIt != m_structures.end() );
assert( std::find_if( structureIt->second.members.begin(), assert( isStructMember( nameParts[1], structureIt->second.members ) );
structureIt->second.members.end(),
[&n = nameParts[1]]( MemberData const & md )
{ return md.name == n; } ) != structureIt->second.members.end() );
#endif #endif
return true; return true;
} }
@ -12832,6 +12872,11 @@ bool VulkanHppGenerator::isParam( std::string const & name, std::vector<ParamDat
params.end(); params.end();
} }
bool VulkanHppGenerator::isStructMember( std::string const & name, std::vector<MemberData> const & memberData ) const
{
return findStructMemberIt( name, memberData ) != memberData.end();
}
bool VulkanHppGenerator::isStructureChainAnchor( std::string const & type ) const bool VulkanHppGenerator::isStructureChainAnchor( std::string const & type ) const
{ {
if ( beginsWith( type, "Vk" ) ) if ( beginsWith( type, "Vk" ) )
@ -14341,9 +14386,7 @@ void VulkanHppGenerator::readSPIRVCapabilitiesSPIRVCapabilityEnableProperty(
auto propertyIt = m_structures.find( property ); auto propertyIt = m_structures.find( property );
check( check(
propertyIt != m_structures.end(), xmlLine, "unknown property <" + property + "> specified for SPIR-V capability" ); propertyIt != m_structures.end(), xmlLine, "unknown property <" + property + "> specified for SPIR-V capability" );
auto memberIt = std::find_if( propertyIt->second.members.begin(), auto memberIt = findStructMemberIt( member, propertyIt->second.members );
propertyIt->second.members.end(),
[&member]( MemberData const & md ) { return md.name == member; } );
check( memberIt != propertyIt->second.members.end(), check( memberIt != propertyIt->second.members.end(),
xmlLine, xmlLine,
"unknown member <" + member + "> specified for SPIR-V capability" ); "unknown member <" + member + "> specified for SPIR-V capability" );
@ -15231,10 +15274,7 @@ void VulkanHppGenerator::readTypesTypeStructMember( tinyxml2::XMLElement const *
check( !memberData.len.empty() && ( memberData.len.size() <= 2 ), check( !memberData.len.empty() && ( memberData.len.size() <= 2 ),
line, line,
"member attribute <len> holds unknown number of data: " + std::to_string( memberData.len.size() ) ); "member attribute <len> holds unknown number of data: " + std::to_string( memberData.len.size() ) );
auto lenMember = auto lenMember = findStructMemberIt( memberData.len[0], members );
std::find_if( members.begin(),
members.end(),
[&memberData]( MemberData const & md ) { return ( md.name == memberData.len[0] ); } );
check( lenMember != members.end() || ( memberData.len[0] == "null-terminated" ), check( lenMember != members.end() || ( memberData.len[0] == "null-terminated" ),
line, line,
"member attribute <len> holds unknown value <" + memberData.len[0] + ">" ); "member attribute <len> holds unknown value <" + memberData.len[0] + ">" );
@ -15274,10 +15314,10 @@ void VulkanHppGenerator::readTypesTypeStructMember( tinyxml2::XMLElement const *
else if ( attribute.first == "selector" ) else if ( attribute.first == "selector" )
{ {
memberData.selector = attribute.second; memberData.selector = attribute.second;
std::string const & selector = memberData.selector; auto selectorIt = findStructMemberIt( memberData.selector, members );
auto selectorIt = std::find_if( check( selectorIt != members.end(),
members.begin(), members.end(), [selector]( MemberData const & md ) { return md.name == selector; } ); line,
check( selectorIt != members.end(), line, "member attribute <selector> holds unknown value <" + selector + ">" ); "member attribute <selector> holds unknown value <" + memberData.selector + ">" );
check( m_enums.find( selectorIt->type.type ) != m_enums.end(), check( m_enums.find( selectorIt->type.type ) != m_enums.end(),
line, line,
"member attribute <selector> references unknown enum type <" + selectorIt->type.type + ">" ); "member attribute <selector> references unknown enum type <" + selectorIt->type.type + ">" );
@ -15323,10 +15363,7 @@ void VulkanHppGenerator::readTypesTypeStructMemberName( tinyxml2::XMLElement con
checkElements( line, getChildElements( element ), {}, {} ); checkElements( line, getChildElements( element ), {}, {} );
std::string name = element->GetText(); std::string name = element->GetText();
check( std::find_if( members.begin(), members.end(), [&name]( MemberData const & md ) { return md.name == name; } ) == check( !isStructMember( name, members ), line, "structure member name <" + name + "> already used" );
members.end(),
line,
"structure member name <" + name + "> already used" );
memberData.name = name; memberData.name = name;
std::tie( memberData.arraySizes, memberData.bitCount ) = readModifiers( element->NextSibling() ); std::tie( memberData.arraySizes, memberData.bitCount ) = readModifiers( element->NextSibling() );
@ -16716,6 +16753,18 @@ int main( int argc, char ** argv )
{ {
return flags.operator^( bit ); return flags.operator^( bit );
} }
} // namespace VULKAN_HPP_NAMESPACE
template <typename BitType> struct std::hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
{
std::size_t operator()(VULKAN_HPP_NAMESPACE::Flags<BitType> const& flags) const VULKAN_HPP_NOEXCEPT
{
return std::hash<typename std::underlying_type<BitType>::type>{}(static_cast<typename std::underlying_type<BitType>::type>(flags));
}
};
namespace VULKAN_HPP_NAMESPACE
{
)"; )";
static const std::string classObjectDestroy = R"( static const std::string classObjectDestroy = R"(
@ -17430,6 +17479,11 @@ int main( int argc, char ** argv )
# define VULKAN_HPP_NAMESPACE vk # define VULKAN_HPP_NAMESPACE vk
#endif #endif
#if !defined( VULKAN_HPP_HASH_COMBINE )
# define VULKAN_HPP_HASH_COMBINE( valueType, seed, value ) \
seed ^= std::hash<std::remove_const<valueType>::type>{}( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 )
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text #define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text ) #define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE ) #define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
@ -18162,6 +18216,11 @@ namespace VULKAN_HPP_NAMESPACE
str += generator.generateHandles(); str += generator.generateHandles();
str += R"( str += R"(
} // namespace VULKAN_HPP_NAMESPACE } // namespace VULKAN_HPP_NAMESPACE
namespace std
{)";
str += generator.generateHandleHashStructures();
str += R"(} // namespace std
#endif #endif
)"; )";
writeToFile( str, VULKAN_HANDLES_HPP_FILE ); writeToFile( str, VULKAN_HANDLES_HPP_FILE );
@ -18259,12 +18318,6 @@ namespace VULKAN_HPP_NAMESPACE
str += generator.generateDispatchLoaderDynamic(); str += generator.generateDispatchLoaderDynamic();
str += str +=
"} // namespace VULKAN_HPP_NAMESPACE\n" "} // namespace VULKAN_HPP_NAMESPACE\n"
"\n"
"namespace std\n"
"{\n";
str += generator.generateHashStructures();
str +=
"} // namespace std\n"
"#endif\n"; "#endif\n";
writeToFile( str, VULKAN_HPP_FILE ); writeToFile( str, VULKAN_HPP_FILE );

View File

@ -33,7 +33,7 @@ public:
std::string generateEnums() const; std::string generateEnums() const;
std::string generateFormatTraits() const; std::string generateFormatTraits() const;
std::string generateHandles() const; std::string generateHandles() const;
std::string generateHashStructures() const; std::string generateHandleHashStructures() const;
std::string generateIndexTypeTraits() const; std::string generateIndexTypeTraits() const;
std::string generateRAIICommandDefinitions() const; std::string generateRAIICommandDefinitions() const;
std::string generateRAIIDispatchers() const; std::string generateRAIIDispatchers() const;
@ -435,6 +435,10 @@ private:
std::map<size_t, size_t> determineVectorParamIndices( std::vector<ParamData> const & params ) const; std::map<size_t, size_t> determineVectorParamIndices( std::vector<ParamData> const & params ) const;
void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions ); void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions );
std::string findBaseName( std::string aliasName, std::map<std::string, EnumAliasData> const & aliases ) const; std::string findBaseName( std::string aliasName, std::map<std::string, EnumAliasData> const & aliases ) const;
std::vector<MemberData>::const_iterator findStructMemberIt( std::string const & name,
std::vector<MemberData> const & memberData ) const;
std::vector<MemberData>::const_iterator findStructMemberItByType( std::string const & type,
std::vector<MemberData> const & memberData ) const;
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params, std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams, std::set<size_t> const & skippedParams,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
@ -887,7 +891,8 @@ private:
std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle, std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle,
std::set<std::string> & listedHandles ) const; std::set<std::string> & listedHandles ) const;
std::string generateHandleEmpty( HandleData const & handleData ) const; std::string generateHandleEmpty( HandleData const & handleData ) const;
std::string generateHashStructures( std::vector<RequireData> const & requireData, std::string const & title ) const; std::string generateHandleHashStructures( std::vector<RequireData> const & requireData,
std::string const & title ) const;
std::string std::string
generateLenInitializer( std::vector<MemberData>::const_iterator mit, generateLenInitializer( std::vector<MemberData>::const_iterator mit,
std::map<std::vector<MemberData>::const_iterator, std::map<std::vector<MemberData>::const_iterator,
@ -1213,6 +1218,7 @@ private:
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const; std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
std::string std::string
generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const; generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const;
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const; std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const;
std::string generateStructExtendsStructs( std::vector<RequireData> const & requireData, std::string generateStructExtendsStructs( std::vector<RequireData> const & requireData,
std::set<std::string> & listedStructs, std::set<std::string> & listedStructs,
@ -1248,6 +1254,7 @@ private:
bool isMultiSuccessCodeConstructor( bool isMultiSuccessCodeConstructor(
std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts ) const; std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts ) const;
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const; bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
bool isStructMember( std::string const & name, std::vector<MemberData> const & memberData ) const;
bool isStructureChainAnchor( std::string const & type ) const; bool isStructureChainAnchor( std::string const & type ) const;
std::pair<bool, std::map<size_t, std::vector<size_t>>> std::pair<bool, std::map<size_t, std::vector<size_t>>>
needsVectorSizeCheck( std::map<size_t, size_t> const & vectorParamIndices ) const; needsVectorSizeCheck( std::map<size_t, size_t> const & vectorParamIndices ) const;

View File

@ -48,6 +48,28 @@ int main( int /*argc*/, char ** /*argv*/ )
std::unordered_map<vk::Instance, size_t> umap; std::unordered_map<vk::Instance, size_t> umap;
umap[*instance] = 1; umap[*instance] = 1;
vk::AabbPositionsKHR aabb0, aabb1;
auto h3 = std::hash<vk::AabbPositionsKHR>{}( aabb0 );
auto h4 = std::hash<vk::AabbPositionsKHR>{}( aabb1 );
assert( h3 == h4 );
aabb0.minX = 1.0f;
auto h5 = std::hash<vk::AabbPositionsKHR>{}( aabb0 );
assert( h3 != h5 );
std::unordered_set<vk::AabbPositionsKHR> aabbSet;
aabbSet.insert( aabb0 );
std::unordered_map<vk::AabbPositionsKHR, size_t> aabbMap;
aabbMap[aabb0] = 1;
vk::AccelerationStructureInstanceKHR asi;
asi.instanceCustomIndex = 1;
asi.mask = 2;
asi.instanceShaderBindingTableRecordOffset = 3;
asi.flags = 4;
auto h6 = std::hash<vk::AccelerationStructureInstanceKHR>{}( asi );
} }
catch ( vk::SystemError const & err ) catch ( vk::SystemError const & err )
{ {

View File

@ -234,6 +234,11 @@ static_assert( VK_HEADER_VERSION == 201, "Wrong VK_HEADER_VERSION!" );
# define VULKAN_HPP_NAMESPACE vk # define VULKAN_HPP_NAMESPACE vk
#endif #endif
#if !defined( VULKAN_HPP_HASH_COMBINE )
# define VULKAN_HPP_HASH_COMBINE( valueType, seed, value ) \
seed ^= std::hash<std::remove_const<valueType>::type>{}( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 )
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text #define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text ) #define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE ) #define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
@ -813,7 +818,20 @@ namespace VULKAN_HPP_NAMESPACE
{ {
return flags.operator^( bit ); return flags.operator^( bit );
} }
} // namespace VULKAN_HPP_NAMESPACE
template <typename BitType>
struct std::hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Flags<BitType> const & flags ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<typename std::underlying_type<BitType>::type>{}(
static_cast<typename std::underlying_type<BitType>::type>( flags ) );
}
};
namespace VULKAN_HPP_NAMESPACE
{
template <typename RefType> template <typename RefType>
class Optional class Optional
{ {
@ -14208,486 +14226,4 @@ namespace VULKAN_HPP_NAMESPACE
} }
}; };
} // namespace VULKAN_HPP_NAMESPACE } // namespace VULKAN_HPP_NAMESPACE
namespace std
{
//=======================
//=== HASH structures ===
//=======================
template <typename BitType>
struct hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Flags<BitType> const & flags ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<typename std::underlying_type<BitType>::type>{}(
static_cast<typename std::underlying_type<BitType>::type>( flags ) );
}
};
//=== VK_VERSION_1_0 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::Instance>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Instance const & instance ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkInstance>{}( static_cast<VkInstance>( instance ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PhysicalDevice>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PhysicalDevice const & physicalDevice ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPhysicalDevice>{}( static_cast<VkPhysicalDevice>( physicalDevice ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Device>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Device const & device ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDevice>{}( static_cast<VkDevice>( device ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Queue>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Queue const & queue ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueue>{}( static_cast<VkQueue>( queue ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeviceMemory>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DeviceMemory const & deviceMemory ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeviceMemory>{}( static_cast<VkDeviceMemory>( deviceMemory ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Fence>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Fence const & fence ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFence>{}( static_cast<VkFence>( fence ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Semaphore>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Semaphore const & semaphore ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSemaphore>{}( static_cast<VkSemaphore>( semaphore ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Event>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Event const & event ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkEvent>{}( static_cast<VkEvent>( event ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::QueryPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::QueryPool const & queryPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueryPool>{}( static_cast<VkQueryPool>( queryPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Buffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Buffer const & buffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBuffer>{}( static_cast<VkBuffer>( buffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferView const & bufferView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferView>{}( static_cast<VkBufferView>( bufferView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Image>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Image const & image ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImage>{}( static_cast<VkImage>( image ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ImageView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ImageView const & imageView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImageView>{}( static_cast<VkImageView>( imageView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ShaderModule>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ShaderModule const & shaderModule ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkShaderModule>{}( static_cast<VkShaderModule>( shaderModule ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineCache>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineCache const & pipelineCache ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineCache>{}( static_cast<VkPipelineCache>( pipelineCache ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Pipeline>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Pipeline const & pipeline ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipeline>{}( static_cast<VkPipeline>( pipeline ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineLayout>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineLayout const & pipelineLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineLayout>{}( static_cast<VkPipelineLayout>( pipelineLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Sampler>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Sampler const & sampler ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSampler>{}( static_cast<VkSampler>( sampler ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorPool const & descriptorPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorPool>{}( static_cast<VkDescriptorPool>( descriptorPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSet>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorSet const & descriptorSet ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSet>{}( static_cast<VkDescriptorSet>( descriptorSet ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSetLayout>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DescriptorSetLayout const & descriptorSetLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSetLayout>{}( static_cast<VkDescriptorSetLayout>( descriptorSetLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Framebuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Framebuffer const & framebuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFramebuffer>{}( static_cast<VkFramebuffer>( framebuffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::RenderPass>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::RenderPass const & renderPass ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkRenderPass>{}( static_cast<VkRenderPass>( renderPass ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandPool const & commandPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandPool>{}( static_cast<VkCommandPool>( commandPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandBuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandBuffer const & commandBuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandBuffer>{}( static_cast<VkCommandBuffer>( commandBuffer ) );
}
};
//=== VK_VERSION_1_1 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion const & samplerYcbcrConversion ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSamplerYcbcrConversion>{}( static_cast<VkSamplerYcbcrConversion>( samplerYcbcrConversion ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate const & descriptorUpdateTemplate ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorUpdateTemplate>{}(
static_cast<VkDescriptorUpdateTemplate>( descriptorUpdateTemplate ) );
}
};
//=== VK_KHR_surface ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SurfaceKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SurfaceKHR const & surfaceKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSurfaceKHR>{}( static_cast<VkSurfaceKHR>( surfaceKHR ) );
}
};
//=== VK_KHR_swapchain ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SwapchainKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SwapchainKHR const & swapchainKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSwapchainKHR>{}( static_cast<VkSwapchainKHR>( swapchainKHR ) );
}
};
//=== VK_KHR_display ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayKHR const & displayKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayKHR>{}( static_cast<VkDisplayKHR>( displayKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayModeKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayModeKHR const & displayModeKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayModeKHR>{}( static_cast<VkDisplayModeKHR>( displayModeKHR ) );
}
};
//=== VK_EXT_debug_report ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT const & debugReportCallbackEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugReportCallbackEXT>{}( static_cast<VkDebugReportCallbackEXT>( debugReportCallbackEXT ) );
}
};
#if defined( VK_ENABLE_BETA_EXTENSIONS )
//=== VK_KHR_video_queue ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionKHR const & videoSessionKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionKHR>{}( static_cast<VkVideoSessionKHR>( videoSessionKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR const & videoSessionParametersKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionParametersKHR>{}(
static_cast<VkVideoSessionParametersKHR>( videoSessionParametersKHR ) );
}
};
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
//=== VK_NVX_binary_import ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuModuleNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuModuleNVX const & cuModuleNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuModuleNVX>{}( static_cast<VkCuModuleNVX>( cuModuleNVX ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuFunctionNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuFunctionNVX const & cuFunctionNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuFunctionNVX>{}( static_cast<VkCuFunctionNVX>( cuFunctionNVX ) );
}
};
//=== VK_EXT_debug_utils ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT const & debugUtilsMessengerEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugUtilsMessengerEXT>{}( static_cast<VkDebugUtilsMessengerEXT>( debugUtilsMessengerEXT ) );
}
};
//=== VK_KHR_acceleration_structure ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureKHR const & accelerationStructureKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureKHR>{}(
static_cast<VkAccelerationStructureKHR>( accelerationStructureKHR ) );
}
};
//=== VK_EXT_validation_cache ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::ValidationCacheEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::ValidationCacheEXT const & validationCacheEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkValidationCacheEXT>{}( static_cast<VkValidationCacheEXT>( validationCacheEXT ) );
}
};
//=== VK_NV_ray_tracing ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureNV const & accelerationStructureNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureNV>{}(
static_cast<VkAccelerationStructureNV>( accelerationStructureNV ) );
}
};
//=== VK_INTEL_performance_query ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL const & performanceConfigurationINTEL )
const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPerformanceConfigurationINTEL>{}(
static_cast<VkPerformanceConfigurationINTEL>( performanceConfigurationINTEL ) );
}
};
//=== VK_KHR_deferred_host_operations ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeferredOperationKHR>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DeferredOperationKHR const & deferredOperationKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeferredOperationKHR>{}( static_cast<VkDeferredOperationKHR>( deferredOperationKHR ) );
}
};
//=== VK_NV_device_generated_commands ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV const & indirectCommandsLayoutNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkIndirectCommandsLayoutNV>{}(
static_cast<VkIndirectCommandsLayoutNV>( indirectCommandsLayoutNV ) );
}
};
//=== VK_EXT_private_data ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT const & privateDataSlotEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPrivateDataSlotEXT>{}( static_cast<VkPrivateDataSlotEXT>( privateDataSlotEXT ) );
}
};
#if defined( VK_USE_PLATFORM_FUCHSIA )
//=== VK_FUCHSIA_buffer_collection ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA const & bufferCollectionFUCHSIA ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferCollectionFUCHSIA>{}(
static_cast<VkBufferCollectionFUCHSIA>( bufferCollectionFUCHSIA ) );
}
};
#endif /*VK_USE_PLATFORM_FUCHSIA*/
} // namespace std
#endif #endif

View File

@ -14531,4 +14531,476 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
} // namespace VULKAN_HPP_NAMESPACE } // namespace VULKAN_HPP_NAMESPACE
namespace std
{
//=======================
//=== HASH structures ===
//=======================
//=== VK_VERSION_1_0 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::Instance>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Instance const & instance ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkInstance>{}( static_cast<VkInstance>( instance ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PhysicalDevice>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PhysicalDevice const & physicalDevice ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPhysicalDevice>{}( static_cast<VkPhysicalDevice>( physicalDevice ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Device>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Device const & device ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDevice>{}( static_cast<VkDevice>( device ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Queue>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Queue const & queue ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueue>{}( static_cast<VkQueue>( queue ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeviceMemory>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DeviceMemory const & deviceMemory ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeviceMemory>{}( static_cast<VkDeviceMemory>( deviceMemory ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Fence>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Fence const & fence ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFence>{}( static_cast<VkFence>( fence ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Semaphore>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Semaphore const & semaphore ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSemaphore>{}( static_cast<VkSemaphore>( semaphore ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Event>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Event const & event ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkEvent>{}( static_cast<VkEvent>( event ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::QueryPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::QueryPool const & queryPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueryPool>{}( static_cast<VkQueryPool>( queryPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Buffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Buffer const & buffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBuffer>{}( static_cast<VkBuffer>( buffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferView const & bufferView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferView>{}( static_cast<VkBufferView>( bufferView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Image>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Image const & image ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImage>{}( static_cast<VkImage>( image ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ImageView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ImageView const & imageView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImageView>{}( static_cast<VkImageView>( imageView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ShaderModule>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ShaderModule const & shaderModule ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkShaderModule>{}( static_cast<VkShaderModule>( shaderModule ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineCache>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineCache const & pipelineCache ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineCache>{}( static_cast<VkPipelineCache>( pipelineCache ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Pipeline>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Pipeline const & pipeline ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipeline>{}( static_cast<VkPipeline>( pipeline ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineLayout>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineLayout const & pipelineLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineLayout>{}( static_cast<VkPipelineLayout>( pipelineLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Sampler>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Sampler const & sampler ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSampler>{}( static_cast<VkSampler>( sampler ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorPool const & descriptorPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorPool>{}( static_cast<VkDescriptorPool>( descriptorPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSet>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorSet const & descriptorSet ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSet>{}( static_cast<VkDescriptorSet>( descriptorSet ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSetLayout>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DescriptorSetLayout const & descriptorSetLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSetLayout>{}( static_cast<VkDescriptorSetLayout>( descriptorSetLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Framebuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Framebuffer const & framebuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFramebuffer>{}( static_cast<VkFramebuffer>( framebuffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::RenderPass>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::RenderPass const & renderPass ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkRenderPass>{}( static_cast<VkRenderPass>( renderPass ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandPool const & commandPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandPool>{}( static_cast<VkCommandPool>( commandPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandBuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandBuffer const & commandBuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandBuffer>{}( static_cast<VkCommandBuffer>( commandBuffer ) );
}
};
//=== VK_VERSION_1_1 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion const & samplerYcbcrConversion ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSamplerYcbcrConversion>{}( static_cast<VkSamplerYcbcrConversion>( samplerYcbcrConversion ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate const & descriptorUpdateTemplate ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorUpdateTemplate>{}(
static_cast<VkDescriptorUpdateTemplate>( descriptorUpdateTemplate ) );
}
};
//=== VK_KHR_surface ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SurfaceKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SurfaceKHR const & surfaceKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSurfaceKHR>{}( static_cast<VkSurfaceKHR>( surfaceKHR ) );
}
};
//=== VK_KHR_swapchain ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SwapchainKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SwapchainKHR const & swapchainKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSwapchainKHR>{}( static_cast<VkSwapchainKHR>( swapchainKHR ) );
}
};
//=== VK_KHR_display ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayKHR const & displayKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayKHR>{}( static_cast<VkDisplayKHR>( displayKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayModeKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayModeKHR const & displayModeKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayModeKHR>{}( static_cast<VkDisplayModeKHR>( displayModeKHR ) );
}
};
//=== VK_EXT_debug_report ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT const & debugReportCallbackEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugReportCallbackEXT>{}( static_cast<VkDebugReportCallbackEXT>( debugReportCallbackEXT ) );
}
};
#if defined( VK_ENABLE_BETA_EXTENSIONS )
//=== VK_KHR_video_queue ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionKHR const & videoSessionKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionKHR>{}( static_cast<VkVideoSessionKHR>( videoSessionKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR const & videoSessionParametersKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionParametersKHR>{}(
static_cast<VkVideoSessionParametersKHR>( videoSessionParametersKHR ) );
}
};
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
//=== VK_NVX_binary_import ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuModuleNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuModuleNVX const & cuModuleNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuModuleNVX>{}( static_cast<VkCuModuleNVX>( cuModuleNVX ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuFunctionNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuFunctionNVX const & cuFunctionNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuFunctionNVX>{}( static_cast<VkCuFunctionNVX>( cuFunctionNVX ) );
}
};
//=== VK_EXT_debug_utils ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT const & debugUtilsMessengerEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugUtilsMessengerEXT>{}( static_cast<VkDebugUtilsMessengerEXT>( debugUtilsMessengerEXT ) );
}
};
//=== VK_KHR_acceleration_structure ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureKHR const & accelerationStructureKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureKHR>{}(
static_cast<VkAccelerationStructureKHR>( accelerationStructureKHR ) );
}
};
//=== VK_EXT_validation_cache ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::ValidationCacheEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::ValidationCacheEXT const & validationCacheEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkValidationCacheEXT>{}( static_cast<VkValidationCacheEXT>( validationCacheEXT ) );
}
};
//=== VK_NV_ray_tracing ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureNV const & accelerationStructureNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureNV>{}(
static_cast<VkAccelerationStructureNV>( accelerationStructureNV ) );
}
};
//=== VK_INTEL_performance_query ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL const & performanceConfigurationINTEL )
const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPerformanceConfigurationINTEL>{}(
static_cast<VkPerformanceConfigurationINTEL>( performanceConfigurationINTEL ) );
}
};
//=== VK_KHR_deferred_host_operations ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeferredOperationKHR>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DeferredOperationKHR const & deferredOperationKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeferredOperationKHR>{}( static_cast<VkDeferredOperationKHR>( deferredOperationKHR ) );
}
};
//=== VK_NV_device_generated_commands ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV const & indirectCommandsLayoutNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkIndirectCommandsLayoutNV>{}(
static_cast<VkIndirectCommandsLayoutNV>( indirectCommandsLayoutNV ) );
}
};
//=== VK_EXT_private_data ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT const & privateDataSlotEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPrivateDataSlotEXT>{}( static_cast<VkPrivateDataSlotEXT>( privateDataSlotEXT ) );
}
};
#if defined( VK_USE_PLATFORM_FUCHSIA )
//=== VK_FUCHSIA_buffer_collection ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA const & bufferCollectionFUCHSIA ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferCollectionFUCHSIA>{}(
static_cast<VkBufferCollectionFUCHSIA>( bufferCollectionFUCHSIA ) );
}
};
#endif /*VK_USE_PLATFORM_FUCHSIA*/
} // namespace std
#endif #endif

File diff suppressed because it is too large Load Diff