jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=411bc27390a102ffdb9d8bf77d34929b630ac8f1

commit 411bc27390a102ffdb9d8bf77d34929b630ac8f1
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Wed Apr 29 22:56:52 2015 +0900

    Evas GL: Share texture id in case EGL image is not supported
    
    Summary:
    When EGL image is not supported, Evas GL should share texture id
    to the gl backend for indirect rendering to work.
---
 src/modules/evas/engines/gl_common/evas_gl_core.c | 22 +++++++++++++-----
 src/modules/evas/engines/gl_common/evas_gl_core.h |  4 ++--
 src/modules/evas/engines/gl_x11/evas_engine.c     | 27 ++++++++++++++---------
 3 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c 
b/src/modules/evas/engines/gl_common/evas_gl_core.c
index c8cc686..5325bfe 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -2563,18 +2563,28 @@ evgl_safe_extension_get(const char *name, void 
**pfuncptr)
 }
 
 void *
-evgl_native_surface_buffer_get(EVGL_Surface *sfc)
+evgl_native_surface_buffer_get(EVGL_Surface *sfc, Eina_Bool *is_egl_image)
 {
+   void *buf = NULL;
+   *is_egl_image = EINA_FALSE;
+
    if (!evgl_engine)
      {
         ERR("Invalid input data.  Engine: %p", evgl_engine);
         return NULL;
      }
-#ifdef GL_GLES
-   return sfc->egl_image;
-#else
-   return (void *)(uintptr_t)sfc->color_buf;
-#endif
+
+   if (sfc->egl_image)
+     {
+        buf = sfc->egl_image;
+        *is_egl_image = EINA_TRUE;
+     }
+   else
+     {
+        buf = (void *)(uintptr_t)sfc->color_buf;
+     }
+
+   return buf;
 }
 
 int
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h 
b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 5a0811a..352e647 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -44,11 +44,11 @@ typedef struct _EVGL_Surface_Cap    EVGL_Surface_Cap;
 typedef struct _EVGL_Surface_Format EVGL_Surface_Format;
 
 EAPI void         evgl_engine_shutdown(void *eng_data);
-EAPI void        *evgl_native_surface_buffer_get(EVGL_Surface *sfc);
+EAPI void        *evgl_native_surface_buffer_get(EVGL_Surface *sfc, Eina_Bool 
*is_egl_image);
 EAPI int          evgl_native_surface_yinvert_get(EVGL_Surface *sfc);
 
 typedef void (*EVGL_Engine_Call)(void *eng_data);
-typedef void *(*EVGL_Native_Surface_Call)(void *sfc);
+typedef void *(*EVGL_Native_Surface_Call)(void *sfc, Eina_Bool *is_egl_image);
 typedef int (*EVGL_Native_Surface_Yinvert_Call)(void *sfc);
 
 EVGL_Engine *evgl_engine_init(void *eng_data, const EVGL_Interface *efunc);
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index b850e68..949f910 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2050,20 +2050,25 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
     {
       if (n->surface)
         {
-#ifdef GL_GLES
-          void *surface = glsym_evgl_native_surface_buffer_get(n->surface);
-          if (glsym_glEGLImageTargetTexture2DOES)
+          Eina_Bool is_egl_image;
+          void *buffer = glsym_evgl_native_surface_buffer_get(n->surface, 
&is_egl_image);
+          if (is_egl_image)
             {
-              glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, surface);
-              if (eglGetError() != EGL_SUCCESS)
-                ERR("glEGLImageTargetTexture2DOES() failed.");
+#ifdef GL_GLES
+               if (glsym_glEGLImageTargetTexture2DOES)
+                 {
+                    glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, buffer);
+                    if (eglGetError() != EGL_SUCCESS)
+                      ERR("glEGLImageTargetTexture2DOES() failed.");
+                 }
+               else
+#endif
+                 ERR("Try glEGLImageTargetTexture2DOES on EGL with no 
support");
             }
           else
-            ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
-#else
-          GLuint tex = 
(GLuint)(uintptr_t)glsym_evgl_native_surface_buffer_get(n->surface);
-          glBindTexture(GL_TEXTURE_2D, tex);
-#endif
+            {
+               glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)buffer);
+            }
         }
     }
 }

-- 


Reply via email to