diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 922455c..39376aa 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -166,6 +166,17 @@ bool q_reduceConfigAttributes(QVector *configAttributes) return true; } + i = configAttributes->indexOf(EGL_DEPTH_SIZE); + if (i >= 0) { + if (configAttributes->at(i + 1) >= 32) + configAttributes->replace(i + 1, 24); + else if (configAttributes->at(i + 1) > 1) + configAttributes->replace(i + 1, 1); + else + configAttributes->remove(i, 2); + return true; + } + i = configAttributes->indexOf(EGL_ALPHA_SIZE); if (i >= 0) { configAttributes->remove(i,2); @@ -189,14 +200,6 @@ bool q_reduceConfigAttributes(QVector *configAttributes) return true; } - i = configAttributes->indexOf(EGL_DEPTH_SIZE); - if (i >= 0) { - if (configAttributes->at(i + 1) > 1) - configAttributes->replace(i + 1, 1); - else - configAttributes->remove(i, 2); - return true; - } #ifdef EGL_BIND_TO_TEXTURE_RGB i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB); if (i >= 0) { diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp index f809f6e..17e6a94 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -317,7 +317,11 @@ QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *redu QSurfaceFormat retFormat = format; *reduced = true; - if (retFormat.redBufferSize() > 1) { + if (retFormat.depthBufferSize() >= 32) { + retFormat.setDepthBufferSize(24); + } else if (retFormat.depthBufferSize() > 0) { + retFormat.setDepthBufferSize(0); + } else if (retFormat.redBufferSize() > 1) { retFormat.setRedBufferSize(1); } else if (retFormat.greenBufferSize() > 1) { retFormat.setGreenBufferSize(1); @@ -331,8 +335,6 @@ QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *redu retFormat.setStencilBufferSize(0); }else if (retFormat.hasAlpha()) { retFormat.setAlphaBufferSize(0); - }else if (retFormat.depthBufferSize() > 0) { - retFormat.setDepthBufferSize(0); }else if (retFormat.swapBehavior() != QSurfaceFormat::SingleBuffer) { retFormat.setSwapBehavior(QSurfaceFormat::SingleBuffer); }else{