aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgadaptationlayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer.cpp')
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp77
1 files changed, 59 insertions, 18 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 17f4ba1243..ee077dbaf1 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -44,6 +44,7 @@
#include <qmath.h>
#include <QtQuick/private/qsgdistancefieldutil_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
+#include <QtQuick/private/qsgcontext_p.h>
#include <private/qrawfont_p.h>
#include <QtGui/qguiapplication.h>
#include <qdir.h>
@@ -53,10 +54,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QSG_NO_RENDER_TIMING
-static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
static QElapsedTimer qsg_render_timer;
-#endif
QSGDistanceFieldGlyphCache::Texture QSGDistanceFieldGlyphCache::s_emptyTexture;
@@ -163,11 +161,9 @@ void QSGDistanceFieldGlyphCache::update()
if (m_pendingGlyphs.isEmpty())
return;
-#ifndef QSG_NO_RENDER_TIMING
- bool profileFrames = qsg_render_timing || QQuickProfiler::enabled;
+ bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled() || QQuickProfiler::enabled;
if (profileFrames)
qsg_render_timer.start();
-#endif
QList<QDistanceField> distanceFields;
for (int i = 0; i < m_pendingGlyphs.size(); ++i) {
@@ -176,31 +172,28 @@ void QSGDistanceFieldGlyphCache::update()
m_doubleGlyphResolution));
}
-#ifndef QSG_NO_RENDER_TIMING
qint64 renderTime = 0;
int count = m_pendingGlyphs.size();
if (profileFrames)
renderTime = qsg_render_timer.nsecsElapsed();
-#endif
m_pendingGlyphs.reset();
storeGlyphs(distanceFields);
-#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing) {
- qDebug(" - glyphs: count=%d, render=%d, store=%d, total=%d",
- count,
- int(renderTime/1000000),
- (int) qsg_render_timer.elapsed() - int(renderTime/1000000),
- (int) qsg_render_timer.elapsed());
-
+ if (QSG_LOG_TIME_GLYPH().isDebugEnabled()) {
+ quint64 now = qsg_render_timer.elapsed();
+ qCDebug(QSG_LOG_TIME_GLYPH,
+ "distancefield: %d glyphs prepared in %dms, rendering=%d, upload=%d",
+ count,
+ (int) now,
+ int(renderTime / 1000000),
+ int((now - (renderTime / 1000000))));
}
- Q_QUICK_SG_PROFILE1(QQuickProfiler::SceneGraphAdaptationLayerFrame, (
+ Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphAdaptationLayerFrame, (
count,
renderTime,
qsg_render_timer.nsecsElapsed() - renderTime));
-#endif
}
void QSGDistanceFieldGlyphCache::setGlyphsPosition(const QList<GlyphPosition> &glyphs)
@@ -298,4 +291,52 @@ void QSGDistanceFieldGlyphCache::updateTexture(GLuint oldTex, GLuint newTex, con
}
}
+void QSGNodeVisitorEx::visitChildren(QSGNode *node)
+{
+ for (QSGNode *child = node->firstChild(); child; child = child->nextSibling()) {
+ switch (child->type()) {
+ case QSGNode::ClipNodeType: {
+ QSGClipNode *c = static_cast<QSGClipNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::TransformNodeType: {
+ QSGTransformNode *c = static_cast<QSGTransformNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::OpacityNodeType: {
+ QSGOpacityNode *c = static_cast<QSGOpacityNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ break;
+ }
+ case QSGNode::GeometryNodeType: {
+ if (child->flags() & QSGNode::IsVisitableNode) {
+ QSGVisitableNode *v = static_cast<QSGVisitableNode*>(child);
+ v->accept(this);
+ } else {
+ QSGGeometryNode *c = static_cast<QSGGeometryNode*>(child);
+ visit(c);
+ visitChildren(c);
+ endVisit(c);
+ }
+ break;
+ }
+ case QSGNode::BasicNodeType: {
+ visitChildren(child);
+ break;
+ }
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ }
+}
+
QT_END_NAMESPACE