From: Alexandros Frantzis Date: Fri, 2 Dec 2011 13:24:36 +0000 (+0200) Subject: Try to find the best matching EGL visual according to the profile. X-Git-Tag: 2.0_alpha^2~404 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fefa66327361ae210f10de962953e4f870a275c4;p=tools%2Fapitrace.git Try to find the best matching EGL visual according to the profile. The current method doesn't take into account the current profile, and it may end up selecting an incompatible visual. To remedy this, this patch adds support for different api bits lists for each profile. Each list gives priority to the associated profile. --- diff --git a/glws_egl_xlib.cpp b/glws_egl_xlib.cpp index a9ffa52..4498430 100644 --- a/glws_egl_xlib.cpp +++ b/glws_egl_xlib.cpp @@ -273,14 +273,47 @@ Visual * createVisual(bool doubleBuffer, Profile profile) { EglVisual *visual = new EglVisual(); // possible combinations - const EGLint api_bits[7] = { + const EGLint api_bits_gl[7] = { EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, - EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT, EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_BIT, + EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_ES2_BIT, + EGL_OPENGL_ES_BIT, + }; + const EGLint api_bits_gles1[7] = { + EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT, EGL_OPENGL_ES_BIT, + EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_BIT, EGL_OPENGL_ES2_BIT, + }; + const EGLint api_bits_gles2[7] = { + EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT, + EGL_OPENGL_ES2_BIT, + EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT, EGL_OPENGL_BIT, + EGL_OPENGL_ES_BIT, + }; + const EGLint *api_bits; + + switch(profile) { + case PROFILE_COMPAT: + api_bits = api_bits_gl; + break; + case PROFILE_ES1: + api_bits = api_bits_gles1; + break; + case PROFILE_ES2: + api_bits = api_bits_gles2; + break; + default: + return NULL; }; for (int i = 0; i < 7; i++) {