diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-07-19 11:18:57 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-07-31 12:38:40 +0200 |
commit | 84873c898cb4cc433f05d3161cad1e458d26c2e9 (patch) | |
tree | 5b2c5ddb041b3988284fbfd6612dea1be6d536f6 /src/gui/rhi/qrhi_p.h | |
parent | f9d473ac726fe012fe05a9e6f7502ca50c2245e5 (diff) |
rhi: Enable registering cleanup callbacks with a key
And the ability to deregister.
Going to be required by QRhiWidget.
Change-Id: If185cbed2faa042098ac1f6bb1d6daaffd834377
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p.h')
-rw-r--r-- | src/gui/rhi/qrhi_p.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 0a0e5e4d37..926247d386 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -179,6 +179,16 @@ public: cleanupCallbacks.append(callback); } + void addCleanupCallback(const void *key, const QRhi::CleanupCallback &callback) + { + keyedCleanupCallbacks[key] = callback; + } + + void removeCleanupCallback(const void *key) + { + keyedCleanupCallbacks.remove(key); + } + bool sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps); bool sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb); void updateLayoutDesc(QRhiShaderResourceBindings *srb); @@ -239,6 +249,7 @@ private: QHash<QRhiResource *, bool> resources; QSet<QRhiResource *> pendingDeleteResources; QVarLengthArray<QRhi::CleanupCallback, 4> cleanupCallbacks; + QHash<const void *, QRhi::CleanupCallback> keyedCleanupCallbacks; QElapsedTimer pipelineCreationTimer; qint64 accumulatedPipelineCreationTime = 0; |