diff options
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index c9ac190e86..705b12c4d4 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: @@ -243,6 +249,14 @@ void QSGContext::initialize(QOpenGLContext *context) { Q_D(QSGContext); + // Sanity check the surface format, in case it was overridden by the application + QSurfaceFormat requested = defaultSurfaceFormat(); + QSurfaceFormat actual = context->format(); + if (requested.depthBufferSize() > 0 && actual.depthBufferSize() <= 0) + qWarning("QSGContext::initialize: depth buffer support missing, expect rendering errors"); + if (requested.stencilBufferSize() > 0 && actual.stencilBufferSize() <= 0) + qWarning("QSGContext::initialize: stencil buffer support missing, expect rendering errors"); + Q_ASSERT(!d->gl); d->gl = context; @@ -463,11 +477,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; } |