aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-03-04 15:30:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-05 03:52:36 +0100
commitba4419df92bad6953c81be03a4ccf5cc137cb2d3 (patch)
tree07db62e3a431544faa967f6ec7d49748402b0bed
parent51f00a212c9414533010a47f6482d4f7ab0a75d9 (diff)
Don't sort batches when there are no changes.
On node removal we change the batch, but don't set rebuild as everything else should be drawn as is. A sort after such a removal could result on the order of batches being changed without the other nodes being updated. This would then result in incorrect ordering and nodes could be obscured. Task-number: QTBUG-37222 Change-Id: I57dd2fbc945e8c10c949743f59315b3372a4b6f4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 46ff4750de..c65c80ebd3 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2392,16 +2392,19 @@ void Renderer::render()
deleteRemovedElements();
- // Then sort opaque batches so that we're drawing the batches with the highest
- // order first, maximizing the benefit of front-to-back z-ordering.
- if (m_opaqueBatches.size())
- std::sort(&m_opaqueBatches.first(), &m_opaqueBatches.last() + 1, qsg_sort_batch_decreasing_order);
+ if (m_rebuild != 0) {
+ // Then sort opaque batches so that we're drawing the batches with the highest
+ // order first, maximizing the benefit of front-to-back z-ordering.
+ if (m_opaqueBatches.size())
+ std::sort(&m_opaqueBatches.first(), &m_opaqueBatches.last() + 1, qsg_sort_batch_decreasing_order);
- // Sort alpha batches back to front so that they render correctly.
- if (m_alphaBatches.size())
- std::sort(&m_alphaBatches.first(), &m_alphaBatches.last() + 1, qsg_sort_batch_increasing_order);
+ // Sort alpha batches back to front so that they render correctly.
+ if (m_alphaBatches.size())
+ std::sort(&m_alphaBatches.first(), &m_alphaBatches.last() + 1, qsg_sort_batch_increasing_order);
+
+ m_zRange = 1.0 / (m_nextRenderOrder);
+ }
- m_zRange = 1.0 / (m_nextRenderOrder);
if (Q_UNLIKELY(debug_upload)) qDebug() << "Uploading Opaque Batches:";
for (int i=0; i<m_opaqueBatches.size(); ++i)