summaryrefslogtreecommitdiffstats
path: root/src/quick3d
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2018-06-20 13:34:56 +0300
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-06-26 13:52:51 +0000
commitdc3187218c8fc40183685ba270bb7a06ef9d63e9 (patch)
tree5081211ccf48a4998d436c924a07c2e42b7338fa /src/quick3d
parent785ae39b684229f28536f188aa806f4a07b4a427 (diff)
Fix deadlock in scene2d
Use the SurfaceLocker only when using ANGLE. Don't lock the texture when using ANGLE. Task-number: QTBUG-69039 Change-Id: Ib95fcf05febe1ec9c3ddc225932b5e8d15dc6937 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/quick3d')
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d.cpp23
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d_p.h3
2 files changed, 25 insertions, 1 deletions
diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp
index 7e3334f00..c29f741ae 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp
@@ -262,6 +262,15 @@ void Scene2D::initializeRender()
m_context->makeCurrent(m_sharedObject->m_surface);
m_sharedObject->m_renderControl->initialize(m_context);
+#ifdef QT_OPENGL_ES_2_ANGLE
+ m_usingAngle = false;
+ if (m_context->isOpenGLES()) {
+ const char *versionStr = reinterpret_cast<const char *>(
+ m_context->functions()->glGetString(GL_VERSION));
+ if (strstr(versionStr, "ANGLE"))
+ m_usingAngle = true;
+ }
+#endif
m_context->doneCurrent();
QCoreApplication::postEvent(m_sharedObject->m_renderManager,
@@ -319,7 +328,9 @@ void Scene2D::render()
QMutex *textureLock = nullptr;
#ifdef QT_OPENGL_ES_2_ANGLE
- SurfaceLocker surfaceLocker(m_sharedObject->m_surface);
+ QScopedPointer<SurfaceLocker> surfaceLocker;
+ if (m_usingAngle)
+ surfaceLocker.reset(new SurfaceLocker(m_sharedObject->m_surface));
#endif
m_context->makeCurrent(m_sharedObject->m_surface);
@@ -336,7 +347,12 @@ void Scene2D::render()
new Scene2DEvent(Scene2DEvent::Render));
return;
}
+#ifdef QT_OPENGL_ES_2_ANGLE
+ if (m_usingAngle == false)
+ textureLock->lock();
+#else
textureLock->lock();
+#endif
const QSize textureSize = QSize(texture->width(), texture->height());
if (m_attachmentData.m_textureUuid != attachmentData->m_textureUuid
|| m_attachmentData.m_point != attachmentData->m_point
@@ -384,7 +400,12 @@ void Scene2D::render()
m_context->functions()->glFlush();
if (texture->isAutoMipMapGenerationEnabled())
texture->generateMipMaps();
+#ifdef QT_OPENGL_ES_2_ANGLE
+ if (m_usingAngle == false)
+ textureLock->unlock();
+#else
textureLock->unlock();
+#endif
m_context->doneCurrent();
// gui thread can now continue
diff --git a/src/quick3d/quick3dscene2d/items/scene2d_p.h b/src/quick3d/quick3dscene2d/items/scene2d_p.h
index 454a09447..b8999887a 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d_p.h
+++ b/src/quick3d/quick3dscene2d/items/scene2d_p.h
@@ -123,6 +123,9 @@ public:
Qt3DRender::Quick::QScene2D::RenderPolicy m_renderPolicy;
QVector<Qt3DCore::QNodeId> m_entities;
Qt3DRender::QPickEventPtr m_cachedPickEvent;
+#ifdef QT_OPENGL_ES_2_ANGLE
+ bool m_usingAngle;
+#endif
};
} // Quick