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 *
|
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)
|
if (!evgl_engine)
|
||||||
{
|
{
|
||||||
ERR("Invalid input data. Engine: %p", evgl_engine);
|
ERR("Invalid input data. Engine: %p", evgl_engine);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef GL_GLES
|
|
||||||
return sfc->egl_image;
|
if (sfc->egl_image)
|
||||||
#else
|
{
|
||||||
return (void *)(uintptr_t)sfc->color_buf;
|
buf = sfc->egl_image;
|
||||||
#endif
|
*is_egl_image = EINA_TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = (void *)(uintptr_t)sfc->color_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -44,11 +44,11 @@ typedef struct _EVGL_Surface_Cap EVGL_Surface_Cap;
|
||||||
typedef struct _EVGL_Surface_Format EVGL_Surface_Format;
|
typedef struct _EVGL_Surface_Format EVGL_Surface_Format;
|
||||||
|
|
||||||
EAPI void evgl_engine_shutdown(void *eng_data);
|
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);
|
EAPI int evgl_native_surface_yinvert_get(EVGL_Surface *sfc);
|
||||||
|
|
||||||
typedef void (*EVGL_Engine_Call)(void *eng_data);
|
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);
|
typedef int (*EVGL_Native_Surface_Yinvert_Call)(void *sfc);
|
||||||
|
|
||||||
EVGL_Engine *evgl_engine_init(void *eng_data, const EVGL_Interface *efunc);
|
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)
|
if (n->surface)
|
||||||
{
|
{
|
||||||
#ifdef GL_GLES
|
Eina_Bool is_egl_image;
|
||||||
void *surface = glsym_evgl_native_surface_buffer_get(n->surface);
|
void *buffer = glsym_evgl_native_surface_buffer_get(n->surface, &is_egl_image);
|
||||||
if (glsym_glEGLImageTargetTexture2DOES)
|
if (is_egl_image)
|
||||||
{
|
{
|
||||||
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, surface);
|
#ifdef GL_GLES
|
||||||
if (eglGetError() != EGL_SUCCESS)
|
if (glsym_glEGLImageTargetTexture2DOES)
|
||||||
ERR("glEGLImageTargetTexture2DOES() failed.");
|
{
|
||||||
|
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, buffer);
|
||||||
|
if (eglGetError() != EGL_SUCCESS)
|
||||||
|
ERR("glEGLImageTargetTexture2DOES() failed.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
|
{
|
||||||
#else
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)buffer);
|
||||||
GLuint tex = (GLuint)(uintptr_t)glsym_evgl_native_surface_buffer_get(n->surface);
|
}
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue