diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-03-12 21:24:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 16:39:34 +0100 |
commit | fb1c775e2e92ae13d10f88318c47ff92f5951812 (patch) | |
tree | 17967dc6c67ebd042734b37a79ddaa0a8d159975 /src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | |
parent | f3a917644253347bcb7041fd9fc3b1570184b5f4 (diff) |
Fix rendering issue with material changes from opaque <-> alpha
When I introduced the invalidation of z ranges, I forgot that we need
to rebuild render lists when nodes move from opaque to alpha batches
or vice versa as that sorting happens in buildRenderLists(). To remedy
this, make Batch::isMaterialCompatible report blending changes
separately and trigger a full rebuild in this case.
Task-number: QTBUG-37422
Change-Id: I020813cb531ed58353f8340fcad58dec8d7856dd
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index e271778bde..1f692c29d4 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -604,12 +604,12 @@ void Element::computeBounds() boundsOutsideFloatRange = bounds.isOutsideFloatRange(); } -bool Batch::isMaterialCompatible(Element *e) const +BatchCompatibility Batch::isMaterialCompatible(Element *e) const { // If material has changed between opaque and translucent, it is not compatible QSGMaterial *m = e->node->activeMaterial(); if (isOpaque != ((m->flags() & QSGMaterial::Blending) == 0)) - return false; + return BatchBreaksOnBlending; Element *n = first; // Skip to the first node other than e which has not been removed @@ -619,10 +619,12 @@ bool Batch::isMaterialCompatible(Element *e) const // Only 'e' in this batch, so a material change doesn't change anything as long as // its blending is still in sync with this batch... if (!n) - return true; + return BatchIsCompatible; QSGMaterial *nm = n->node->activeMaterial(); - return nm->type() == m->type() && nm->compare(m) == 0; + return (nm->type() == m->type() && nm->compare(m) == 0) + ? BatchIsCompatible + : BatchBreaksOnCompare; } /* @@ -1182,7 +1184,10 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) Element *e = shadowNode->element(); if (e) { if (e->batch) { - if (!e->batch->isMaterialCompatible(e)) + BatchCompatibility compat = e->batch->isMaterialCompatible(e); + if (compat == BatchBreaksOnBlending) + m_rebuild |= Renderer::FullRebuild; + else if (compat == BatchBreaksOnCompare) invalidateBatchAndOverlappingRenderOrders(e->batch); } else { m_rebuild |= Renderer::BuildBatches; |