diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-08-14 12:08:38 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-08-16 10:52:12 +0000 |
commit | 0cb02b7ee0f72674640ffe5a0fabc1dacc259de0 (patch) | |
tree | 7c02ca4f0f0c820e4aa16b714c07ebcde5cd0820 /src/quick/scenegraph/qsgdefaultcontext.cpp | |
parent | 98ed26a2db244bc0a1711144b7fe843497fd9a82 (diff) |
Do not create depth/stencil buffer when the env var says so
Both for the swapchain and more importantly, layers. The latter was
never implemented, not in Qt 5 with OpenGL either, and it becomes a
problem for resource-limited use cases because QSG_NO_DEPTH_BUFFER still
creates depth/stencil attachments for layers even though the 2D
rendering has no use for those then.
Clarify the QQuickGraphicsConfiguration docs as well. The story is
fairly convoluted, because the useDepthFor2D flag one can set from C++
is not 100% the same as the env.var. (and it really should not be)
The flag is about relying on depth testing in 2D (and so enabling the
potentially more efficient opaque batches), but it does not prevent adding
a View3D or other stuff that requires a depth buffer. The env.var on
the other hand does both: it (depending on the platform) disables
depth (and often stencil) buffers, thus using fewer resources, and also
triggers the depth-less 2D rendering path (alpha batches only). But that
is not always compatible with 3D then (like an offscren View3D will work,
other modes may not)
Change-Id: I5ac1ce154fe78a3ec8bd1a698c1c0b944ce8077e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultcontext.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultcontext.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index b36c0de6ef..37674eb19c 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -200,6 +200,8 @@ QSGLayer *QSGDefaultContext::createLayer(QSGRenderContext *renderContext) QSurfaceFormat QSGDefaultContext::defaultSurfaceFormat() const { QSurfaceFormat format = QSurfaceFormat::defaultFormat(); + // These depend solely on the env.vars., not QQuickGraphicsConfiguration + // since that does not have a flag that maps 100% to QSG_NO_xx_BUFFER. static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER"); static bool enableDebug = qEnvironmentVariableIsSet("QSG_OPENGL_DEBUG"); |