diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-08-14 07:27:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-02 14:24:36 +0200 |
commit | b480fa83a632b2ae5606e2870b47358328b479a2 (patch) | |
tree | bdd3e1b68a5a15a3950e13a50db911a93cdf279a /src/quick/scenegraph/coreapi/qsgnode.cpp | |
parent | 9be35c270082d1614886874e17cc3f90a7a3f489 (diff) |
New scenegraph renderer and atlas textures.
The renderer tries to batch primitives together where possible, isolate
non-changing subparts of the scene from changing subparts and retain
vertexdata on the GPU as much as possible. Atlas textures are crucial
in enabling batching.
The renderer and atlas texture are described in detail in the doc page
"Qt Quick Scene Graph Renderer".
Change-Id: Ia476c7f0f42e1fc57a2cef528e93ee88cf8f7055
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgnode.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index a4a47de216..a55a5abb0a 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -367,7 +367,7 @@ QSGNode::~QSGNode() bool QSGNode::isSubtreeBlocked() const { - return m_subtreeRenderableCount == 0; + return false; } /*! @@ -656,10 +656,6 @@ void QSGNode::setFlags(Flags f, bool enabled) void QSGNode::markDirty(DirtyState bits) { - m_dirtyState |= (bits & DirtyPropagationMask); - - DirtyState subtreeBits = DirtyState((bits & DirtyPropagationMask) << 16); - int renderableCountDiff = 0; if (bits & DirtyNodeAdded) renderableCountDiff += m_subtreeRenderableCount; @@ -668,7 +664,6 @@ void QSGNode::markDirty(DirtyState bits) QSGNode *p = m_parent; while (p) { - p->m_dirtyState |= subtreeBits; p->m_subtreeRenderableCount += renderableCountDiff; if (p->type() == RootNodeType) static_cast<QSGRootNode *>(p)->notifyNodeChange(this, bits); @@ -1309,7 +1304,7 @@ QSGOpacityNode::~QSGOpacityNode() Returns this opacity node's opacity. */ - +const qreal OPACITY_THRESHOLD = 0.001; /*! Sets the opacity of this node to \a opacity. @@ -1325,8 +1320,14 @@ void QSGOpacityNode::setOpacity(qreal opacity) opacity = qBound<qreal>(0, opacity, 1); if (m_opacity == opacity) return; + DirtyState dirtyState = DirtyOpacity; + + if ((m_opacity < OPACITY_THRESHOLD && opacity > OPACITY_THRESHOLD) + || (m_opacity > OPACITY_THRESHOLD && opacity < OPACITY_THRESHOLD)) + dirtyState |= DirtySubtreeBlocked; + m_opacity = opacity; - markDirty(DirtyOpacity); + markDirty(dirtyState); } @@ -1370,7 +1371,7 @@ void QSGOpacityNode::setCombinedOpacity(qreal opacity) bool QSGOpacityNode::isSubtreeBlocked() const { - return QSGNode::isSubtreeBlocked() || m_opacity < 0.001; + return m_opacity < OPACITY_THRESHOLD; } @@ -1584,6 +1585,16 @@ QDebug operator<<(QDebug d, const QSGNode *n) case QSGNode::OpacityNodeType: d << static_cast<const QSGOpacityNode *>(n); break; + case QSGNode::RenderNodeType: + d << "RenderNode(" << hex << (void *) n << dec + << "dirty=" << hex << (int) n->dirtyState() + << "flags=" << (int) n->flags() << dec + << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); +#ifdef QSG_RUNTIME_DESCRIPTION + d << QSGNodePrivate::description(n); +#endif + d << ')'; + break; default: d << "Node(" << hex << (void *) n << dec << "dirty=" << hex << (int) n->dirtyState() |