diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-06-26 20:48:47 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-07-01 14:18:41 +0200 |
commit | 7a8cc93a0546bc38c54343d640e63062c3b398b2 (patch) | |
tree | db79fc70c17374ab44adbabc5b0b641ab08a96eb /src/quick/scenegraph/util/qsgtexture.cpp | |
parent | c67af3861f8ecec0eb16808d6d4984eef89db5d1 (diff) |
Use categorized logging for all things scenegraph.
Change-Id: I865ee838b0fd6c257b7189f24130012b98206fd1
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/scenegraph/util/qsgtexture.cpp')
-rw-r--r-- | src/quick/scenegraph/util/qsgtexture.cpp | 61 |
1 files changed, 20 insertions, 41 deletions
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 882c78b361..995bfc183a 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -65,14 +65,12 @@ #include <QHash> #endif +static QElapsedTimer qsg_renderer_timer; + #ifndef QT_NO_DEBUG static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); #endif -#ifndef QSG_NO_RENDER_TIMING -static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty(); -static QElapsedTimer qsg_renderer_timer; -#endif #ifndef GL_BGRA #define GL_BGRA 0x80E1 @@ -616,25 +614,19 @@ void QSGPlainTexture::bind() m_dirty_texture = false; -#ifndef QSG_NO_RENDER_TIMING - bool profileFrames = qsg_render_timing || QQuickProfiler::enabled; + bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled() || QQuickProfiler::enabled; if (profileFrames) qsg_renderer_timer.start(); -#endif if (m_image.isNull()) { if (m_texture_id && m_owns_texture) { funcs->glDeleteTextures(1, &m_texture_id); -#ifndef QSG_NO_RENDER_TIMING - if (qsg_render_timing) { - qDebug(" - texture deleted in %dms (size: %dx%d)", - (int) qsg_renderer_timer.elapsed(), - m_texture_size.width(), - m_texture_size.height()); - } + qCDebug(QSG_LOG_TIME_TEXTURE, "plain texture deleted in %dms - %dx%d", + (int) qsg_renderer_timer.elapsed(), + m_texture_size.width(), + m_texture_size.height()); Q_QUICK_SG_PROFILE1(QQuickProfiler::SceneGraphTextureDeletion, ( qsg_renderer_timer.nsecsElapsed())); -#endif } m_texture_id = 0; m_texture_size = QSize(); @@ -647,11 +639,9 @@ void QSGPlainTexture::bind() funcs->glGenTextures(1, &m_texture_id); funcs->glBindTexture(GL_TEXTURE_2D, m_texture_id); -#ifndef QSG_NO_RENDER_TIMING qint64 bindTime = 0; if (profileFrames) bindTime = qsg_renderer_timer.nsecsElapsed(); -#endif // ### TODO: check for out-of-memory situations... int w = m_image.width(); @@ -663,11 +653,9 @@ void QSGPlainTexture::bind() if (tmp.width() * 4 != tmp.bytesPerLine()) tmp = tmp.copy(); -#ifndef QSG_NO_RENDER_TIMING qint64 convertTime = 0; if (profileFrames) convertTime = qsg_renderer_timer.nsecsElapsed(); -#endif updateBindOptions(m_dirty_bind_options); @@ -707,41 +695,35 @@ void QSGPlainTexture::bind() qsg_swizzleBGRAToRGBA(&tmp); } -#ifndef QSG_NO_RENDER_TIMING qint64 swizzleTime = 0; if (profileFrames) swizzleTime = qsg_renderer_timer.nsecsElapsed(); -#endif + funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits()); -#ifndef QSG_NO_RENDER_TIMING qint64 uploadTime = 0; if (profileFrames) uploadTime = qsg_renderer_timer.nsecsElapsed(); -#endif - if (mipmapFiltering() != QSGTexture::None) { funcs->glGenerateMipmap(GL_TEXTURE_2D); m_mipmaps_generated = true; } -#ifndef QSG_NO_RENDER_TIMING qint64 mipmapTime = 0; - if (qsg_render_timing) { + if (profileFrames) { mipmapTime = qsg_renderer_timer.nsecsElapsed(); - - qDebug(" - plaintexture(%dx%d) bind=%d, convert=%d, swizzle=%d (%s->%s), upload=%d, mipmap=%d, total=%d", - m_texture_size.width(), m_texture_size.height(), - int(bindTime/1000000), - int((convertTime - bindTime)/1000000), - int((swizzleTime - convertTime)/1000000), - externalFormat == GL_BGRA ? "BGRA" : "RGBA", - internalFormat == GL_BGRA ? "BGRA" : "RGBA", - int((uploadTime - swizzleTime)/1000000), - int((mipmapTime - uploadTime)/1000000), - (int) qsg_renderer_timer.elapsed()); - + qCDebug(QSG_LOG_TIME_TEXTURE, + "plain texture uploaded in: %dms (%dx%d), bind=%d, convert=%d, swizzle=%d (%s->%s), upload=%d, mipmap=%d", + int(mipmapTime / 1000000), + m_texture_size.width(), m_texture_size.height(), + int(bindTime / 1000000), + int((convertTime - bindTime)/1000000), + int((swizzleTime - convertTime)/1000000), + (externalFormat == GL_BGRA ? "BGRA" : "RGBA"), + (internalFormat == GL_BGRA ? "BGRA" : "RGBA"), + int((uploadTime - swizzleTime)/1000000), + int((mipmapTime - uploadTime)/1000000)); } Q_QUICK_SG_PROFILE1(QQuickProfiler::SceneGraphTexturePrepare, ( @@ -751,9 +733,6 @@ void QSGPlainTexture::bind() uploadTime - swizzleTime, qsg_renderer_timer.nsecsElapsed() - uploadTime)); -#endif - - m_texture_size = QSize(w, h); m_texture_rect = QRectF(0, 0, 1, 1); |