[mutter] cogl: Generalize EGL context attribute initialization



commit 3f29b47809a038b45528dfccd4089721c97965df
Author: Adam Jackson <ajax redhat com>
Date:   Wed Feb 20 16:59:25 2019 -0500

    cogl: Generalize EGL context attribute initialization
    
    No functional change, just makes the next change clearer.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/454

 cogl/cogl/winsys/cogl-winsys-egl.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
index 903c6492d..e3eb311da 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]