YaGL: Add OpenGL 3.1 without ES3 to supported versions 37/13137/1
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Tue, 5 Nov 2013 05:50:28 +0000 (09:50 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Tue, 5 Nov 2013 05:50:28 +0000 (09:50 +0400)
Even if OpenGL 3.1 doesn't support GL_ARB_ES3_compatibility
we still should use it instead of 2.1 because in case of mesa
3.1 has much smaller memory footprint

Change-Id: I3c27f44628c802f3d68d73a2ba06c8106005ab94

hw/yagl_apis/egl/yagl_egl_config.c
hw/yagl_drivers/egl_glx/yagl_egl_glx.c
hw/yagl_types.h

index f8996f1d4770c9133bf3778ea2c54891cb3f6029..56dceee692805d72f1dcad390fbf227c6db7a72d 100644 (file)
@@ -132,7 +132,7 @@ static struct yagl_egl_config
     cfg->native.native_renderable = EGL_TRUE;
     cfg->native.renderable_type = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
 
-    if (dpy->backend->gl_version > yagl_gl_2) {
+    if (dpy->backend->gl_version >= yagl_gl_3_1_es3) {
         cfg->native.renderable_type |= EGL_OPENGL_ES3_BIT_KHR;
     }
 
index 4d899b8c236b757149323bb4b2d7db2c2305578b..4d78032e4005223e7a4d2d9df2f4e569af70369d 100644 (file)
@@ -146,13 +146,17 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
             YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 2.1");
             *version = yagl_gl_2;
             res = true;
-        } else if (strcmp(tmp, "gl_3") == 0) {
-            YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.2");
-            *version = yagl_gl_3;
-            res = true;
-        } else if (strcmp(tmp, "gl_3_es3") == 0) {
+        } else if (strcmp(tmp, "gl_3_1") == 0) {
             YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.1");
-            *version = yagl_gl_3_es3;
+            *version = yagl_gl_3_1;
+            res = true;
+        } else if (strcmp(tmp, "gl_3_1_es3") == 0) {
+            YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.1 ES3");
+            *version = yagl_gl_3_1_es3;
+            res = true;
+        } else if (strcmp(tmp, "gl_3_2") == 0) {
+            YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.2");
+            *version = yagl_gl_3_2;
             res = true;
         } else {
             YAGL_LOG_CRITICAL("Bad YAGL_GL_VERSION value = %s", tmp);
@@ -222,8 +226,8 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
     for (i = 0; i < num_extensions; ++i) {
         tmp = (const char*)GetStringi(GL_EXTENSIONS, i);
         if (strcmp(tmp, "GL_ARB_ES3_compatibility") == 0) {
-            YAGL_LOG_INFO("GL_ARB_ES3_compatibility supported, using OpenGL 3.1");
-            *version = yagl_gl_3_es3;
+            YAGL_LOG_INFO("GL_ARB_ES3_compatibility supported, using OpenGL 3.1 ES3");
+            *version = yagl_gl_3_1_es3;
             res = true;
             goto out;
         }
@@ -240,13 +244,13 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
     if ((major > 3) ||
         ((major == 3) && (minor >= 2))) {
         YAGL_LOG_INFO("GL_ARB_ES3_compatibility not supported, using OpenGL 3.2");
-        *version = yagl_gl_3;
+        *version = yagl_gl_3_2;
         res = true;
         goto out;
     }
 
-    YAGL_LOG_INFO("GL_ARB_ES3_compatibility not supported, OpenGL 3.2 not supported, using OpenGL 2.1");
-    *version = yagl_gl_2;
+    YAGL_LOG_INFO("GL_ARB_ES3_compatibility not supported, OpenGL 3.2 not supported, using OpenGL 3.1");
+    *version = yagl_gl_3_1;
     res = true;
 
 out:
index b2b7a6323d769caac1d5af2c552f221fe7577bbd..436757cbbc0ef0dd58bae9e45861af5012840992 100644 (file)
@@ -36,10 +36,12 @@ typedef enum
 {
     /* OpenGL 2.1 or OpenGL >= 3.1 compatibility. */
     yagl_gl_2 = 0,
-    /* OpenGL >= 3.2 core, no GL_ARB_ES3_compatibility support. */
-    yagl_gl_3 = 1,
+    /* OpenGL >= 3.1 core. */
+    yagl_gl_3_1 = 1,
     /* OpenGL >= 3.1 core, GL_ARB_ES3_compatibility support. */
-    yagl_gl_3_es3 = 2
+    yagl_gl_3_1_es3 = 2,
+    /* OpenGL >= 3.2 core, no GL_ARB_ES3_compatibility support. */
+    yagl_gl_3_2 = 3
 } yagl_gl_version;
 
 typedef bool (*yagl_api_func)(struct yagl_transport */*t*/);