diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/vulkan/qvulkaninstance.cpp | 56 | ||||
-rw-r--r-- | src/gui/vulkan/qvulkaninstance.h | 44 |
2 files changed, 84 insertions, 16 deletions
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp index c2ec5eccc1..8f364328d6 100644 --- a/src/gui/vulkan/qvulkaninstance.cpp +++ b/src/gui/vulkan/qvulkaninstance.cpp @@ -429,11 +429,31 @@ QVulkanInstance::~QVulkanInstance() */ /*! - \fn bool QVulkanLayer::operator==(const QVulkanLayer &other) const + \fn bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) + \since 5.10 + \relates QVulkanLayer - Returns true if this Vulkan layer and the \a other Vulkan layer have - the same name, version, and spec version. - */ + Returns \c true if Vulkan layers \a lhs and \a rhs have + the same name, version, and spec version. +*/ + +/*! + \fn bool operator!=(const QVulkanLayer &lhs, const QVulkanLayer &rhs) + \since 5.10 + \relates QVulkanLayer + + Returns \c true if Vulkan layers \a lhs and \a rhs have + different name, version, or spec version. +*/ + +/*! + \fn uint qHash(const QVulkanLayer &key, uint seed) + \since 5.10 + \relates QVulkanLayer + + Returns the hash value for the \a key, using \a seed to seed the + calculation. +*/ /*! \class QVulkanExtension @@ -452,11 +472,31 @@ QVulkanInstance::~QVulkanInstance() */ /*! - \fn bool QVulkanExtension::operator==(const QVulkanExtension &other) const + \fn bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs) + \since 5.10 + \relates QVulkanExtension - Returns true if the name and version of this Vulkan extension are the same - as the name and version of the \a other Vulkan extension. - */ + Returns \c true if Vulkan extensions \a lhs and \a rhs are have the + same name and version. +*/ + +/*! + \fn bool operator!=(const QVulkanExtension &lhs, const QVulkanExtension &rhs) + \since 5.10 + \relates QVulkanExtension + + Returns \c true if Vulkan extensions \a lhs and \a rhs are have different + name or version. +*/ + +/*! + \fn uint qHash(const QVulkanExtension &key, uint seed) + \since 5.10 + \relates QVulkanExtension + + Returns the hash value for the \a key, using \a seed to seed the + calculation. +*/ /*! \class QVulkanInfoVector diff --git a/src/gui/vulkan/qvulkaninstance.h b/src/gui/vulkan/qvulkaninstance.h index a373ceffde..ada297be43 100644 --- a/src/gui/vulkan/qvulkaninstance.h +++ b/src/gui/vulkan/qvulkaninstance.h @@ -56,6 +56,7 @@ typedef unsigned long VkImage; typedef unsigned long VkImageView; #endif +#include <QtCore/qhashfunctions.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qvector.h> #include <QtCore/qbytearraylist.h> @@ -70,25 +71,52 @@ class QVulkanFunctions; class QVulkanDeviceFunctions; class QWindow; -struct Q_GUI_EXPORT QVulkanLayer +struct QVulkanLayer { QByteArray name; uint32_t version; QVersionNumber specVersion; QByteArray description; - bool operator==(const QVulkanLayer &other) const { - return name == other.name && version == other.version && specVersion == other.specVersion; - } }; +Q_DECLARE_TYPEINFO(QVulkanLayer, Q_MOVABLE_TYPE); + +inline bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) Q_DECL_NOTHROW +{ + return lhs.name == rhs.name && lhs.version == rhs.version && lhs.specVersion == rhs.specVersion; +} +inline bool operator!=(const QVulkanLayer &lhs, const QVulkanLayer &rhs) Q_DECL_NOTHROW +{ return !(lhs == rhs); } -struct Q_GUI_EXPORT QVulkanExtension +inline uint qHash(const QVulkanLayer &key, uint seed = 0) Q_DECL_NOTHROW +{ + QtPrivate::QHashCombine hash; + seed = hash(seed, key.name); + seed = hash(seed, key.version); + seed = hash(seed, key.specVersion); + return seed; +} + +struct QVulkanExtension { QByteArray name; uint32_t version; - bool operator==(const QVulkanExtension &other) const { - return name == other.name && version == other.version; - } }; +Q_DECLARE_TYPEINFO(QVulkanExtension, Q_MOVABLE_TYPE); + +inline bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs) Q_DECL_NOTHROW +{ + return lhs.name == rhs.name && lhs.version == rhs.version; +} +inline bool operator!=(const QVulkanExtension &lhs, const QVulkanExtension &rhs) Q_DECL_NOTHROW +{ return !(lhs == rhs); } + +inline uint qHash(const QVulkanExtension &key, uint seed = 0) Q_DECL_NOTHROW +{ + QtPrivate::QHashCombine hash; + seed = hash(seed, key.name); + seed = hash(seed, key.version); + return seed; +} #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QVulkanLayer &); |