aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-01-21 13:28:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 10:48:18 +0100
commite7ad7739c4886236ea1b8e3149d76dcee8f9d11e (patch)
tree89e1e57f8a34ad7822756f09702fd5d6b95a3960 /src/quick/scenegraph/qsgcontext.cpp
parent918159a2aae5062935a946e6d64120769802d625 (diff)
Make it possible to render without a depth buffer.
Some GL implementations (especially on embedded) will give us an OpenGL context without a depth buffer. In low memory scenarios, it might also be feasible to request a non-depth buffer context to save the depth buffer memory. The renderer deals with this by treating all nodes as translucent, by not adjusting the shaders and by not creating the extra z-order vertex attribute for merged nodes. Change-Id: I8edc92d530daa3e2628df2ba52901b47d87eaf26 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 90803db9fe..1eeb9441b8 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -210,10 +210,17 @@ void QSGContext::renderContextInitialized(QSGRenderContext *renderContext)
static bool dumped = false;
if (!dumped && qEnvironmentVariableIsSet("QSG_INFO")) {
dumped = true;
- qDebug() << "GL_VENDOR: " << (const char *) glGetString(GL_VENDOR);
- qDebug() << "GL_RENDERER: " << (const char *) glGetString(GL_RENDERER);
- qDebug() << "GL_VERSION: " << (const char *) glGetString(GL_VERSION);
- qDebug() << "GL_EXTENSIONS:\n " << QByteArray((const char *) glGetString(GL_EXTENSIONS)).replace(" ", "\n ").constData();
+ QSurfaceFormat format = renderContext->openglContext()->format();
+ qDebug() << "R/G/B/A Buffers: " << format.redBufferSize() << format.greenBufferSize() << format.blueBufferSize() << format.alphaBufferSize();
+ qDebug() << "Depth Buffer: " << format.depthBufferSize();
+ qDebug() << "Stencil Buffer: " << format.stencilBufferSize();
+ qDebug() << "Samples: " << format.samples();
+ qDebug() << "GL_VENDOR: " << (const char *) glGetString(GL_VENDOR);
+ qDebug() << "GL_RENDERER: " << (const char *) glGetString(GL_RENDERER);
+ qDebug() << "GL_VERSION: " << (const char *) glGetString(GL_VERSION);
+ QSet<QByteArray> exts = renderContext->openglContext()->extensions();
+ QByteArray all; foreach (const QByteArray &e, exts) all += ' ' + e;
+ qDebug() << "GL_EXTENSIONS: " << all.constData();
}
d->mutex.unlock();
@@ -282,8 +289,10 @@ QSGGlyphNode *QSGContext::createGlyphNode(QSGRenderContext *rc)
QSurfaceFormat QSGContext::defaultSurfaceFormat() const
{
QSurfaceFormat format;
- format.setDepthBufferSize(24);
- format.setStencilBufferSize(8);
+ static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER");
+ static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER");
+ format.setDepthBufferSize(useDepth ? 24 : 0);
+ format.setStencilBufferSize(useStencil ? 8 : 0);
if (QQuickWindow::hasDefaultAlphaBuffer())
format.setAlphaBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);