From ba4419df92bad6953c81be03a4ccf5cc137cb2d3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 4 Mar 2014 15:30:29 +0100 Subject: 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 --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp') 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