From 4cc76248e81307be41b84c71e95e267daed6f728 Mon Sep 17 00:00:00 2001 From: enkore Date: Mon, 6 Oct 2014 19:39:27 +0200 Subject: Add QSG_OPENGL_DEBUG environment variable If QSG_OPENGL_DEBUG is set the OpenGL context is always created as a debug context. Not setting QSG_OPENGL_DEBUG uses the default value obtained from QSurfaceFormat::defaultFormat(). Change-Id: I8cc2c8f995cfdb2ed762eb155d77ca11b2db7b72 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/qsgcontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index fdf27085b9..e7b37e50d2 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -247,6 +247,7 @@ void QSGContext::renderContextInitialized(QSGRenderContext *renderContext) QByteArray all; foreach (const QByteArray &e, exts) all += ' ' + e; qCDebug(QSG_LOG_INFO) << "GL_EXTENSIONS: " << all.constData(); qCDebug(QSG_LOG_INFO) << "Max Texture Size: " << renderContext->maxTextureSize(); + qCDebug(QSG_LOG_INFO) << "Debug context: " << format.testOption(QSurfaceFormat::DebugContext); } d->mutex.unlock(); @@ -337,8 +338,11 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSurfaceFormat format = QSurfaceFormat::defaultFormat(); static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER"); + static bool enableDebug = qEnvironmentVariableIsSet("QSG_OPENGL_DEBUG"); format.setDepthBufferSize(useDepth ? 24 : 0); format.setStencilBufferSize(useStencil ? 8 : 0); + if (enableDebug) + format.setOption(QSurfaceFormat::DebugContext); if (QQuickWindow::hasDefaultAlphaBuffer()) format.setAlphaBufferSize(8); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); -- cgit v1.2.3