diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-12-13 13:23:53 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-12-14 11:18:04 +0000 |
commit | 2f3837cdbce8b27499db03f376e3781f5aede317 (patch) | |
tree | 740fe336f3ba9e53f8ffe2dace403c7c585254be /src/render/backend/managers_p.h | |
parent | 718126df5a180346675601782b4a879a0a9b2b8a (diff) |
Textures: properly abandon and release texture data
When a texture is destroyed it now properly destroys the GLTexture
if the GLTexture was not being shared.
Also, when a GLTexture is created but the texture image data for its content
already existed, make sure we still request the data to be uploaded.
This happens since functors can be shared, in which case the image data isn't
reloaded and therefore doesn't call texture->requestUpload() implicitly.
Task-number: QTBUG-57595
Change-Id: Id8f437ff64eea39be75ebb1a548516b29932e23e
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 a45f74d50..6b0aef4e8 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -230,6 +230,21 @@ class TextureManager : public Qt3DCore::QResourceManager< { public: TextureManager() {} + + // Called in AspectThread by Texture node functor destroy + void addTextureIdToCleanup(Qt3DCore::QNodeId id) + { + m_textureIdsToCleanup.push_back(id); + } + + // Called by RenderThread in updateGLResources (locked) + QVector<Qt3DCore::QNodeId> takeTexturesIdsToCleanup() + { + return std::move(m_textureIdsToCleanup); + } + +private: + QVector<Qt3DCore::QNodeId> m_textureIdsToCleanup; }; class TransformManager : public Qt3DCore::QResourceManager< |