jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9a0f5913144da3def33e246e0438c8529f367298

commit 9a0f5913144da3def33e246e0438c8529f367298
Author: Minkyoung Kim <mer....@samsung.com>
Date:   Tue Feb 24 19:32:35 2015 +0900

    Evas GL: Wrap glGetString() for gles1.x.
    
    Summary:
    - Implement glGetString() wrapper func in the same way as gles2.x.
    - Small bug fix glGetString() for gles2.x.
    
    Reviewers: cedric, raster, jpeg
    
    Subscribers: cedric, mythri, wonsik, spacegrapher
    
    Differential Revision: https://phab.enlightenment.org/D2033
---
 src/modules/evas/engines/gl_common/evas_gl_api.c   |  4 +-
 .../evas/engines/gl_common/evas_gl_api_gles1.c     | 57 ++++++++++++++++++++--
 2 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c 
b/src/modules/evas/engines/gl_common/evas_gl_api.c
index 2628aff..2bad209 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -689,7 +689,7 @@ _evgl_glGetString(GLenum name)
         ret = glGetString(GL_SHADING_LANGUAGE_VERSION);
         if (!ret) return NULL;
 #ifdef GL_GLES
-        if (ret[15] != (GLubyte) '1')
+        if (ret[18] != (GLubyte) '1')
           {
              // We try not to remove the vendor fluff
              snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL 
(%s)", ((char *) ret) + 18);
@@ -708,7 +708,7 @@ _evgl_glGetString(GLenum name)
         ret = glGetString(GL_VERSION);
         if (!ret) return NULL;
 #ifdef GL_GLES
-        if (ret[11] != (GLubyte) '2')
+        if (ret[10] != (GLubyte) '2')
           {
              // We try not to remove the vendor fluff
              snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL 
(%s)", ((char *) ret) + 10);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c 
b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
index 18f9689..fbc5449 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
@@ -1016,11 +1016,62 @@ _evgl_gles1_glGetPointerv(GLenum pname, GLvoid **params)
 static const GLubyte *
 _evgl_gles1_glGetString(GLenum name)
 {
-   const GLubyte * ret;
+   static char _version[128] = {0};
+   EVGL_Resource *rsc;
+   const GLubyte *ret;
+
    if (!_gles1_api.glGetString)
      return NULL;
-   ret = _gles1_api.glGetString(name);
-   return ret;
+
+   if ((!(rsc = _evgl_tls_resource_get())) || !rsc->current_ctx)
+     {
+        ERR("Current context is NULL, not calling glGetString");
+        // This sets evas_gl_error_get instead of glGetError...
+        evas_gl_common_error_set(NULL, EVAS_GL_BAD_CONTEXT);
+        return NULL;
+     }
+
+   if (rsc->current_ctx->version != EVAS_GL_GLES_1_X)
+     {
+        ERR("Invalid context version %d", (int) rsc->current_ctx->version);
+        evas_gl_common_error_set(NULL, EVAS_GL_BAD_MATCH);
+        return NULL;
+     }
+
+   switch (name)
+     {
+      case GL_VENDOR:
+      case GL_RENDERER:
+      case GL_SHADING_LANGUAGE_VERSION:
+        break;
+      case GL_VERSION:
+        ret = glGetString(GL_VERSION);
+        if (!ret) return NULL;
+#ifdef GL_GLES
+        if (ret[13] != (GLubyte) '1')
+          {
+             // We try not to remove the vendor fluff
+             snprintf(_version, sizeof(_version), "OpenGL ES-CM 1.1 Evas GL 
(%s)", ((char *) ret) + 10);
+             _version[sizeof(_version) - 1] = '\0';
+             return (const GLubyte *) _version;
+          }
+        return ret;
+#else
+        // Desktop GL, we still keep the official name
+        snprintf(_version, sizeof(_version), "OpenGL ES-CM 1.1 Evas GL (%s)", 
(char *) ret);
+        _version[sizeof(_version) - 1] = '\0';
+        return (const GLubyte *) _version;
+#endif
+
+      case GL_EXTENSIONS:
+        return (GLubyte *) evgl_api_ext_string_get(EINA_TRUE, EINA_TRUE);
+
+      default:
+        WRN("Unknown string requested: %x", (unsigned int) name);
+        break;
+     }
+
+   return _gles1_api.glGetString(name);
 }
 
 static void

-- 


Reply via email to