From 92658ebb755bda136a7e4fa455b8d116c2dd0c6f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 3 Jul 2014 12:15:46 +0200 Subject: Verbose fatal instead of crash when the scene graph state is invalid. Change-Id: I9a55bcbf9e94084c0cadac561e4707d47f5f8744 Reviewed-by: Robin Burchell --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) (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 3770461ba7..0ae0c1579b 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -56,6 +56,7 @@ #include #include +#include "qsgmaterialshader_p.h" #include @@ -2058,6 +2059,19 @@ void Renderer::renderMergedBatch(const Batch *batch) program->updateState(state(dirty), material, m_currentMaterial); +#ifndef QT_NO_DEBUG + if (qsg_test_and_clear_material_failure()) { + qDebug() << "QSGMaterial::updateState triggered an error (merged), batch will be skipped:"; + Element *ee = e; + while (ee) { + qDebug() << " -" << ee->node; + ee = ee->nextInBatch; + } + QSGNodeDumper::dump(rootNode()); + qFatal("Aborting: scene graph is invalid..."); + } +#endif + m_currentMaterial = material; QSGGeometry* g = gn->geometry(); @@ -2165,6 +2179,16 @@ void Renderer::renderUnmergedBatch(const Batch *batch) program->updateState(state(dirty), material, m_currentMaterial); +#ifndef QT_NO_DEBUG + if (qsg_test_and_clear_material_failure()) { + qDebug() << "QSGMaterial::updateState() triggered an error (unmerged), batch will be skipped:"; + qDebug() << " - offending node is" << e->node; + QSGNodeDumper::dump(rootNode()); + qFatal("Aborting: scene graph is invalid..."); + return; + } +#endif + // We don't need to bother with asking each node for its material as they // are all identical (compare==0) since they are in the same batch. m_currentMaterial = material; -- cgit v1.2.3