aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-02-05 13:45:24 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-05 16:36:45 +0100
commit8f774ffb954c219d503e99c94b62e754a7e6e435 (patch)
treebb2e5dd47cdc33cfbca1604ff45fe6d3cf03914d /src/quick/scenegraph/qsgcontext.cpp
parentf626f32c91781ee3fe3aaa7209114efb9d6e3e7c (diff)
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 <samuel.rodal@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index e7e10ec2f6..705b12c4d4 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;