diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 213c971ada744a9989329d5aa4d1097b2729fd82..4147af87493801e11d7f5f7dc21b465e985a7640 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -436,32 +436,37 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, } } - EGLint temp_attribs[temp_index + 1]; - memcpy(&temp_attribs[0], attrib_list, (temp_index + 1) * sizeof(EGLint)); - - if (temp_index > 0) { - for (int i = 0; i < temp_index; i += 2) { - 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; + if (attrib_list) { + EGLint temp_attribs[temp_index + 1]; + memcpy(&temp_attribs[0], attrib_list, (temp_index + 1) * sizeof(EGLint)); + + if (temp_index > 0) { + for (int i = 0; i < temp_index; i += 2) { + 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( + dp->disp.dpy, temp_attribs, configs, config_size, num_config); + } else { + res = cnx->egl.eglChooseConfig( + dp->disp.dpy, attrib_list, configs, config_size, num_config); } - res = cnx->egl.eglChooseConfig( - dp->disp.dpy, temp_attribs, configs, config_size, num_config); } return res; }