summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-18 10:03:56 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-01-18 10:30:00 +0000
commit387dde19d2cfc349d8fe9b5775078798d99fc144 (patch)
treeaa03ac6cc6a720980f4e7995425e17c33771586c
parent845d01c757e5fe258fd693efa30ab6faeb08b718 (diff)
parent3c7562963625f4baaa6d692ad51df46171bbd7ed (diff)
Merge "Merge remote-tracking branch 'origin/5.9.4' into 5.9" into refs/staging/5.9
-rw-r--r--dist/changes-5.9.427
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer.cpp26
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer_p.h3
3 files changed, 47 insertions, 9 deletions
diff --git a/dist/changes-5.9.4 b/dist/changes-5.9.4
new file mode 100644
index 000000000..361215783
--- /dev/null
+++ b/dist/changes-5.9.4
@@ -0,0 +1,27 @@
+Qt 5.9.4 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.9.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.9 series is binary compatible with the 5.8.x series.
+Applications compiled for 5.8 will continue to run with 5.9.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.9.4 Changes *
+****************************************************************************
+
+ - [QTBUG-62235] Fix viewport scaling in Scene3D on hidpi displays
+ - [QTBUG-63537] Fix handling of uniform arrays values in some drivers
+ - [QTBUG-63897][QTBUG-65407] Fix crash when deleting Scene3D items
+
diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp
index f95839e1b..1c9fec4d2 100644
--- a/src/quick3d/imports/scene3d/scene3drenderer.cpp
+++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp
@@ -131,6 +131,7 @@ Scene3DRenderer::Scene3DRenderer(Scene3DItem *item, Qt3DCore::QAspectEngine *asp
, m_texture(nullptr)
, m_node(nullptr)
, m_cleaner(nullptr)
+ , m_window(nullptr)
, m_multisample(false) // this value is not used, will be synced from the Scene3DItem instead
, m_lastMultisample(false)
, m_needsShutdown(true)
@@ -139,9 +140,16 @@ Scene3DRenderer::Scene3DRenderer(Scene3DItem *item, Qt3DCore::QAspectEngine *asp
Q_CHECK_PTR(m_item);
Q_CHECK_PTR(m_item->window());
+ m_window = m_item->window();
QObject::connect(m_item->window(), &QQuickWindow::beforeRendering, this, &Scene3DRenderer::render, Qt::DirectConnection);
QObject::connect(m_item->window(), &QQuickWindow::sceneGraphInvalidated, this, &Scene3DRenderer::onSceneGraphInvalidated, Qt::DirectConnection);
+ // So that we can schedule the cleanup
QObject::connect(m_item, &QQuickItem::windowChanged, this, &Scene3DRenderer::onWindowChanged, Qt::QueuedConnection);
+ // Main thread -> updates the rendering window
+ QObject::connect(m_item, &QQuickItem::windowChanged, [this] (QQuickWindow *w) {
+ QMutexLocker l(&m_windowMutex);
+ m_window = w;
+ });
Q_ASSERT(QOpenGLContext::currentContext());
ContextSaver saver;
@@ -249,11 +257,11 @@ void Scene3DRenderer::setSGNode(Scene3DSGNode *node)
void Scene3DRenderer::render()
{
- if (!m_item || !m_item->window())
+ QMutexLocker l(&m_windowMutex);
+ // Lock to ensure the window doesn't change while we are rendering
+ if (!m_item || !m_window)
return;
- QQuickWindow *window = m_item->window();
-
if (m_aspectEngine->rootEntity() != m_item->entity())
scheduleRootEntityChange();
@@ -261,10 +269,10 @@ void Scene3DRenderer::render()
// The OpenGL state may be dirty from the previous QtQuick nodes, so reset
// it here to give Qt3D the clean state it expects
- window->resetOpenGLState();
+ m_window->resetOpenGLState();
const QSize boundingRectSize = m_item->boundingRect().size().toSize();
- const QSize currentSize = boundingRectSize * window->effectiveDevicePixelRatio();
+ const QSize currentSize = boundingRectSize * m_window->effectiveDevicePixelRatio();
const bool sizeHasChanged = currentSize != m_lastSize;
const bool multisampleHasChanged = m_multisample != m_lastMultisample;
const bool forceRecreate = sizeHasChanged || multisampleHasChanged;
@@ -273,7 +281,7 @@ void Scene3DRenderer::render()
// We are in the QSGRenderThread (doing a direct call would result in a race)
static const QMetaMethod setItemAreaAndDevicePixelRatio = setItemAreaAndDevicePixelRatioMethod();
setItemAreaAndDevicePixelRatio.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize),
- Q_ARG(qreal, window->effectiveDevicePixelRatio()));
+ Q_ARG(qreal, m_window->effectiveDevicePixelRatio()));
}
// Rebuild FBO and textures if never created or a resize has occurred
@@ -287,7 +295,7 @@ void Scene3DRenderer::render()
if (m_finalFBO.isNull() || forceRecreate) {
m_finalFBO.reset(createFramebufferObject(currentSize));
- m_texture.reset(window->createTextureFromId(m_finalFBO->texture(), m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel));
+ m_texture.reset(m_window->createTextureFromId(m_finalFBO->texture(), m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel));
m_node->setTexture(m_texture.data());
}
@@ -327,13 +335,13 @@ void Scene3DRenderer::render()
// Reset the state used by the Qt Quick scenegraph to avoid any
// interference when rendering the rest of the UI.
- window->resetOpenGLState();
+ m_window->resetOpenGLState();
// Mark material as dirty to request a new frame
m_node->markDirty(QSGNode::DirtyMaterial);
// Request next frame
- window->update();
+ m_window->update();
}
} // namespace Qt3DRender
diff --git a/src/quick3d/imports/scene3d/scene3drenderer_p.h b/src/quick3d/imports/scene3d/scene3drenderer_p.h
index 692390bb6..eb2b930ef 100644
--- a/src/quick3d/imports/scene3d/scene3drenderer_p.h
+++ b/src/quick3d/imports/scene3d/scene3drenderer_p.h
@@ -53,6 +53,7 @@
#include <QtCore/QObject>
#include <QtCore/qsize.h>
+#include <QtCore/QMutex>
QT_BEGIN_NAMESPACE
@@ -102,6 +103,8 @@ private:
QScopedPointer<QSGTexture> m_texture;
Scene3DSGNode *m_node; // Will be released by the QtQuick SceneGraph
Scene3DCleaner *m_cleaner;
+ QQuickWindow *m_window;
+ QMutex m_windowMutex;
QSize m_lastSize;
bool m_multisample;
bool m_lastMultisample;