jpeg pushed a commit to branch master.

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

commit e4e67732c26d581ff0cf3ae3ef4d5f460b574e60
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Thu Apr 30 16:04:47 2015 +0900

    Evas GL: return correct context for context_get with indirect context
    
    Summary:
    When evas gl falls back to using indirect context,
    evas_gl_current_context_get() should return the indirect context.
    @fix
---
 src/modules/evas/engines/gl_common/evas_gl_core.c | 18 +++++++++++++++++-
 src/modules/evas/engines/gl_common/evas_gl_core.h |  2 ++
 src/modules/evas/engines/gl_x11/evas_engine.c     | 15 +++++++++------
 3 files changed, 28 insertions(+), 7 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 3b75ca3..a173c4e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1500,6 +1500,22 @@ evas_gl_common_current_context_get(void)
      return rsc->current_ctx;
 }
 
+EAPI void *
+evgl_current_native_context_get(EVGL_Context *ctx)
+{
+   EVGLNative_Context context;
+
+   if (!ctx)
+     return NULL;
+
+   context = ctx->context;
+
+   if ((ctx->pixmap_image_supported) && evgl_direct_rendered())
+     context = ctx->indirect_context;
+
+   return context;
+}
+
 int
 _evgl_not_in_pixel_get(void)
 {
@@ -1577,7 +1593,7 @@ _evgl_native_context_get(Evas_GL_Context *ctx)
 
    evglctx = glsym_evas_gl_native_context_get(ctx);
    if (!evglctx) return NULL;
-   return evglctx->context;
+   return evgl_current_native_context_get(evglctx);;
 }
 
 //---------------------------------------------------------------//
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 352e647..43d32a6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -46,10 +46,12 @@ 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, Eina_Bool 
*is_egl_image);
 EAPI int          evgl_native_surface_yinvert_get(EVGL_Surface *sfc);
+EAPI void        *evgl_current_native_context_get(EVGL_Context *ctx);
 
 typedef void (*EVGL_Engine_Call)(void *eng_data);
 typedef void *(*EVGL_Native_Surface_Call)(void *sfc, Eina_Bool *is_egl_image);
 typedef int (*EVGL_Native_Surface_Yinvert_Call)(void *sfc);
+typedef void *(*EVGL_Current_Native_Context_Get_Call)(void *ctx);
 
 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 949f910..604f22e 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -61,6 +61,7 @@ Evas_GL_Preload glsym_evas_gl_preload_shutdown = NULL;
 EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL;
 EVGL_Native_Surface_Call glsym_evgl_native_surface_buffer_get = NULL;
 EVGL_Native_Surface_Yinvert_Call glsym_evgl_native_surface_yinvert_get = NULL;
+EVGL_Current_Native_Context_Get_Call glsym_evgl_current_native_context_get = 
NULL;
 Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
 
 Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
@@ -1280,6 +1281,7 @@ gl_symbols(void)
    LINK2GENERIC(evgl_engine_shutdown);
    LINK2GENERIC(evgl_native_surface_buffer_get);
    LINK2GENERIC(evgl_native_surface_yinvert_get);
+   LINK2GENERIC(evgl_current_native_context_get);
    LINK2GENERIC(evas_gl_symbols);
    LINK2GENERIC(evas_gl_common_error_get);
    LINK2GENERIC(evas_gl_common_error_set);
@@ -1918,22 +1920,23 @@ static void *
 eng_gl_current_context_get(void *data EINA_UNUSED)
 {
    EVGL_Context *ctx;
+   EVGLNative_Context context;
 
    ctx = glsym_evas_gl_common_current_context_get();
    if (!ctx)
      return NULL;
 
+   context = glsym_evgl_current_native_context_get(ctx);
+
 #ifdef GL_GLES
-   if (eglGetCurrentContext() == (ctx->context))
+   if (eglGetCurrentContext() == context)
      return ctx;
-   else
-     return NULL;
 #else
-   if (glXGetCurrentContext() == (ctx->context))
+   if (glXGetCurrentContext() == context)
      return ctx;
-   else
-     return NULL;
 #endif
+
+   return NULL;
 }
 
 static int

-- 


Reply via email to