diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-04-08 17:05:28 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-05-28 17:48:04 +0200 |
commit | e85aa551ebe5f882c9771dc3ea2b90b02b286a49 (patch) | |
tree | 58bd3614262fc7b931e8c3422f481d6fc7e1ac99 /src/gui/vulkan/qvulkaninstance.cpp | |
parent | 548513a4bd050d3df0a85fed6e2d1a00ce06d2ab (diff) |
vulkan: Add debug message filtering
[ChangeLog][QtGui] Added support for filtering Vulkan debug messages in
QVulkanInstance. This is especially useful for processing or suppressing
messages from the validation layers.
Change-Id: Idf0d7889085948daf5b1a53d2a9b11081e967609
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/gui/vulkan/qvulkaninstance.cpp')
-rw-r--r-- | src/gui/vulkan/qvulkaninstance.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp index 2941bfd01f..0605d88cca 100644 --- a/src/gui/vulkan/qvulkaninstance.cpp +++ b/src/gui/vulkan/qvulkaninstance.cpp @@ -269,6 +269,7 @@ public: VkResult errorCode; QScopedPointer<QVulkanFunctions> funcs; QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs; + QVector<QVulkanInstance::DebugFilter> debugFilters; }; bool QVulkanInstancePrivate::ensureVulkan() @@ -570,6 +571,7 @@ bool QVulkanInstance::create() d_ptr->extensions = d_ptr->platformInst->enabledExtensions(); d_ptr->errorCode = VK_SUCCESS; d_ptr->funcs.reset(new QVulkanFunctions(this)); + d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters); return true; } @@ -785,6 +787,50 @@ void QVulkanInstance::presentQueued(QWindow *window) d_ptr->platformInst->presentQueued(window); } +/*! + \typedef QVulkanInstance::DebugFilter + + Typedef for debug filtering callback functions. + + \sa installDebugOutputFilter(), removeDebugOutputFilter() + */ + +/*! + Installs a \a filter function that is called for every Vulkan debug + message. When the callback returns \c true, the message is stopped (filtered + out) and will not appear on the debug output. + + \note Filtering is only effective when NoDebugOutputRedirect is not + \l{setFlags()}{set}. Installing filters has no effect otherwise. + + \note This function can be called before create(). + + \sa removeDebugOutputFilter() + */ +void QVulkanInstance::installDebugOutputFilter(DebugFilter filter) +{ + if (!d_ptr->debugFilters.contains(filter)) { + d_ptr->debugFilters.append(filter); + if (d_ptr->platformInst) + d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters); + } +} + +/*! + Removes a \a filter function previously installed by + installDebugOutputFilter(). + + \note This function can be called before create(). + + \sa installDebugOutputFilter() + */ +void QVulkanInstance::removeDebugOutputFilter(DebugFilter filter) +{ + d_ptr->debugFilters.removeOne(filter); + if (d_ptr->platformInst) + d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters); +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QVulkanLayer &layer) { |