Respect DirtyForceUpdate in QSGBatchRenderer.
authorGunnar Sletta <gunnar.sletta@digia.com>
Fri, 4 Oct 2013 08:39:20 +0000 (10:39 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 4 Oct 2013 13:28:20 +0000 (15:28 +0200)
There is a way this could have been done slightly more efficitently.
If we moved all "combined" logic out of the scene graph and into the
Node shadow tree, we could ignore the forceupdate all
together. However, this is a quite large change for what is currently
a non-common case. It would also increase overall memory consumption a
bit as we would have superfluous combined matrix and opacity in the
QSGNodes.

Task-number: QTBUG-33838
Change-Id: I06c486ace2be15bef1f1dc72a8b41cb649d7c813
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp

index d52f9db..ab67dc5 100644 (file)
@@ -303,6 +303,8 @@ void Updater::updateStates(QSGNode *n)
             qDebug() << " - transforms have changed";
         if (sn->dirtyState & (QSGNode::DirtyOpacity << 16))
             qDebug() << " - opacity has changed";
+        if (sn->dirtyState & (QSGNode::DirtyForceUpdate << 16))
+            qDebug() << " - forceupdate";
     }
 
     visitNode(sn);
@@ -317,6 +319,10 @@ void Updater::visitNode(Node *n)
     if (n->dirtyState & QSGNode::DirtyNodeAdded)
         ++m_added;
 
+    int force = m_force_update;
+    if (n->dirtyState & QSGNode::DirtyForceUpdate)
+        ++m_force_update;
+
     switch (n->type()) {
     case QSGNode::OpacityNodeType:
         visitOpacityNode(n);
@@ -340,6 +346,7 @@ void Updater::visitNode(Node *n)
     }
 
     m_added = count;
+    m_force_update = force;
     n->dirtyState = 0;
 }
 
@@ -1103,7 +1110,8 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state)
     QSGNode::DirtyState dirtyChain = state & (QSGNode::DirtyNodeAdded
                                               | QSGNode::DirtyOpacity
                                               | QSGNode::DirtyMatrix
-                                              | QSGNode::DirtySubtreeBlocked);
+                                              | QSGNode::DirtySubtreeBlocked
+                                              | QSGNode::DirtyForceUpdate);
     if (dirtyChain != 0) {
         dirtyChain = QSGNode::DirtyState(dirtyChain << 16);
         Node *sn = shadowNode->parent;