summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-08-01 14:50:23 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-08-07 22:08:52 +0200
commitd468978d505d785b566bec88817a9c1a4a4a5be9 (patch)
treebe182226d5a29224c4fb1660761b8b85a63b498a /src/gui
parenteab533ae0db2cd3c9fe469b71632fedb030b6be1 (diff)
rhi: Print the type of the resources in the leak check
Also clarify what this check includes (backends are expected to register only QRhiResource instances that actually own native graphics objects - the ones that don't are not included in the leak checking) Change-Id: If0f43b302b148f043391fa7fd7bb77cfc8d93b79 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/rhi/qrhi.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 7443c0a04f..0da3e05f13 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -3592,6 +3592,42 @@ QRhiResource::Type QRhiCommandBuffer::resourceType() const
return CommandBuffer;
}
+#ifndef QT_NO_DEBUG
+static const char *resourceTypeStr(QRhiResource *res)
+{
+ switch (res->resourceType()) {
+ case QRhiResource::Buffer:
+ return "Buffer";
+ case QRhiResource::Texture:
+ return "Texture";
+ case QRhiResource::Sampler:
+ return "Sampler";
+ case QRhiResource::RenderBuffer:
+ return "RenderBuffer";
+ case QRhiResource::RenderPassDescriptor:
+ return "RenderPassDescriptor";
+ case QRhiResource::RenderTarget:
+ return "RenderTarget";
+ case QRhiResource::TextureRenderTarget:
+ return "TextureRenderTarget";
+ case QRhiResource::ShaderResourceBindings:
+ return "ShaderResourceBindings";
+ case QRhiResource::GraphicsPipeline:
+ return "GraphicsPipeline";
+ case QRhiResource::SwapChain:
+ return "SwapChain";
+ case QRhiResource::ComputePipeline:
+ return "ComputePipeline";
+ case QRhiResource::CommandBuffer:
+ return "CommandBuffer";
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ return "";
+}
+#endif
+
QRhiImplementation::~QRhiImplementation()
{
qDeleteAll(resUpdPool);
@@ -3601,10 +3637,10 @@ QRhiImplementation::~QRhiImplementation()
// and freak out for unfreed graphics objects in the derived dtor already.
#ifndef QT_NO_DEBUG
if (!resources.isEmpty()) {
- qWarning("QRhi %p going down with %d unreleased resources. This is not nice.",
+ qWarning("QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
q, resources.count());
for (QRhiResource *res : qAsConst(resources)) {
- qWarning(" Resource %p (%s)", res, res->m_objectName.constData());
+ qWarning(" %s resource %p (%s)", resourceTypeStr(res), res, res->m_objectName.constData());
res->m_rhi = nullptr;
}
}