forked from enlightenment/efl
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.
This commit is contained in:
parent
34480d3d5d
commit
411bc27390
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue