From 9e15fb156a0ef58584661a0599f1f85d7597e87c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 12 Oct 2015 17:33:51 +0200 Subject: Handle QSG_NO_DEPTH_BUFFER correctly Just not requesting a depth buffer is insufficient since there's nothing guaranteeing that the EGL or other implementation will return depthless configs. When the depth buffer is always there, setting the environment variable is futile. To do what the user has requested, the value has to be checked in the renderer too. Change-Id: I1f572bc6f2f5b5aa94070a239d6e871e3421a51f Reviewed-by: Louai Al-Khanji Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/quick/scenegraph/coreapi') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 8632ea0b52..60ada14c32 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -821,7 +821,8 @@ Renderer::Renderer(QSGRenderContext *ctx) m_vao->create(); } - m_useDepthBuffer = ctx->openglContext()->format().depthBufferSize() > 0; + bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); + m_useDepthBuffer = useDepth && ctx->openglContext()->format().depthBufferSize() > 0; } static void qsg_wipeBuffer(Buffer *buffer, QOpenGLFunctions *funcs) @@ -1087,8 +1088,10 @@ void Renderer::nodeWasRemoved(Node *node) e->removed = true; m_elementsToDelete.add(e); - if (m_renderNodeElements.isEmpty()) - m_useDepthBuffer = context()->openglContext()->format().depthBufferSize() > 0; + if (m_renderNodeElements.isEmpty()) { + static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); + m_useDepthBuffer = useDepth && context()->openglContext()->format().depthBufferSize() > 0; + } } } -- cgit v1.2.3