diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2018-07-10 09:30:52 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2018-07-11 04:45:51 +0000 |
commit | d47c78e6557856da4c0719caf2764b2fbfe2335d (patch) | |
tree | c8bbd14f40edb0440c115f50c2032db0dc399125 /src/render/backend/managers_p.h | |
parent | a772c0f3cc85baed7434c0e0c8d2a6a7b3601364 (diff) |
Do not delay cleanup of backend Texture instances
If we delay the cleanup of backend Texture instances, in the case of a texture
being reparented from an existing node with backend to a node with no
backend, the resulting node destroyed, node created changes delivered in the
same loop would result in the Texture still being marked for destruction and
eventually being destroyed even though it was recreated.
This patch now still marks textures that were destroyed (by storing their
ids), so that the GL Texture managers can update the resources
accordingly. However, we now cleanup Textures immediately. We also remove
textures ids marked for destruction in the GL texture managers if we detect a
Texture with the same id is readded.
Change-Id: I29092d7dff9f70bb9fb4b15f4e9419ee1791b6e2
Task-number: QTBUG-69379
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/backend/managers_p.h')
-rw-r--r-- | src/render/backend/managers_p.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index c9bcb799e..6af34fa6d 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -230,12 +230,27 @@ public: m_textureIdsToCleanup.push_back(id); } + // Called in AspectThread by Texture node functor create + void removeTextureIdToCleanup(Qt3DCore::QNodeId id) + { + m_textureIdsToCleanup.removeAll(id); + } + // Called by RenderThread in updateGLResources (locked) QVector<Qt3DCore::QNodeId> takeTexturesIdsToCleanup() { return std::move(m_textureIdsToCleanup); } +#ifdef QT_BUILD_INTERNAL + // For unit testing purposes only + QVector<Qt3DCore::QNodeId> textureIdsToCleanup() const + { + return m_textureIdsToCleanup; + } + +#endif + private: QVector<Qt3DCore::QNodeId> m_textureIdsToCleanup; }; |