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
This commit is contained in:
Dongyeon Kim 2015-04-30 16:04:47 +09:00 committed by Jean-Philippe Andre
parent 660bfcf3c2
commit e4e67732c2
3 changed files with 28 additions and 7 deletions

View File

@ -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);;
}
//---------------------------------------------------------------//

View File

@ -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);

View File

@ -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