From: Gunnar Sletta Date: Tue, 5 Feb 2013 12:45:24 +0000 (+0100) Subject: Warn if the OpenGL context lacks depth/stencil when requested. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=8f774ffb954c219d503e99c94b62e754a7e6e435;p=konrad%2Fqtdeclarative.git Warn if the OpenGL context lacks depth/stencil when requested. I thought this was a serious bug in the renderer, but it turned out to be qmlscene just overriding the surface format without requesting the needed depth and stencil buffers. An easy mistake to make, hence introduce the warning. Task-number: QTBUG-29037 Change-Id: I59d09d1b2a139e3add851777ff2eeb6c4efb47ec Reviewed-by: Samuel Rødal --- diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index e7e10ec..705b12c 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -249,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;