From ccfd522b8f8039975d6fa3fec7eaecb1ca774090 Mon Sep 17 00:00:00 2001 From: zhdguy Date: Wed, 22 Jul 2020 14:45:52 +0800 Subject: [PATCH] OpenglES: fix attribute EGL_STENCIL_SIZE supports Now, we pc android platform only supports the value of EGL_STENCIL_SIZE is 8, do not supports value 0; Otherwise, the EGL func eglChooseConfig will get the configs, which is NULL. So, the apps who use EGL func eglChooseConfig with EGL_STENCIL_SIZE=0, such as XueXiQiangGuo will crash. --- opengl/libs/EGL/eglApi.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 02248cb59..213c971ad 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -441,8 +441,23 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, if (temp_index > 0) { for (int i = 0; i < temp_index; i += 2) { - if (temp_attribs[i] == EGL_SAMPLES || temp_attribs[i] == EGL_SAMPLE_BUFFERS) - temp_attribs[i + 1] = 0; + switch (temp_attribs[i]) { + case EGL_RENDERABLE_TYPE: + //temp_attribs[i + 1] = EGL_OPENGL_ES2_BIT; + break; + case EGL_SURFACE_TYPE: + //temp_attribs[i + 1] = EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT; + break; + case EGL_STENCIL_SIZE: + temp_attribs[i + 1] = 8; + break; + case EGL_SAMPLES: + case EGL_SAMPLE_BUFFERS: + temp_attribs[i + 1] = 0; + break; + default: + break; + } } } res = cnx->egl.eglChooseConfig( -- Gitee