diff options
Diffstat (limited to 'src/gui/vulkan/qvulkaninstance.cpp')
-rw-r--r-- | src/gui/vulkan/qvulkaninstance.cpp | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp index 83d1e9b1b5..6d3020d62d 100644 --- a/src/gui/vulkan/qvulkaninstance.cpp +++ b/src/gui/vulkan/qvulkaninstance.cpp @@ -12,6 +12,7 @@ QT_BEGIN_NAMESPACE /*! \class QVulkanInstance \since 5.10 + \ingroup painting-3D \inmodule QtGui \brief The QVulkanInstance class represents a native Vulkan instance, enabling @@ -206,6 +207,7 @@ QT_BEGIN_NAMESPACE the behavior of create(). \value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_utils}) redirection to qDebug. + \value [since 6.5] NoPortabilityDrivers Disables enumerating physical devices marked as Vulkan Portability. */ bool QVulkanInstancePrivate::ensureVulkan() @@ -243,7 +245,8 @@ QVulkanInstance::QVulkanInstance() /*! Destructor. - \note current() will return \nullptr once the instance is destroyed. + \note \l {QVulkanInstance::}{vkInstance()} will return \nullptr once the + instance is destroyed. */ QVulkanInstance::~QVulkanInstance() { @@ -478,9 +481,14 @@ void QVulkanInstance::setLayers(const QByteArrayList &layers) /*! Specifies the list of additional instance \a extensions to enable. It is safe to specify unsupported extensions as well because these get ignored - when not supported at run time. The surface-related extensions required by - Qt will always be added automatically, no need to include them in this - list. + when not supported at run time. + + \note The surface-related extensions required by Qt (for example, \c + VK_KHR_win32_surface) will always be added automatically, no need to + include them in this list. + + \note \c VK_KHR_portability_enumeration is added automatically unless the + NoPortabilityDrivers flag is set. This value was introduced in Qt 6.5. \note This function can only be called before create() and has no effect if called afterwards. @@ -533,11 +541,16 @@ void QVulkanInstance::setApiVersion(const QVersionNumber &vulkanVersion) \return true if successful, false on error or when Vulkan is not supported. - When successful, the pointer to this QVulkanInstance is retrievable via the - static function current(). + When successful, the pointer to this QVulkanInstance is retrievable via + \l {QVulkanInstance::}{vkInstance()}. The Vulkan instance and library is available as long as this QVulkanInstance exists, or until destroy() is called. + + By default the VkInstance is created with the flag + \l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html}{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR} + set. This means that Vulkan Portability physical devices get enumerated as + well. If this is not desired, set the NoPortabilityDrivers flag. */ bool QVulkanInstance::create() { @@ -556,6 +569,7 @@ bool QVulkanInstance::create() d_ptr->errorCode = VK_SUCCESS; d_ptr->funcs.reset(new QVulkanFunctions(this)); d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters); + d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters); return true; } @@ -810,7 +824,12 @@ void QVulkanInstance::presentQueued(QWindow *window) /*! \typedef QVulkanInstance::DebugFilter - Typedef for debug filtering callback functions. + Typedef for debug filtering callback functions, with the following signature: + + \code + bool myDebugFilter(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, + size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage) + \endcode Returning \c true suppresses the printing of the message. @@ -867,9 +886,16 @@ void QVulkanInstance::removeDebugOutputFilter(DebugFilter filter) /*! \typedef QVulkanInstance::DebugUtilsFilter - Typedef for debug filtering callback functions. The \c callbackData - argument is a pointer to the VkDebugUtilsMessengerCallbackDataEXT - structure. + Typedef for debug filtering callback functions, with the following signature: + + \code + std::function<bool(DebugMessageSeverityFlags severity, DebugMessageTypeFlags type, const void *message)>; + \endcode + + The \c message argument is a pointer to the + VkDebugUtilsMessengerCallbackDataEXT structure. Refer to the documentation + of \c{VK_EXT_debug_utils} for details. The Qt headers do not use the real + type in order to avoid introducing a dependency on post-1.0 Vulkan headers. Returning \c true suppresses the printing of the message. @@ -906,20 +932,18 @@ void QVulkanInstance::removeDebugOutputFilter(DebugFilter filter) \note This function can be called before create(). - \sa removeDebugOutputFilter() + \sa clearDebugOutputFilters() \since 6.5 */ void QVulkanInstance::installDebugOutputFilter(DebugUtilsFilter filter) { - if (!d_ptr->debugUtilsFilters.contains(filter)) { - d_ptr->debugUtilsFilters.append(filter); - if (d_ptr->platformInst) - d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters); - } + d_ptr->debugUtilsFilters.append(filter); + if (d_ptr->platformInst) + d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters); } /*! - Removes a \a filter function previously installed by + Removes all filter functions installed previously by installDebugOutputFilter(). \note This function can be called before create(). @@ -927,11 +951,14 @@ void QVulkanInstance::installDebugOutputFilter(DebugUtilsFilter filter) \sa installDebugOutputFilter() \since 6.5 */ -void QVulkanInstance::removeDebugOutputFilter(DebugUtilsFilter filter) +void QVulkanInstance::clearDebugOutputFilters() { - d_ptr->debugUtilsFilters.removeOne(filter); - if (d_ptr->platformInst) + d_ptr->debugFilters.clear(); + d_ptr->debugUtilsFilters.clear(); + if (d_ptr->platformInst) { + d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters); d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters); + } } #ifndef QT_NO_DEBUG_STREAM |