aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-01-30 11:13:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-30 11:26:32 +0100
commit3e3c59b2c05463eea9a9ad99125aac909e70a996 (patch)
tree167c3bb8c5d2849252feceaba1ad401cda22d7e7 /src/quick/scenegraph/qsgcontext.cpp
parentf814eb831a8fb3d7eb958b72142ab4979ed76599 (diff)
Added to QML_RENDERER_TIMING logic to capture most render bottlenecks.
The typical bottlenecks during rendering are usually compiling shader programs, uploading textures and preparing glyphs, so add profiling data around them. Change-Id: I9c330a0f6b769836d303a035b2c0dce832842aec Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index c9ac190e86..e7e10ec2f6 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -71,6 +71,12 @@ DEFINE_BOOL_CONFIG_OPTION(qmlFlashMode, QML_FLASH_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlTranslucentMode, QML_TRANSLUCENT_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
+#ifndef QSG_NO_RENDERER_TIMING
+static bool qsg_render_timing = !qgetenv("QML_RENDERER_TIMING").isEmpty();
+static QElapsedTimer qsg_renderer_timer;
+#endif
+
/*
Comments about this class from Gunnar:
@@ -463,11 +469,21 @@ QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
if (shader)
return shader;
+#ifndef QSG_NO_RENDERER_TIMING
+ if (qsg_render_timing)
+ qsg_renderer_timer.start();
+#endif
+
shader = material->createShader();
shader->compile();
shader->initialize();
d->materials[type] = shader;
+#ifndef QSG_NO_RENDERER_TIMING
+ if (qsg_render_timing)
+ printf(" - compiling material: %dms\n", (int) qsg_renderer_timer.elapsed());
+#endif
+
return shader;
}