aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultcontext.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2019-01-15 08:08:17 -0600
committerMichael Brasser <michael.brasser@live.com>2019-01-21 17:43:22 +0000
commit536868fad50778ec5bf4c6c7269c721b05d8a2d5 (patch)
tree8bcb14a5eb18fa6b5bd788fc6e8ee80d8f6dc16f /src/quick/scenegraph/qsgdefaultcontext.cpp
parent0b863bca305ad43b3c48287ec4e62e262c8e8849 (diff)
Do a better job of respecting the default surface format
If the depth and stencil buffers have been set to explicit values, don't override them in the normal case. Change-Id: I89c7f8ffdc08baa12a681d3fcae9e581e49436aa Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultcontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultcontext.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp
index 1124bf1727..af0589e5d3 100644
--- a/src/quick/scenegraph/qsgdefaultcontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultcontext.cpp
@@ -221,8 +221,14 @@ QSurfaceFormat QSGDefaultContext::defaultSurfaceFormat() const
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 (useDepth && format.depthBufferSize() == -1)
+ format.setDepthBufferSize(24);
+ else if (!useDepth)
+ format.setDepthBufferSize(0);
+ if (useStencil && format.stencilBufferSize() == -1)
+ format.setStencilBufferSize(8);
+ else if (!useStencil)
+ format.setStencilBufferSize(0);
if (enableDebug)
format.setOption(QSurfaceFormat::DebugContext);
if (QQuickWindow::hasDefaultAlphaBuffer())