diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-09-30 13:19:30 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-03 16:18:44 +0200 |
commit | 4c09e1e0560e7a12ed80ec0603401d3441fd54e1 (patch) | |
tree | 4b378fa8a881bc5bcddafd208d1268d116fff9dc /src/quick/scenegraph/util | |
parent | 72a970760bd72adb6de321b4006f1d8419dcbb9f (diff) |
Enable profiling of materials and atlas textures
Task-number: QTBUG-33459
Change-Id: Ie9ea176fbb7ee46a128b4bf66a8f4475a5d4c90b
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Diffstat (limited to 'src/quick/scenegraph/util')
-rw-r--r-- | src/quick/scenegraph/util/qsgatlastexture.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index ad90911b9c..3710f05b9a 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -50,13 +50,16 @@ #include <private/qsgtexture_p.h> +#include <private/qqmlprofilerservice_p.h> + #ifndef GL_BGRA #define GL_BGRA 0x80E1 #endif -#ifndef QSG_NO_RENDERER_TIMING -static bool qsg_render_timing = !qgetenv("QSG_RENDERER_TIMING").isEmpty(); +#ifndef QSG_NO_RENDER_TIMING +static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty(); +static QElapsedTimer qsg_renderer_timer; #endif namespace QSGAtlasTexture @@ -331,10 +334,10 @@ bool Atlas::bind(QSGTexture::Filtering filtering) // Upload all pending images.. for (int i=0; i<m_pending_uploads.size(); ++i) { -#ifndef QSG_NO_RENDERER_TIMING - QElapsedTimer timer; - if (qsg_render_timing) - timer.start(); +#ifndef QSG_NO_RENDER_TIMING + bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled; + if (profileFrames) + qsg_renderer_timer.start(); #endif if (m_externalFormat == GL_BGRA && @@ -343,12 +346,23 @@ bool Atlas::bind(QSGTexture::Filtering filtering) } else { upload(m_pending_uploads.at(i)); } -#ifndef QSG_NO_RENDERER_TIMING + +#ifndef QSG_NO_RENDER_TIMING if (qsg_render_timing) { printf(" - AtlasTexture(%dx%d), uploaded in %d ms\n", m_pending_uploads.at(i)->image().width(), m_pending_uploads.at(i)->image().height(), - (int) timer.elapsed()); + (int) (qsg_renderer_timer.elapsed())); + } + + if (QQmlProfilerService::enabled) { + QQmlProfilerService::sceneGraphFrame( + QQmlProfilerService::SceneGraphTexturePrepare, + 0, // bind (not relevant) + 0, // convert (not relevant) + 0, // swizzle (not relevant) + qsg_renderer_timer.nsecsElapsed(), // (upload all of the above) + 0); // mipmap (not used ever...) } #endif } |