mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Generate std::hash specializations into the new file vulkan_hash.hpp, requiring C++14 for std::hash specializations of the vulkan structures.
This commit is contained in:
parent
80dada6a7b
commit
cdb64cdefd
@ -91,6 +91,8 @@ file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp vulka
|
||||
string(REPLACE "\\" "\\\\" vulkan_handles_hpp ${vulkan_handles_hpp})
|
||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp vulkan_structs_hpp)
|
||||
string(REPLACE "\\" "\\\\" vulkan_structs_hpp ${vulkan_structs_hpp})
|
||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp vulkan_hash_hpp)
|
||||
string(REPLACE "\\" "\\\\" vulkan_hash_hpp ${vulkan_hash_hpp})
|
||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp vulkan_raii_hpp)
|
||||
string(REPLACE "\\" "\\\\" vulkan_raii_hpp ${vulkan_raii_hpp})
|
||||
add_definitions(-DVULKAN_HPP_FILE="${vulkan_hpp}"
|
||||
@ -98,6 +100,7 @@ add_definitions(-DVULKAN_HPP_FILE="${vulkan_hpp}"
|
||||
-DVULKAN_FUNCS_HPP_FILE="${vulkan_funcs_hpp}"
|
||||
-DVULKAN_HANDLES_HPP_FILE="${vulkan_handles_hpp}"
|
||||
-DVULKAN_STRUCTS_HPP_FILE="${vulkan_structs_hpp}"
|
||||
-DVULKAN_HASH_HPP_FILE="${vulkan_hash_hpp}"
|
||||
-DVULKAN_RAII_HPP_FILE="${vulkan_raii_hpp}")
|
||||
include_directories(${VulkanHeaders_INCLUDE_DIR})
|
||||
|
||||
|
@ -531,9 +531,13 @@ vulkan.hpp provides a couple of trait functions on `vk::Format`. With C++14 and
|
||||
Gets a single-plane format compatible with this plane.
|
||||
- `uint8_t planeHeightDivisor( vk::Format format, uint8_t plane );`
|
||||
Gets the relative height of this plane. A value of k means that this plane is 1/k the height of the overall format.
|
||||
- `uint8_t planeWidthDivisor( vk::Format format, uint8_t plane );`
|
||||
- Cuint8_t planeWidthDivisor( vk::Format format, uint8_t plane );`
|
||||
Gets the relative width of this plane. A value of k means that this plane is 1/k the width of the overall format.
|
||||
|
||||
### Hashing Vulkan types
|
||||
|
||||
With the additional header `vulkan_hash.hpp`, you get specializations of `std::hash` for the handle wrapper classes and, with C++14, for the structure wrappers. With `VULKAN_HPP_HASH_COMBINE`, you can define your own hash combining algorithm for the structure elements.
|
||||
|
||||
### Samples and Tests
|
||||
|
||||
When you configure your project using CMake, you can enable SAMPLES_BUILD to add some sample projects to your solution. Most of them are ports from the LunarG samples, but there are some more, like CreateDebugUtilsMessenger, InstanceVersion, PhysicalDeviceDisplayProperties, PhysicalDeviceExtensions, PhysicalDeviceFeatures, PhysicalDeviceGroups, PhysicalDeviceMemoryProperties, PhysicalDeviceProperties, PhysicalDeviceQueueFamilyProperties, and RayTracing. All those samples should just compile and run.
|
||||
|
@ -703,9 +703,9 @@ std::string VulkanHppGenerator::generateHandles() const
|
||||
std::string VulkanHppGenerator::generateHandleHashStructures() const
|
||||
{
|
||||
const std::string hashesTemplate = R"(
|
||||
//=======================
|
||||
//=== HASH structures ===
|
||||
//=======================
|
||||
//===================================
|
||||
//=== HASH structures for handles ===
|
||||
//===================================
|
||||
|
||||
${hashes}
|
||||
)";
|
||||
@ -1018,6 +1018,36 @@ ${forwardDeclarations}
|
||||
return replaceWithMap( fowardDeclarationsTemplate, { { "forwardDeclarations", forwardDeclarations } } );
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructHashStructures() const
|
||||
{
|
||||
const std::string hashesTemplate = R"(
|
||||
#if 14 <= VULKAN_HPP_CPP_VERSION
|
||||
//======================================
|
||||
//=== HASH structures for structures ===
|
||||
//======================================
|
||||
|
||||
# if !defined( VULKAN_HPP_HASH_COMBINE )
|
||||
# define VULKAN_HPP_HASH_COMBINE( seed, value ) \
|
||||
seed ^= std::hash<std::decay<decltype( value )>::type>{}( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 )
|
||||
# endif
|
||||
|
||||
${hashes}
|
||||
#endif // 14 <= VULKAN_HPP_CPP_VERSION
|
||||
)";
|
||||
|
||||
// Note reordering structs or handles by features and extensions is not possible!
|
||||
std::set<std::string> listedStructs;
|
||||
std::string hashes;
|
||||
for ( auto const & structure : m_structures )
|
||||
{
|
||||
if ( listedStructs.find( structure.first ) == listedStructs.end() )
|
||||
{
|
||||
hashes += generateStructHashStructure( structure, listedStructs );
|
||||
}
|
||||
}
|
||||
return replaceWithMap( hashesTemplate, { { "hashes", hashes } } );
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructs() const
|
||||
{
|
||||
const std::string structsTemplate = R"(
|
||||
@ -11903,6 +11933,53 @@ std::string VulkanHppGenerator::generateStructConstructorArgument( bool
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructHashStructure( std::pair<std::string, StructureData> const & structure,
|
||||
std::set<std::string> & listedStructs ) const
|
||||
{
|
||||
assert( listedStructs.find( structure.first ) == listedStructs.end() );
|
||||
|
||||
std::string str;
|
||||
for ( auto const & member : structure.second.members )
|
||||
{
|
||||
auto structIt = m_structures.find( member.type.type );
|
||||
if ( ( structIt != m_structures.end() ) && ( structure.first != member.type.type ) &&
|
||||
( listedStructs.find( member.type.type ) == listedStructs.end() ) )
|
||||
{
|
||||
str += generateStructHashStructure( *structIt, listedStructs );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !containsUnion( structure.first ) )
|
||||
{
|
||||
static const std::string hashTemplate = R"(
|
||||
${enter}template <> struct 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;
|
||||
}
|
||||
};
|
||||
${leave})";
|
||||
|
||||
auto [enter, leave] = generateProtection(
|
||||
structure.first, m_structureAliasesInverse.find( structure.first ) != m_structureAliasesInverse.end() );
|
||||
|
||||
std::string structureType = stripPrefix( structure.first, "Vk" );
|
||||
std::string structureName = startLowerCase( structureType );
|
||||
str += replaceWithMap( hashTemplate,
|
||||
{ { "enter", enter },
|
||||
{ "hashSum", generateStructHashSum( structureName, structure.second.members ) },
|
||||
{ "leave", leave },
|
||||
{ "structureName", structureName },
|
||||
{ "structureType", structureType } } );
|
||||
}
|
||||
|
||||
listedStructs.insert( structure.first );
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateStructHashSum( std::string const & structName,
|
||||
std::vector<MemberData> const & members ) const
|
||||
{
|
||||
@ -11912,19 +11989,18 @@ std::string VulkanHppGenerator::generateStructHashSum( std::string const &
|
||||
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";
|
||||
" 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( " + memberType + ", seed, " + structName + "." + member.name +
|
||||
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name +
|
||||
"[i][j] );\n";
|
||||
hashSum += " }\n";
|
||||
}
|
||||
@ -11932,9 +12008,7 @@ std::string VulkanHppGenerator::generateStructHashSum( std::string const &
|
||||
}
|
||||
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";
|
||||
hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + " );\n";
|
||||
}
|
||||
}
|
||||
assert( !hashSum.empty() );
|
||||
@ -12044,32 +12118,6 @@ ${members}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
return str;
|
||||
}
|
||||
@ -16761,18 +16809,6 @@ int main( int argc, char ** argv )
|
||||
{
|
||||
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"(
|
||||
@ -17487,11 +17523,6 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
# define VULKAN_HPP_NAMESPACE vk
|
||||
#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_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
|
||||
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
|
||||
@ -18205,7 +18236,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
str += generator.generateIndexTypeTraits();
|
||||
str += generator.generateBitmasks();
|
||||
str += R"(
|
||||
} // namespace VULKAN_HPP_NAMESPACE
|
||||
} // namespace VULKAN_HPP_NAMESPACE
|
||||
#endif
|
||||
)";
|
||||
writeToFile( str, VULKAN_ENUMS_HPP_FILE );
|
||||
@ -18224,11 +18255,6 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
str += generator.generateHandles();
|
||||
str += R"(
|
||||
} // namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
namespace std
|
||||
{)";
|
||||
str += generator.generateHandleHashStructures();
|
||||
str += R"(} // namespace std
|
||||
#endif
|
||||
)";
|
||||
writeToFile( str, VULKAN_HANDLES_HPP_FILE );
|
||||
@ -18330,6 +18356,39 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
writeToFile( str, VULKAN_HPP_FILE );
|
||||
|
||||
std::cout << "VulkanHppGenerator: Generating " << VULKAN_HASH_HPP_FILE << "..." << std::endl;
|
||||
str.clear();
|
||||
str = generator.getVulkanLicenseHeader();
|
||||
str += +R"(
|
||||
#ifndef VULKAN_HASH_HPP
|
||||
# define VULKAN_HASH_HPP
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
namespace std
|
||||
{
|
||||
//=======================================
|
||||
//=== HASH structures for Flags types ===
|
||||
//=======================================
|
||||
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
)";
|
||||
str += generator.generateHandleHashStructures();
|
||||
str += generator.generateStructHashStructures();
|
||||
str += R"(
|
||||
} // namespace std
|
||||
#endif // VULKAN_HASH_HPP
|
||||
)";
|
||||
writeToFile( str, VULKAN_HASH_HPP_FILE );
|
||||
|
||||
std::cout << "VulkanHppGenerator: Generating " << VULKAN_RAII_HPP_FILE << " ..." << std::endl;
|
||||
str.clear();
|
||||
str = generator.getVulkanLicenseHeader() + R"(
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
std::string generateResultExceptions() const;
|
||||
std::string generateStructExtendsStructs() const;
|
||||
std::string generateStructForwardDeclarations() const;
|
||||
std::string generateStructHashStructures() const;
|
||||
std::string generateStructs() const;
|
||||
std::string generateThrowResultException() const;
|
||||
std::string const & getTypesafeCheck() const;
|
||||
@ -1218,6 +1219,8 @@ private:
|
||||
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string
|
||||
generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const;
|
||||
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure,
|
||||
std::set<std::string> & listedStructs ) 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 generateStructExtendsStructs( std::vector<RequireData> const & requireData,
|
||||
|
@ -23,7 +23,7 @@
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include "vulkan/vulkan_hash.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
@ -49,6 +49,10 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
std::unordered_map<vk::Instance, size_t> umap;
|
||||
umap[*instance] = 1;
|
||||
|
||||
vk::FormatFeatureFlags fff;
|
||||
auto hf = std::hash<vk::FormatFeatureFlags>{}( fff );
|
||||
|
||||
#if 14 <= VULKAN_HPP_CPP_VERSION
|
||||
vk::AabbPositionsKHR aabb0, aabb1;
|
||||
auto h3 = std::hash<vk::AabbPositionsKHR>{}( aabb0 );
|
||||
auto h4 = std::hash<vk::AabbPositionsKHR>{}( aabb1 );
|
||||
@ -64,12 +68,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
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 );
|
||||
vk::AccelerationStructureBuildSizesInfoKHR asbsi;
|
||||
auto h6 = std::hash<vk::AccelerationStructureBuildSizesInfoKHR>{}( asbsi );
|
||||
#endif
|
||||
}
|
||||
catch ( vk::SystemError const & err )
|
||||
{
|
||||
|
@ -234,11 +234,6 @@ static_assert( VK_HEADER_VERSION == 202, "Wrong VK_HEADER_VERSION!" );
|
||||
# define VULKAN_HPP_NAMESPACE vk
|
||||
#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_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
|
||||
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
|
||||
@ -818,20 +813,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
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>
|
||||
class Optional
|
||||
{
|
||||
|
@ -14531,476 +14531,4 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
|
||||
} // 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
|
||||
|
12959
vulkan/vulkan_hash.hpp
Normal file
12959
vulkan/vulkan_hash.hpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user