summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAnton Kreuzkamp <anton.kreuzkamp@kdab.com>2019-04-08 16:27:42 +0200
committerAnton Kreuzkamp <anton.kreuzkamp@kdab.com>2019-05-28 10:51:21 +0200
commitf39178a415cb41470775a86e0aa358faa3686d81 (patch)
treea8fc9ece166067387318d295035ef8b5f389e6ee /src/core
parentd38db1a6b5027cd69777946e5a2d24e2a404dfa0 (diff)
Scene3D: Revise render loop and synchronization
Before, the Scene3DRenderer marked the sg-node dirty in render, which would then already mark it dirty for the next frame. This only works as long as we always render, which is undesireble in some cases. fa12f14b2 changed rendering to not always happen anymore. Thus, that commit broke rendering under certain circumstances. Now, Scene3DRenderer listens on a signal from the QChangeArbiter about new pending changes. In reaction to this signal, we set an internal dirty-flag in Scene3DRenderer. Only if this flag is set, synchronization and rendering will happen on the Qt3D side. Change-Id: I3b33faa5d60c270bd9b903b0e34c8fa24e2e29fd Task-number: QTBUG-69985 Task-number: QTBUG-72923 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/qchangearbiter.cpp4
-rw-r--r--src/core/qchangearbiter_p.h5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/core/qchangearbiter.cpp b/src/core/qchangearbiter.cpp
index 2e32d6722..e0ee389c4 100644
--- a/src/core/qchangearbiter.cpp
+++ b/src/core/qchangearbiter.cpp
@@ -244,6 +244,8 @@ void QChangeArbiter::sceneChangeEvent(const QSceneChangePtr &e)
QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData();
localChangeQueue->push_back(e);
+ emit receivedChange();
+
// qCDebug(ChangeArbiter) << "Change queue for thread" << QThread::currentThread() << "now contains" << localChangeQueue->count() << "items";
}
@@ -259,6 +261,8 @@ void QChangeArbiter::sceneChangeEventWithLock(const QSceneChangeList &e)
QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData();
qCDebug(ChangeArbiter) << Q_FUNC_INFO << "Handles " << e.size() << " changes at once";
localChangeQueue->insert(localChangeQueue->end(), e.begin(), e.end());
+
+ emit receivedChange();
}
// Either we have the postman or we could make the QChangeArbiter agnostic to the postman
diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h
index 4a82061ed..ac52273ea 100644
--- a/src/core/qchangearbiter_p.h
+++ b/src/core/qchangearbiter_p.h
@@ -120,6 +120,9 @@ public:
static void createThreadLocalChangeQueue(void *changeArbiter);
static void destroyThreadLocalChangeQueue(void *changeArbiter);
+Q_SIGNALS:
+ void receivedChange();
+
protected:
typedef std::vector<QSceneChangePtr> QChangeQueue;
typedef QPair<ChangeFlags, QObserverInterface *> QObserverPair;
@@ -134,7 +137,7 @@ protected:
void removeLockingChangeQueue(QChangeQueue *queue);
private:
- QMutex m_mutex;
+ mutable QMutex m_mutex;
QAbstractAspectJobManager *m_jobManager;
// The lists of observers indexed by observable (QNodeId).