From 85627c26afb087975fe2e57f91837c9314d54ba7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 9 Sep 2014 07:12:31 +0200 Subject: Fix debug output from renderer. It was wrong when we ran without depth buffer or when we used the separate ibo code path. Change-Id: Ie6e4bfc99ee2a4a593e45be7d9af9af17896bcba Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/quick/scenegraph/coreapi') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 83234bd32c..ecd450bcc8 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1875,9 +1875,12 @@ void Renderer::uploadBatch(Batch *b) vd += g->sizeOfVertex(); } - const quint16 *id = (const quint16 *) (b->vbo.data - + b->vertexCount * g->sizeOfVertex() - + (b->merged ? b->vertexCount * sizeof(float) : 0)); + const quint16 *id = +#ifdef QSG_SEPARATE_INDEX_BUFFER + (const quint16 *) (b->ibo.data); +#else + (const quint16 *) (b->vbo.data + b->drawSets.at(0).indices); +#endif { QDebug iDump = qDebug(); iDump << " -- Index Data, count:" << b->indexCount; -- cgit v1.2.3 From 1de6e7b8e0ee465f642e1b2f5a14611e52a7e8c2 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 3 Sep 2014 19:28:35 +0200 Subject: Select specific features to be recorded when profiling QML Some features, like the memory profiler, create huge amounts of data. Often enough, we're not actually interested in all the data available from the profiler and collecting it all can lead to excessive memory consumption. This change enables us to optionally turn various aspects of QML profiling off. Task-number: QTBUG-41118 Change-Id: I7bb223414e24eb903124ffa6e0896af6ce974e49 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 4 ++-- src/quick/scenegraph/coreapi/qsgrenderer.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/quick/scenegraph/coreapi') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index ecd450bcc8..0a39188b24 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -124,7 +124,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) if (shader) return shader; - if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::enabled) + if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) qsg_renderer_timer.start(); QSGMaterialShader *s = material->createShader(); @@ -169,7 +169,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate if (shader) return shader; - if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::enabled) + if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) qsg_renderer_timer.start(); QSGMaterialShader *s = static_cast(material->createShader()); diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index d62802e854..dd089425f6 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -176,7 +176,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) m_is_rendering = true; - bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled() || QQuickProfiler::enabled; + bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled() || + QQuickProfiler::profilingSceneGraph(); if (profileFrames) frameTimer.start(); qint64 bindTime = 0; @@ -272,7 +273,8 @@ void QSGRenderer::preprocess() } } - bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled()|| QQuickProfiler::enabled; + bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled()|| + QQuickProfiler::profilingSceneGraph(); if (profileFrames) preprocessTime = frameTimer.nsecsElapsed(); -- cgit v1.2.3 From 22792559f5bf7a3b4c39481d152acdf414bf5488 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 16 Sep 2014 15:20:53 -0700 Subject: Don't do qgetenv on library load Bad for two reasons: first, it increases the load time of the application and second, it makes it impossible to to setenv/putenv from main(). The latter is useful if you need to work on an embedded device that doesn't allow setting environment variables. Change-Id: Id543f77336d7ac2e4ea820b51f55ce5a40a33b4e Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 74 ++++++++++++----------- 1 file changed, 39 insertions(+), 35 deletions(-) (limited to 'src/quick/scenegraph/coreapi') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 0a39188b24..ce331cc883 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -63,15 +63,19 @@ extern QByteArray qsgShaderRewriter_insertZAttributes(const char *input, QSurfac namespace QSGBatchRenderer { -const bool debug_render = qgetenv("QSG_RENDERER_DEBUG").contains("render"); -const bool debug_build = qgetenv("QSG_RENDERER_DEBUG").contains("build"); -const bool debug_change = qgetenv("QSG_RENDERER_DEBUG").contains("change"); -const bool debug_upload = qgetenv("QSG_RENDERER_DEBUG").contains("upload"); -const bool debug_roots = qgetenv("QSG_RENDERER_DEBUG").contains("roots"); -const bool debug_dump = qgetenv("QSG_RENDERER_DEBUG").contains("dump"); -const bool debug_noalpha = qgetenv("QSG_RENDERER_DEBUG").contains("noalpha"); -const bool debug_noopaque = qgetenv("QSG_RENDERER_DEBUG").contains("noopaque"); -const bool debug_noclip = qgetenv("QSG_RENDERER_DEBUG").contains("noclip"); +#define DECLARE_DEBUG_VAR(variable) \ + static bool debug_ ## variable() \ + { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; } +DECLARE_DEBUG_VAR(render) +DECLARE_DEBUG_VAR(build) +DECLARE_DEBUG_VAR(change) +DECLARE_DEBUG_VAR(upload) +DECLARE_DEBUG_VAR(roots) +DECLARE_DEBUG_VAR(dump) +DECLARE_DEBUG_VAR(noalpha) +DECLARE_DEBUG_VAR(noopaque) +DECLARE_DEBUG_VAR(noclip) +#undef DECLARE_DEBUG_VAR static QElapsedTimer qsg_renderer_timer; @@ -268,10 +272,10 @@ void Updater::updateStates(QSGNode *n) Node *sn = renderer->m_nodes.value(n, 0); Q_ASSERT(sn); - if (Q_UNLIKELY(debug_roots)) + if (Q_UNLIKELY(debug_roots())) qsg_dumpShadowRoots(sn); - if (Q_UNLIKELY(debug_build)) { + if (Q_UNLIKELY(debug_build())) { qDebug() << "Updater::updateStates()"; if (sn->dirtyState & (QSGNode::DirtyNodeAdded << 16)) qDebug() << " - nodes have been added"; @@ -785,7 +789,7 @@ Renderer::Renderer(QSGRenderContext *ctx) if (ok) m_batchVertexThreshold = threshold; } - if (Q_UNLIKELY(debug_build || debug_render)) { + if (Q_UNLIKELY(debug_build() || debug_render())) { qDebug() << "Batch thresholds: nodes:" << m_batchNodeThreshold << " vertices:" << m_batchVertexThreshold; qDebug() << "Using buffer strategy:" << (m_bufferStrategy == GL_STATIC_DRAW ? "static" : (m_bufferStrategy == GL_DYNAMIC_DRAW ? "dynamic" : "stream")); } @@ -1048,7 +1052,7 @@ void Renderer::nodeWasRemoved(Node *node) void Renderer::turnNodeIntoBatchRoot(Node *node) { - if (Q_UNLIKELY(debug_change)) qDebug() << " - new batch root"; + if (Q_UNLIKELY(debug_change())) qDebug() << " - new batch root"; m_rebuild |= FullRebuild; node->isBatchRoot = true; node->becameBatchRoot = true; @@ -1069,7 +1073,7 @@ void Renderer::turnNodeIntoBatchRoot(Node *node) void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) { - if (Q_UNLIKELY(debug_change)) { + if (Q_UNLIKELY(debug_change())) { QDebug debug = qDebug(); debug << "dirty:"; if (state & QSGNode::DirtyGeometry) @@ -1616,7 +1620,7 @@ void Renderer::prepareAlphaBatches() void Renderer::uploadMergedElement(Element *e, int vaOffset, char **vertexData, char **zData, char **indexData, quint16 *iBase, int *indexCount) { - if (Q_UNLIKELY(debug_upload)) qDebug() << " - uploading element:" << e << e->node << (void *) *vertexData << (qintptr) (*zData - *vertexData) << (qintptr) (*indexData - *vertexData); + if (Q_UNLIKELY(debug_upload())) qDebug() << " - uploading element:" << e << e->node << (void *) *vertexData << (qintptr) (*zData - *vertexData) << (qintptr) (*indexData - *vertexData); QSGGeometry *g = e->node->geometry(); const QMatrix4x4 &localx = *e->node->matrix(); @@ -1689,17 +1693,17 @@ void Renderer::uploadBatch(Batch *b) { // Early out if nothing has changed in this batch.. if (!b->needsUpload) { - if (Q_UNLIKELY(debug_upload)) qDebug() << " Batch:" << b << "already uploaded..."; + if (Q_UNLIKELY(debug_upload())) qDebug() << " Batch:" << b << "already uploaded..."; return; } if (!b->first) { - if (Q_UNLIKELY(debug_upload)) qDebug() << " Batch:" << b << "is invalid..."; + if (Q_UNLIKELY(debug_upload())) qDebug() << " Batch:" << b << "is invalid..."; return; } if (b->isRenderNode) { - if (Q_UNLIKELY(debug_upload)) qDebug() << " Batch: " << b << "is a render node..."; + if (Q_UNLIKELY(debug_upload())) qDebug() << " Batch: " << b << "is a render node..."; return; } @@ -1778,7 +1782,7 @@ void Renderer::uploadBatch(Batch *b) #endif map(&b->vbo, bufferSize); - if (Q_UNLIKELY(debug_upload)) qDebug() << " - batch" << b << " first:" << b->first << " root:" + if (Q_UNLIKELY(debug_upload())) qDebug() << " - batch" << b << " first:" << b->first << " root:" << b->root << " merged:" << b->merged << " positionAttribute" << b->positionAttribute << " vbo:" << b->vbo.id << ":" << b->vbo.size; @@ -1844,7 +1848,7 @@ void Renderer::uploadBatch(Batch *b) } } - if (Q_UNLIKELY(debug_upload)) { + if (Q_UNLIKELY(debug_upload())) { const char *vd = b->vbo.data; qDebug() << " -- Vertex Data, count:" << b->vertexCount << " - " << g->sizeOfVertex() << "bytes/vertex"; for (int i=0; ivertexCount; ++i) { @@ -1902,11 +1906,11 @@ void Renderer::uploadBatch(Batch *b) unmap(&b->ibo, true); #endif - if (Q_UNLIKELY(debug_upload)) qDebug() << " --- vertex/index buffers unmapped, batch upload completed..."; + if (Q_UNLIKELY(debug_upload())) qDebug() << " --- vertex/index buffers unmapped, batch upload completed..."; b->needsUpload = false; - if (Q_UNLIKELY(debug_render)) + if (Q_UNLIKELY(debug_render())) b->uploadedThisFrame = true; } @@ -2038,7 +2042,7 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) { - if (clipList != m_currentClip && Q_LIKELY(!debug_noclip)) { + if (clipList != m_currentClip && Q_LIKELY(!debug_noclip())) { m_currentClip = clipList; // updateClip sets another program, so force-reactivate our own if (m_currentShader) @@ -2117,7 +2121,7 @@ void Renderer::renderMergedBatch(const Batch *batch) Element *e = batch->first; Q_ASSERT(e); - if (Q_UNLIKELY(debug_render)) { + if (Q_UNLIKELY(debug_render())) { QDebug debug = qDebug(); debug << " -" << batch @@ -2226,7 +2230,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) Element *e = batch->first; Q_ASSERT(e); - if (Q_UNLIKELY(debug_render)) { + if (Q_UNLIKELY(debug_render())) { qDebug() << " -" << batch << (batch->uploadedThisFrame ? "[ upload]" : "[retained]") @@ -2356,7 +2360,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) void Renderer::renderBatches() { - if (Q_UNLIKELY(debug_render)) { + if (Q_UNLIKELY(debug_render())) { qDebug().nospace() << "Rendering:" << endl << " -> Opaque: " << qsg_countNodesInBatches(m_opaqueBatches) << " nodes in " << m_opaqueBatches.size() << " batches..." << endl << " -> Alpha: " << qsg_countNodesInBatches(m_alphaBatches) << " nodes in " << m_alphaBatches.size() << " batches..."; @@ -2389,8 +2393,8 @@ void Renderer::renderBatches() m_currentProgram = 0; m_currentClip = 0; - bool renderOpaque = !debug_noopaque; - bool renderAlpha = !debug_noalpha; + bool renderOpaque = !debug_noopaque(); + bool renderAlpha = !debug_noalpha(); if (Q_LIKELY(renderOpaque)) { for (int i=0; ifirst->isRenderNode); -- cgit v1.2.3