Evas GL: Always return "OpenGL ES 2.0" as version
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 27 Nov 2014 08:17:03 +0000 (17:17 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 27 Nov 2014 11:50:47 +0000 (20:50 +0900)
This time it's for desktop GL.

I decided to keep some vendor info, as it can help for debugging
purposes.

src/modules/evas/engines/gl_common/evas_gl_api.c

index 86970d6..4992acd 100644 (file)
@@ -583,7 +583,10 @@ _evgl_glGetString(GLenum name)
      {
       case GL_VENDOR:
       case GL_RENDERER:
-      case GL_SHADING_LANGUAGE_VERSION: // wrap me?
+      case GL_SHADING_LANGUAGE_VERSION:
+        // GLSL version example strings (for the same GPU):
+        // For OpenGL ES 2.0 or 3.0: "OpenGL ES GLSL ES 3.10"
+        // For Desktop OpenGL: "4.40 NVIDIA via Cg compiler"
         break;
       case GL_VERSION:
         ret = glGetString(GL_VERSION);
@@ -593,10 +596,20 @@ _evgl_glGetString(GLenum name)
              // We try not to remove the vendor fluff (contains driver version)
              strncpy(_version, (const char *) ret, sizeof(_version));
              r = strchr(_version, '3');
-             *r++ = '2';
-             *r++ = '.';
-             *r++ = '0';
-             *r   = ' ';
+             if (r)
+               {
+                  *r++ = '2';
+                  *r++ = '.';
+                  *r++ = '0';
+                  *r   = ' ';
+               }
+             _version[sizeof(_version) - 1] = '\0';
+             return (const GLubyte *) _version;
+          }
+        else if (!strstr((const char *) ret, "OpenGL ES"))
+          {
+             // Desktop GL, we still keep the official name
+             snprintf(_version, sizeof(_version), "OpenGL ES 2.0 (%s)", (char *) ret);
              _version[sizeof(_version) - 1] = '\0';
              return (const GLubyte *) _version;
           }