diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-05-13 11:35:12 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2020-05-18 09:31:55 +0200 |
commit | b297d6bfdfd2116ccbed1e552fc0cbe68ea274f3 (patch) | |
tree | fca531199e76486fef6ab4d98039f2cc09051b60 /src/plugins/renderers/opengl/graphicshelpers | |
parent | 1f1f4b779382289abba98c5914ff18f593124bac (diff) |
Release rendertargets on destruction
We were only releasing them at runtime if they changed, but we should
also clean them up before we are destroyed.
Change-Id: Ibc3f37fba92e8be8381fd869af7f5747da87038a
Task-number: QTBUG-84204
Reviewed-by: Mike Krus <mike.krus@kdab.com>
(cherry picked from commit cfd8c4d06bc81028b055e6c3343d0d4b50793219)
Diffstat (limited to 'src/plugins/renderers/opengl/graphicshelpers')
-rw-r--r-- | src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp | 7 | ||||
-rw-r--r-- | src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index 7c1467f6e..95f4758ba 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -564,6 +564,13 @@ GLuint SubmissionContext::updateRenderTarget(Qt3DCore::QNodeId renderTargetNodeI return fboId; } +void SubmissionContext::releaseRenderTargets() +{ + const auto keys = m_renderTargets.keys(); + for (Qt3DCore::QNodeId renderTargetId : keys) + releaseRenderTarget(renderTargetId); +} + QSize SubmissionContext::renderTargetSize(const QSize &surfaceSize) const { QSize renderTargetSize; diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h index 6e2ac4e18..121a92e07 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h @@ -115,6 +115,7 @@ public: GLuint activeFBO() const { return m_activeFBO; } void activateRenderTarget(const Qt3DCore::QNodeId id, const AttachmentPack &attachments, GLuint defaultFboId); void releaseRenderTarget(const Qt3DCore::QNodeId id); + void releaseRenderTargets(); QSize renderTargetSize(const QSize &surfaceSize) const; QImage readFramebuffer(const QRect &rect); void blitFramebuffer(Qt3DCore::QNodeId outputRenderTargetId, Qt3DCore::QNodeId inputRenderTargetId, |