summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/renderer
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-07-10 09:30:52 +0200
committerPaul Lemire <paul.lemire@kdab.com>2018-07-11 04:45:51 +0000
commitd47c78e6557856da4c0719caf2764b2fbfe2335d (patch)
treec8bbd14f40edb0440c115f50c2032db0dc399125 /src/render/renderers/opengl/renderer
parenta772c0f3cc85baed7434c0e0c8d2a6a7b3601364 (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/renderers/opengl/renderer')
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index f04b864a3..27d46cc81 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -1191,16 +1191,13 @@ void Renderer::updateGLResources()
glTexture->getOrCreateGLTexture();
}
}
- // When Textures are cleaned up, their id is saved
- // so that they can be cleaned up in the render thread
- // Note: we perform this step in second so that the previous updateTexture call
- // has a chance to find a shared texture
+ // When Textures are cleaned up, their id is saved so that they can be
+ // cleaned up in the render thread Note: we perform this step in second so
+ // that the previous updateTexture call has a chance to find a shared
+ // texture and avoid possible destroying recreating a new texture
const QVector<Qt3DCore::QNodeId> cleanedUpTextureIds = m_nodesManager->textureManager()->takeTexturesIdsToCleanup();
- for (const Qt3DCore::QNodeId textureCleanedUpId: cleanedUpTextureIds) {
+ for (const Qt3DCore::QNodeId textureCleanedUpId: cleanedUpTextureIds)
cleanupTexture(m_nodesManager->textureManager()->lookupResource(textureCleanedUpId));
- // We can really release the texture at this point
- m_nodesManager->textureManager()->releaseResource(textureCleanedUpId);
- }
}
// Render Thread