forked from enlightenment/efl
Evas GL: use texture for native surface in glx backend
Summary: EVAS_NATIVE_SURFACE_EVASGL uses egl image, but egl image is not supported in glx backend, so use texture instead. Test Plan: Local tests on pc Reviewers: jpeg Subscribers: cedric, mer.kim, mythri, wonsik Differential Revision: https://phab.enlightenment.org/D2174 jpeg: fixed casts
This commit is contained in:
parent
0585540bb3
commit
61758b8281
|
@ -833,9 +833,6 @@ _surface_cap_init(void *eng_data)
|
|||
static int
|
||||
_context_ext_check(EVGL_Context *ctx)
|
||||
{
|
||||
int fbo_supported = 0;
|
||||
int egl_image_supported = 0;
|
||||
|
||||
if (!ctx)
|
||||
return 0;
|
||||
|
||||
|
@ -843,6 +840,9 @@ _context_ext_check(EVGL_Context *ctx)
|
|||
return 1;
|
||||
|
||||
#ifdef GL_GLES
|
||||
int fbo_supported = 0;
|
||||
int egl_image_supported = 0;
|
||||
|
||||
switch (ctx->version)
|
||||
{
|
||||
case EVAS_GL_GLES_1_X:
|
||||
|
@ -858,13 +858,12 @@ _context_ext_check(EVGL_Context *ctx)
|
|||
if (EXTENSION_SUPPORT(EGL_KHR_image_base)
|
||||
&& EXTENSION_SUPPORT(EGL_KHR_gl_texture_2D_image))
|
||||
egl_image_supported = 1;
|
||||
#else
|
||||
fbo_supported = 1;
|
||||
egl_image_supported = 0;
|
||||
#endif
|
||||
|
||||
if (fbo_supported && egl_image_supported)
|
||||
ctx->fbo_image_supported = 1;
|
||||
#else
|
||||
ctx->fbo_image_supported = 1;
|
||||
#endif
|
||||
|
||||
ctx->extension_checked = 1;
|
||||
|
||||
|
@ -2593,15 +2592,18 @@ evgl_safe_extension_get(const char *name, void **pfuncptr)
|
|||
}
|
||||
|
||||
void *
|
||||
evgl_native_surface_egl_image_get(EVGL_Surface *sfc)
|
||||
evgl_native_surface_buffer_get(EVGL_Surface *sfc)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -21,7 +21,7 @@ EAPI void evgl_engine_shutdown(void *eng_data);
|
|||
|
||||
typedef void (*EVGL_Engine_Call)(void *eng_data);
|
||||
|
||||
EAPI void *evgl_native_surface_egl_image_get(EVGL_Surface *sfc);
|
||||
EAPI void *evgl_native_surface_buffer_get(EVGL_Surface *sfc);
|
||||
|
||||
typedef void *(*EVGL_Native_Surface_Call)(void *sfc);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
|
|||
Evas_GL_Preload glsym_evas_gl_preload_init = NULL;
|
||||
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_egl_image_get = NULL;
|
||||
EVGL_Native_Surface_Call glsym_evgl_native_surface_buffer_get = NULL;
|
||||
Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
|
||||
|
||||
Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
|
||||
|
@ -1275,7 +1275,7 @@ gl_symbols(void)
|
|||
LINK2GENERIC(evas_gl_preload_init);
|
||||
LINK2GENERIC(evas_gl_preload_shutdown);
|
||||
LINK2GENERIC(evgl_engine_shutdown);
|
||||
LINK2GENERIC(evgl_native_surface_egl_image_get);
|
||||
LINK2GENERIC(evgl_native_surface_buffer_get);
|
||||
LINK2GENERIC(evas_gl_symbols);
|
||||
LINK2GENERIC(evas_gl_common_error_get);
|
||||
LINK2GENERIC(evas_gl_common_error_set);
|
||||
|
@ -1936,9 +1936,9 @@ struct _Native
|
|||
Visual *visual;
|
||||
void *buffer;
|
||||
|
||||
#ifdef GL_GLES
|
||||
void *egl_surface;
|
||||
#else
|
||||
|
||||
#ifndef GL_GLES
|
||||
void *fbc;
|
||||
XID glx_pixmap;
|
||||
#endif
|
||||
|
@ -2010,10 +2010,10 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
|
|||
}
|
||||
else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
|
||||
{
|
||||
#ifdef GL_GLES
|
||||
if (n->egl_surface)
|
||||
{
|
||||
void *surface = glsym_evgl_native_surface_egl_image_get(n->egl_surface);
|
||||
#ifdef GL_GLES
|
||||
void *surface = glsym_evgl_native_surface_buffer_get(n->egl_surface);
|
||||
if (glsym_glEGLImageTargetTexture2DOES)
|
||||
{
|
||||
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, surface);
|
||||
|
@ -2022,10 +2022,11 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
|
|||
}
|
||||
else
|
||||
ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
|
||||
}
|
||||
#else
|
||||
// TODO
|
||||
GLuint tex = (GLuint)(uintptr_t)glsym_evgl_native_surface_buffer_get(n->egl_surface);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2064,11 @@ _native_unbind_cb(void *data EINA_UNUSED, void *image)
|
|||
}
|
||||
else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
|
||||
{
|
||||
#ifdef GL_GLES
|
||||
// nothing
|
||||
#else
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2694,12 +2699,8 @@ eng_image_native_set(void *data, void *image, void *native)
|
|||
|
||||
n->pixmap = 0;
|
||||
n->visual = 0;
|
||||
#ifdef GL_GLES
|
||||
|
||||
n->egl_surface = ns->data.evasgl.surface;
|
||||
#else
|
||||
n->fbc = 0;
|
||||
n->glx_pixmap = 0;
|
||||
#endif
|
||||
|
||||
im->native.yinvert = 0;
|
||||
im->native.loose = 0;
|
||||
|
|
Loading…
Reference in New Issue