diff options
Diffstat (limited to 'src/gui/rhi/qrhi_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhi_p_p.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h index 7b2128024f..6641bf5822 100644 --- a/src/gui/rhi/qrhi_p_p.h +++ b/src/gui/rhi/qrhi_p_p.h @@ -149,10 +149,14 @@ public: void textureFormatInfo(QRhiTexture::Format format, const QSize &size, quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const; - // only really care about resources that own native graphics resources underneath - void registerResource(QRhiResource *res) + void registerResource(QRhiResource *res, bool ownsNativeResources = true) { - resources.insert(res); + // The ownsNativeResources is relevant for the (graphics resource) leak + // check in ~QRhiImplementation; when false, the registration's sole + // purpose is to automatically null out the resource's m_rhi pointer in + // case the rhi goes away first. (which should not happen in + // well-written applications but we try to be graceful) + resources.insert(res, ownsNativeResources); } void unregisterResource(QRhiResource *res) @@ -160,11 +164,6 @@ public: resources.remove(res); } - QSet<QRhiResource *> activeResources() const - { - return resources; - } - void addDeleteLater(QRhiResource *res) { if (inFrame) @@ -251,7 +250,7 @@ private: QVarLengthArray<QRhiResourceUpdateBatch *, 4> resUpdPool; quint64 resUpdPoolMap = 0; int lastResUpdIdx = -1; - QSet<QRhiResource *> resources; + QHash<QRhiResource *, bool> resources; QSet<QRhiResource *> pendingDeleteResources; QVarLengthArray<QRhi::CleanupCallback, 4> cleanupCallbacks; QVarLengthArray<QRhi::GpuFrameTimeCallback, 4> gpuFrameTimeCallbacks; |