From fd00e01ddf1aacfc1cd5f0cf33977e1a19961975 Mon Sep 17 00:00:00 2001 From: zhdguy Date: Fri, 31 Jul 2020 10:06:24 +0800 Subject: [PATCH] OpenGLES: support EGL attrib EGL_STENCIL_SIZE If no EGL_STENCIL_SIZE in attribs, then add one entry with the value 8. Otherwise, such as XueXiQiangGuo app will can not opening or play video with black. --- opengl/libs/EGL/eglApi.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 4147af874..c7f7e9253 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -437,8 +437,12 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, } if (attrib_list) { - EGLint temp_attribs[temp_index + 1]; + EGLint temp_attribs[temp_index + 1 + 2]; memcpy(&temp_attribs[0], attrib_list, (temp_index + 1) * sizeof(EGLint)); + // If no EGL_STENCIL_SIZE in |attrib_list|, then add one entry with the value 8. + temp_attribs[temp_index] = EGL_STENCIL_SIZE; + temp_attribs[temp_index + 1] = 8; + temp_attribs[temp_index + 2] = EGL_NONE; if (temp_index > 0) { for (int i = 0; i < temp_index; i += 2) { @@ -464,6 +468,7 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, res = cnx->egl.eglChooseConfig( dp->disp.dpy, temp_attribs, configs, config_size, num_config); } else { + ALOGE("eglChooseConfig attrib_list is null!"); res = cnx->egl.eglChooseConfig( dp->disp.dpy, attrib_list, configs, config_size, num_config); } -- Gitee