cogl: Generalize EGL context attribute initialization
No functional change, just makes the next change clearer. https://gitlab.gnome.org/GNOME/mutter/merge_requests/454
This commit is contained in:
parent
9ab3a02a8a
commit
3f29b47809
1 changed files with 13 additions and 14 deletions
|
@ -351,6 +351,7 @@ try_create_context (CoglDisplay *display,
|
|||
EGLint cfg_attribs[MAX_EGL_CONFIG_ATTRIBS];
|
||||
GError *config_error = NULL;
|
||||
const char *error_message;
|
||||
int i = 0;
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context == NULL, TRUE);
|
||||
|
||||
|
@ -388,24 +389,22 @@ try_create_context (CoglDisplay *display,
|
|||
}
|
||||
|
||||
/* Try to get a core profile 3.1 context with no deprecated features */
|
||||
attribs[0] = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
attribs[1] = 3;
|
||||
attribs[2] = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
attribs[3] = 1;
|
||||
attribs[4] = EGL_CONTEXT_FLAGS_KHR;
|
||||
attribs[5] = EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
attribs[6] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
attribs[7] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||
attribs[8] = EGL_NONE;
|
||||
attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
attribs[i++] = 3;
|
||||
attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
attribs[i++] = 1;
|
||||
attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
attribs[i++] = EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
attribs[i++] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||
}
|
||||
else if (display->renderer->driver == COGL_DRIVER_GLES2)
|
||||
{
|
||||
attribs[0] = EGL_CONTEXT_CLIENT_VERSION;
|
||||
attribs[1] = 2;
|
||||
attribs[2] = EGL_NONE;
|
||||
attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
|
||||
attribs[i++] = 2;
|
||||
}
|
||||
else
|
||||
attribs[0] = EGL_NONE;
|
||||
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
egl_display->egl_context = eglCreateContext (edpy,
|
||||
config,
|
||||
|
|
Loading…
Reference in a new issue