forked from enlightenment/efl
evas engines: Stop using arrays of 1 member for egl context and surface
There's actually an array of 2 in gl_x11, but it appears we only use the first 1, except in an #if 0 block. I gather this is legacy for some reason - it sure doesn't seem to make any sense now, so I'm chopping off all the extra array indexes. Note: I've not changed gl_sdl - it looks like it doesn't use the context or surface at all and they could just be removed, but I don't build that one here and don't want to touch it.
This commit is contained in:
parent
6f41b7a690
commit
c11b66434f
|
@ -311,7 +311,7 @@ evgl_eng_evas_surface_get(void *data)
|
|||
}
|
||||
|
||||
if (eng_get_ob(re))
|
||||
return (void *)eng_get_ob(re)->egl.surface[0];
|
||||
return (void *)eng_get_ob(re)->egl.surface;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version ver
|
|||
{
|
||||
context = eglCreateContext(eng_get_ob(re)->egl.disp,
|
||||
eng_get_ob(re)->egl.config,
|
||||
eng_get_ob(re)->egl.context[0], // Evas' GL Context
|
||||
eng_get_ob(re)->egl.context, // Evas' GL Context
|
||||
context_attrs);
|
||||
}
|
||||
|
||||
|
@ -597,8 +597,8 @@ eng_preload_make_current(void *data, void *doit)
|
|||
|
||||
if (doit)
|
||||
{
|
||||
if (!eglMakeCurrent(ob->egl.disp, ob->egl.surface[0],
|
||||
ob->egl.surface[0], ob->egl.context[0]))
|
||||
if (!eglMakeCurrent(ob->egl.disp, ob->egl.surface,
|
||||
ob->egl.surface, ob->egl.context))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -94,8 +94,8 @@ struct _Outbuf
|
|||
|
||||
struct
|
||||
{
|
||||
EGLContext context[1];
|
||||
EGLSurface surface[1];
|
||||
EGLContext context;
|
||||
EGLSurface surface;
|
||||
EGLConfig config;
|
||||
EGLDisplay disp;
|
||||
} egl;
|
||||
|
|
|
@ -147,8 +147,8 @@ _evas_outbuf_make_current(void *data, void *doit)
|
|||
|
||||
if (doit)
|
||||
{
|
||||
if (!eglMakeCurrent(ob->egl.disp, ob->egl.surface[0],
|
||||
ob->egl.surface[0], ob->egl.context[0]))
|
||||
if (!eglMakeCurrent(ob->egl.disp, ob->egl.surface,
|
||||
ob->egl.surface, ob->egl.context))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -282,33 +282,33 @@ _evas_outbuf_egl_setup(Outbuf *ob)
|
|||
}
|
||||
|
||||
#ifdef EGL_MESA_platform_gbm
|
||||
ob->egl.surface[0] =
|
||||
ob->egl.surface =
|
||||
dlsym_eglCreatePlatformWindowSurfaceEXT(ob->egl.disp, ob->egl.config,
|
||||
ob->surface, NULL);
|
||||
#else
|
||||
ob->egl.surface[0] =
|
||||
ob->egl.surface =
|
||||
eglCreateWindowSurface(ob->egl.disp, ob->egl.config,
|
||||
(EGLNativeWindowType)ob->surface, NULL);
|
||||
#endif
|
||||
if (ob->egl.surface[0] == EGL_NO_SURFACE)
|
||||
if (ob->egl.surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
ob->surface, eglGetError());
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
ob->egl.context[0] =
|
||||
ob->egl.context =
|
||||
eglCreateContext(ob->egl.disp, ob->egl.config, context, ctx_attr);
|
||||
if (ob->egl.context[0] == EGL_NO_CONTEXT)
|
||||
if (ob->egl.context == EGL_NO_CONTEXT)
|
||||
{
|
||||
ERR("eglCreateContext() fail. code=%#x", eglGetError());
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (context == EGL_NO_CONTEXT) context = ob->egl.context[0];
|
||||
if (context == EGL_NO_CONTEXT) context = ob->egl.context;
|
||||
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface[0],
|
||||
ob->egl.surface[0], ob->egl.context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface,
|
||||
ob->egl.surface, ob->egl.context) == EGL_FALSE)
|
||||
{
|
||||
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
return EINA_FALSE;
|
||||
|
@ -354,7 +354,7 @@ _evas_outbuf_egl_setup(Outbuf *ob)
|
|||
|
||||
#ifdef GL_GLES
|
||||
ob->gl_context->egldisp = ob->egl.disp;
|
||||
ob->gl_context->eglctxt = ob->egl.context[0];
|
||||
ob->gl_context->eglctxt = ob->egl.context;
|
||||
#endif
|
||||
|
||||
evas_outbuf_use(ob);
|
||||
|
@ -433,11 +433,11 @@ evas_outbuf_free(Outbuf *ob)
|
|||
|
||||
eglMakeCurrent(ob->egl.disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
if (ob->egl.context[0] != context)
|
||||
eglDestroyContext(ob->egl.disp, ob->egl.context[0]);
|
||||
if (ob->egl.context != context)
|
||||
eglDestroyContext(ob->egl.disp, ob->egl.context);
|
||||
|
||||
if (ob->egl.surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(ob->egl.disp, ob->egl.surface[0]);
|
||||
if (ob->egl.surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(ob->egl.disp, ob->egl.surface);
|
||||
|
||||
_evas_outbuf_gbm_surface_destroy(ob);
|
||||
|
||||
|
@ -461,7 +461,7 @@ evas_outbuf_use(Outbuf *ob)
|
|||
|
||||
if (_evas_gl_drm_window)
|
||||
{
|
||||
if (eglGetCurrentContext() != _evas_gl_drm_window->egl.context[0])
|
||||
if (eglGetCurrentContext() != _evas_gl_drm_window->egl.context)
|
||||
force = EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -477,11 +477,11 @@ evas_outbuf_use(Outbuf *ob)
|
|||
|
||||
if (ob)
|
||||
{
|
||||
if (ob->egl.surface[0] != EGL_NO_SURFACE)
|
||||
if (ob->egl.surface != EGL_NO_SURFACE)
|
||||
{
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface[0],
|
||||
ob->egl.surface[0],
|
||||
ob->egl.context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface,
|
||||
ob->egl.surface,
|
||||
ob->egl.context) == EGL_FALSE)
|
||||
ERR("eglMakeCurrent() failed!");
|
||||
}
|
||||
}
|
||||
|
@ -496,19 +496,19 @@ evas_outbuf_resurf(Outbuf *ob)
|
|||
if (ob->surf) return;
|
||||
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", ob);
|
||||
|
||||
ob->egl.surface[0] =
|
||||
ob->egl.surface =
|
||||
eglCreateWindowSurface(ob->egl.disp, ob->egl.config,
|
||||
(EGLNativeWindowType)ob->surface, NULL);
|
||||
|
||||
if (ob->egl.surface[0] == EGL_NO_SURFACE)
|
||||
if (ob->egl.surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
ob->surface, eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface[0], ob->egl.surface[0],
|
||||
ob->egl.context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(ob->egl.disp, ob->egl.surface, ob->egl.surface,
|
||||
ob->egl.context) == EGL_FALSE)
|
||||
ERR("eglMakeCurrent() failed!");
|
||||
|
||||
ob->surf = EINA_TRUE;
|
||||
|
@ -527,9 +527,9 @@ evas_outbuf_unsurf(Outbuf *ob)
|
|||
{
|
||||
eglMakeCurrent(ob->egl.disp, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (ob->egl.surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(ob->egl.disp, ob->egl.surface[0]);
|
||||
ob->egl.surface[0] = EGL_NO_SURFACE;
|
||||
if (ob->egl.surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(ob->egl.disp, ob->egl.surface);
|
||||
ob->egl.surface = EGL_NO_SURFACE;
|
||||
|
||||
_evas_gl_drm_window = NULL;
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ evas_outbuf_buffer_state_get(Outbuf *ob)
|
|||
EGLint age = 0;
|
||||
|
||||
eina_evlog("+gl_query_surf_swap_mode", ob, 0.0, NULL);
|
||||
if (!eglQuerySurface(ob->egl.disp, ob->egl.surface[0],
|
||||
if (!eglQuerySurface(ob->egl.disp, ob->egl.surface,
|
||||
EGL_BUFFER_AGE_EXT, &age))
|
||||
age = 0;
|
||||
|
||||
|
@ -671,7 +671,7 @@ _damage_rect_set(Outbuf *ob, int x, int y, int w, int h)
|
|||
return;
|
||||
|
||||
_glcoords_convert(rects, ob, x, y, w, h);
|
||||
glsym_eglSetDamageRegionKHR(ob->egl.disp, ob->egl.surface[0], rects, 1);
|
||||
glsym_eglSetDamageRegionKHR(ob->egl.disp, ob->egl.surface, rects, 1);
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -748,12 +748,12 @@ evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer
|
|||
_glcoords_convert(&result[i], ob, r->x, r->y, r->w, r->h);
|
||||
i += 4;
|
||||
}
|
||||
glsym_eglSwapBuffersWithDamage(ob->egl.disp, ob->egl.surface[0],
|
||||
glsym_eglSwapBuffersWithDamage(ob->egl.disp, ob->egl.surface,
|
||||
result, num);
|
||||
}
|
||||
}
|
||||
else
|
||||
eglSwapBuffers(ob->egl.disp, ob->egl.surface[0]);
|
||||
eglSwapBuffers(ob->egl.disp, ob->egl.surface);
|
||||
|
||||
/* if (ob->info->callback.post_swap) */
|
||||
/* ob->info->callback.post_swap(ob->info->callback.data, ob->evas); */
|
||||
|
@ -789,7 +789,7 @@ evas_outbuf_gl_context_new(Outbuf *ob)
|
|||
if (!ctx) return NULL;
|
||||
|
||||
ctx->context = eglCreateContext(ob->egl.disp, ob->egl.config,
|
||||
ob->egl.context[0], context_attrs);
|
||||
ob->egl.context, context_attrs);
|
||||
|
||||
if (!ctx->context)
|
||||
{
|
||||
|
@ -798,7 +798,7 @@ evas_outbuf_gl_context_new(Outbuf *ob)
|
|||
}
|
||||
|
||||
ctx->display = ob->egl.disp;
|
||||
ctx->surface = ob->egl.surface[0];
|
||||
ctx->surface = ob->egl.surface;
|
||||
|
||||
return ctx;
|
||||
|
||||
|
|
|
@ -1946,7 +1946,7 @@ eng_gl_surface_query(void *data, void *surface, int attr, void *value)
|
|||
/*
|
||||
case EVAS_GL_MIPMAP_TEXTURE:
|
||||
case EVAS_GL_MIPMAP_LEVEL:
|
||||
return eglQuerySurface(re->win->egl_disp, re->win->egl_surface[0],
|
||||
return eglQuerySurface(re->win->egl_disp, re->win->egl_surface,
|
||||
attr, (int *) value);
|
||||
*/
|
||||
default: break;
|
||||
|
|
|
@ -155,7 +155,7 @@ evgl_eng_evas_surface_get(void *data)
|
|||
|
||||
#ifdef GL_GLES
|
||||
if (eng_get_ob(re))
|
||||
return (void*)eng_get_ob(re)->egl_surface[0];
|
||||
return (void*)eng_get_ob(re)->egl_surface;
|
||||
#else
|
||||
if (eng_get_ob(re))
|
||||
return (void*)eng_get_ob(re)->win;
|
||||
|
@ -525,7 +525,7 @@ evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version ver
|
|||
{
|
||||
context = eglCreateContext(eng_get_ob(re)->egl_disp,
|
||||
eng_get_ob(re)->egl_config,
|
||||
eng_get_ob(re)->egl_context[0], // Evas' GL Context
|
||||
eng_get_ob(re)->egl_context, // Evas' GL Context
|
||||
context_attrs);
|
||||
}
|
||||
|
||||
|
@ -1876,7 +1876,7 @@ eng_preload_make_current(void *data, void *doit)
|
|||
if (doit)
|
||||
{
|
||||
#ifdef GL_GLES
|
||||
if (!evas_eglMakeCurrent(ob->egl_disp, ob->egl_surface[0], ob->egl_surface[0], ob->egl_context[0]))
|
||||
if (!evas_eglMakeCurrent(ob->egl_disp, ob->egl_surface, ob->egl_surface, ob->egl_context))
|
||||
return EINA_FALSE;
|
||||
#else
|
||||
if (!__glXMakeContextCurrent(ob->info->info.display, ob->glxwin, ob->context))
|
||||
|
|
|
@ -61,8 +61,8 @@ extern int _evas_engine_GL_X11_log_dom ;
|
|||
struct _Outbuf
|
||||
{
|
||||
#ifdef GL_GLES
|
||||
EGLContext egl_context[2];
|
||||
EGLSurface egl_surface[2];
|
||||
EGLContext egl_context;
|
||||
EGLSurface egl_surface;
|
||||
EGLConfig egl_config;
|
||||
EGLDisplay egl_disp;
|
||||
Eina_Bool gles3 : 1;
|
||||
|
|
|
@ -270,10 +270,10 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
|
|||
|
||||
gw->egl_config = evis->config;
|
||||
|
||||
gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
gw->egl_surface = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win,
|
||||
NULL);
|
||||
if (gw->egl_surface[0] == EGL_NO_SURFACE)
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
int err = eglGetError();
|
||||
printf("surf creat fail! %x\n", err);
|
||||
|
@ -289,9 +289,9 @@ try_gles2:
|
|||
context_attrs[2] = EGL_NONE;
|
||||
|
||||
context = _tls_context_get();
|
||||
gw->egl_context[0] = eglCreateContext
|
||||
gw->egl_context = eglCreateContext
|
||||
(gw->egl_disp, gw->egl_config, context, context_attrs);
|
||||
if (gw->egl_context[0] == EGL_NO_CONTEXT)
|
||||
if (gw->egl_context == EGL_NO_CONTEXT)
|
||||
{
|
||||
ERR("eglCreateContext() fail. code=%#x", eglGetError());
|
||||
if (gw->gles3)
|
||||
|
@ -305,13 +305,13 @@ try_gles2:
|
|||
return NULL;
|
||||
}
|
||||
if (context == EGL_NO_CONTEXT)
|
||||
_tls_context_set(gw->egl_context[0]);
|
||||
_tls_context_set(gw->egl_context);
|
||||
|
||||
SET_RESTORE_CONTEXT();
|
||||
if (evas_eglMakeCurrent(gw->egl_disp,
|
||||
gw->egl_surface[0],
|
||||
gw->egl_surface[0],
|
||||
gw->egl_context[0]) == EGL_FALSE)
|
||||
gw->egl_surface,
|
||||
gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("evas_eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
eng_window_free(gw);
|
||||
|
@ -595,7 +595,7 @@ try_gles2:
|
|||
}
|
||||
#ifdef GL_GLES
|
||||
gw->gl_context->egldisp = gw->egl_disp;
|
||||
gw->gl_context->eglctxt = gw->egl_context[0];
|
||||
gw->gl_context->eglctxt = gw->egl_context;
|
||||
#else
|
||||
glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgb);
|
||||
glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgba);
|
||||
|
@ -629,12 +629,10 @@ eng_window_free(Outbuf *gw)
|
|||
#ifdef GL_GLES
|
||||
SET_RESTORE_CONTEXT();
|
||||
evas_eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
|
||||
if (gw->egl_surface[1] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[1]);
|
||||
if (gw->egl_context[0] != context)
|
||||
eglDestroyContext(gw->egl_disp, gw->egl_context[0]);
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface);
|
||||
if (gw->egl_context != context)
|
||||
eglDestroyContext(gw->egl_disp, gw->egl_context);
|
||||
if (ref == 0)
|
||||
{
|
||||
if (context) eglDestroyContext(gw->egl_disp, context);
|
||||
|
@ -669,7 +667,7 @@ eng_window_make_current(void *data, void *doit)
|
|||
SET_RESTORE_CONTEXT();
|
||||
if (doit)
|
||||
{
|
||||
if (!evas_eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0], gw->egl_context[0]))
|
||||
if (!evas_eglMakeCurrent(gw->egl_disp, gw->egl_surface, gw->egl_surface, gw->egl_context))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -710,15 +708,7 @@ eng_window_use(Outbuf *gw)
|
|||
if (xwin)
|
||||
{
|
||||
if ((evas_eglGetCurrentDisplay() != xwin->egl_disp) ||
|
||||
(evas_eglGetCurrentContext() != xwin->egl_context[0])
|
||||
#if 0
|
||||
// FIXME: Figure out what that offscreen thing was about...
|
||||
|| (evas_eglGetCurrentSurface(EGL_READ) !=
|
||||
xwin->egl_surface[xwin->offscreen])
|
||||
|| (evas_eglGetCurrentSurface(EGL_DRAW) !=
|
||||
xwin->egl_surface[xwin->offscreen])
|
||||
#endif
|
||||
)
|
||||
(evas_eglGetCurrentContext() != xwin->egl_context))
|
||||
force_use = EINA_TRUE;
|
||||
}
|
||||
#else
|
||||
|
@ -740,13 +730,13 @@ eng_window_use(Outbuf *gw)
|
|||
{
|
||||
// EGL / GLES
|
||||
#ifdef GL_GLES
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
SET_RESTORE_CONTEXT();
|
||||
if (evas_eglMakeCurrent(gw->egl_disp,
|
||||
gw->egl_surface[0],
|
||||
gw->egl_surface[0],
|
||||
gw->egl_context[0]) == EGL_FALSE)
|
||||
gw->egl_surface,
|
||||
gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("evas_eglMakeCurrent() failed!");
|
||||
}
|
||||
|
@ -780,12 +770,9 @@ eng_window_unsurf(Outbuf *gw)
|
|||
{
|
||||
SET_RESTORE_CONTEXT();
|
||||
evas_eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
|
||||
gw->egl_surface[0] = EGL_NO_SURFACE;
|
||||
if (gw->egl_surface[1] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[1]);
|
||||
gw->egl_surface[1] = EGL_NO_SURFACE;
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface);
|
||||
gw->egl_surface = EGL_NO_SURFACE;
|
||||
_tls_outbuf_set(NULL);
|
||||
}
|
||||
#else
|
||||
|
@ -804,10 +791,10 @@ eng_window_resurf(Outbuf *gw)
|
|||
if (gw->surf) return;
|
||||
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw);
|
||||
#ifdef GL_GLES
|
||||
gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
gw->egl_surface = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win,
|
||||
NULL);
|
||||
if (gw->egl_surface[0] == EGL_NO_SURFACE)
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
|
||||
(unsigned int)gw->win, eglGetError());
|
||||
|
@ -815,9 +802,9 @@ eng_window_resurf(Outbuf *gw)
|
|||
}
|
||||
SET_RESTORE_CONTEXT();
|
||||
if (evas_eglMakeCurrent(gw->egl_disp,
|
||||
gw->egl_surface[0],
|
||||
gw->egl_surface[0],
|
||||
gw->egl_context[0]) == EGL_FALSE)
|
||||
gw->egl_surface,
|
||||
gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("evas_eglMakeCurrent() failed!");
|
||||
}
|
||||
|
@ -1323,7 +1310,7 @@ eng_gl_context_new(Outbuf *win)
|
|||
if (win->gles3)
|
||||
context_attrs[1] = 3;
|
||||
ctx->context = eglCreateContext(win->egl_disp, win->egl_config,
|
||||
win->egl_context[0], context_attrs);
|
||||
win->egl_context, context_attrs);
|
||||
|
||||
if (!ctx->context)
|
||||
{
|
||||
|
@ -1332,7 +1319,7 @@ eng_gl_context_new(Outbuf *win)
|
|||
}
|
||||
|
||||
ctx->display = win->egl_disp;
|
||||
ctx->surface = win->egl_surface[0];
|
||||
ctx->surface = win->egl_surface;
|
||||
#else
|
||||
ctx->context = glXCreateContext(win->disp, win->visualinfo, win->context, 1);
|
||||
|
||||
|
@ -1412,7 +1399,7 @@ eng_outbuf_swap_mode(Outbuf *ob)
|
|||
#ifdef GL_GLES
|
||||
EGLint age = 0;
|
||||
|
||||
if (!eglQuerySurface(ob->egl_disp, ob->egl_surface[0],
|
||||
if (!eglQuerySurface(ob->egl_disp, ob->egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &age))
|
||||
age = 0;
|
||||
#else
|
||||
|
@ -1536,7 +1523,7 @@ eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage)
|
|||
_convert_to_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h);
|
||||
rect += 4;
|
||||
}
|
||||
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, count);
|
||||
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface, rects, count);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1636,12 +1623,12 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R
|
|||
i += 4;
|
||||
}
|
||||
glsym_eglSwapBuffersWithDamage(ob->egl_disp,
|
||||
ob->egl_surface[0],
|
||||
ob->egl_surface,
|
||||
result, num);
|
||||
}
|
||||
}
|
||||
else
|
||||
eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
|
||||
eglSwapBuffers(ob->egl_disp, ob->egl_surface);
|
||||
|
||||
//xx if (!safe_native) eglWaitGL();
|
||||
// if (eglGetError() != EGL_SUCCESS)
|
||||
|
|
|
@ -270,7 +270,7 @@ evgl_eng_evas_surface_get(void *data)
|
|||
|
||||
if (!(re = (Render_Engine *)data)) return NULL;
|
||||
if (!(ob = eng_get_ob(re))) return NULL;
|
||||
return (void *)ob->egl_surface[0];
|
||||
return (void *)ob->egl_surface;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -372,7 +372,7 @@ evgl_eng_context_create(void *data, void *ctxt, Evas_GL_Context_Version version)
|
|||
{
|
||||
context =
|
||||
eglCreateContext(ob->egl_disp, ob->egl_config,
|
||||
ob->egl_context[0], attrs);
|
||||
ob->egl_context, attrs);
|
||||
}
|
||||
|
||||
if (!context)
|
||||
|
@ -676,12 +676,12 @@ eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
|||
|
||||
ob = eng_get_ob(re);
|
||||
|
||||
if (!inf->info.wl_surface && (ob->egl_surface[0] != EGL_NO_SURFACE))
|
||||
if (!inf->info.wl_surface && (ob->egl_surface != EGL_NO_SURFACE))
|
||||
{
|
||||
eglDestroySurface(ob->egl_disp, ob->egl_surface[0]);
|
||||
eglDestroySurface(ob->egl_disp, ob->egl_surface);
|
||||
eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT);
|
||||
ob->egl_surface[0] = EGL_NO_SURFACE;
|
||||
ob->egl_surface = EGL_NO_SURFACE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1385,8 +1385,8 @@ eng_preload_make_current(void *data, void *doit)
|
|||
|
||||
if (doit)
|
||||
{
|
||||
if (!eglMakeCurrent(ob->egl_disp, ob->egl_surface[0],
|
||||
ob->egl_surface[0], ob->egl_context[0]))
|
||||
if (!eglMakeCurrent(ob->egl_disp, ob->egl_surface,
|
||||
ob->egl_surface, ob->egl_context))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -74,8 +74,8 @@ struct _Outbuf
|
|||
Eina_Bool drew : 1;
|
||||
} draw;
|
||||
|
||||
EGLContext egl_context[1];
|
||||
EGLSurface egl_surface[1];
|
||||
EGLContext egl_context;
|
||||
EGLSurface egl_surface;
|
||||
EGLConfig egl_config;
|
||||
EGLDisplay egl_disp;
|
||||
|
||||
|
|
|
@ -106,10 +106,10 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
else if ((gw->rot == 90) || (gw->rot == 270))
|
||||
gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w);
|
||||
|
||||
gw->egl_surface[0] =
|
||||
gw->egl_surface =
|
||||
eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win, NULL);
|
||||
if (gw->egl_surface[0] == EGL_NO_SURFACE)
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
gw->win, eglGetError());
|
||||
|
@ -117,19 +117,19 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gw->egl_context[0] =
|
||||
gw->egl_context =
|
||||
eglCreateContext(gw->egl_disp, gw->egl_config, context, context_attrs);
|
||||
if (gw->egl_context[0] == EGL_NO_CONTEXT)
|
||||
if (gw->egl_context == EGL_NO_CONTEXT)
|
||||
{
|
||||
ERR("eglCreateContext() fail. code=%#x", eglGetError());
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (context == EGL_NO_CONTEXT) context = gw->egl_context[0];
|
||||
if (context == EGL_NO_CONTEXT) context = gw->egl_context;
|
||||
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
|
||||
gw->egl_surface[0], gw->egl_context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface,
|
||||
gw->egl_surface, gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
eng_window_free(gw);
|
||||
|
@ -175,7 +175,7 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
}
|
||||
|
||||
gw->gl_context->egldisp = gw->egl_disp;
|
||||
gw->gl_context->eglctxt = gw->egl_context[0];
|
||||
gw->gl_context->eglctxt = gw->egl_context;
|
||||
|
||||
eng_window_use(gw);
|
||||
glsym_evas_gl_common_context_resize(gw->gl_context, w, h, gw->rot);
|
||||
|
@ -205,11 +205,11 @@ eng_window_free(Outbuf *gw)
|
|||
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
if (gw->egl_context[0] != context)
|
||||
eglDestroyContext(gw->egl_disp, gw->egl_context[0]);
|
||||
if (gw->egl_context != context)
|
||||
eglDestroyContext(gw->egl_disp, gw->egl_context);
|
||||
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface);
|
||||
|
||||
if (gw->win) wl_egl_window_destroy(gw->win);
|
||||
|
||||
|
@ -234,7 +234,7 @@ eng_window_use(Outbuf *gw)
|
|||
|
||||
if (_evas_gl_wl_window)
|
||||
{
|
||||
if (eglGetCurrentContext() != _evas_gl_wl_window->egl_context[0])
|
||||
if (eglGetCurrentContext() != _evas_gl_wl_window->egl_context)
|
||||
force = EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -250,11 +250,11 @@ eng_window_use(Outbuf *gw)
|
|||
|
||||
if (gw)
|
||||
{
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
|
||||
gw->egl_surface[0],
|
||||
gw->egl_context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface,
|
||||
gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
ERR("eglMakeCurrent() failed!");
|
||||
}
|
||||
}
|
||||
|
@ -281,9 +281,9 @@ eng_window_unsurf(Outbuf *gw)
|
|||
{
|
||||
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (gw->egl_surface[0] != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
|
||||
gw->egl_surface[0] = EGL_NO_SURFACE;
|
||||
if (gw->egl_surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(gw->egl_disp, gw->egl_surface);
|
||||
gw->egl_surface = EGL_NO_SURFACE;
|
||||
|
||||
_evas_gl_wl_window = NULL;
|
||||
}
|
||||
|
@ -297,19 +297,19 @@ eng_window_resurf(Outbuf *gw)
|
|||
if (gw->surf) return;
|
||||
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw);
|
||||
|
||||
gw->egl_surface[0] =
|
||||
gw->egl_surface =
|
||||
eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win, NULL);
|
||||
|
||||
if (gw->egl_surface[0] == EGL_NO_SURFACE)
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
gw->win, eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0],
|
||||
gw->egl_context[0]) == EGL_FALSE)
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface, gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
ERR("eglMakeCurrent() failed!");
|
||||
|
||||
gw->surf = EINA_TRUE;
|
||||
|
@ -371,7 +371,7 @@ eng_outbuf_swap_mode_get(Outbuf *ob)
|
|||
EGLint age = 0;
|
||||
|
||||
eina_evlog("+gl_query_surf_swap_mode", ob, 0.0, NULL);
|
||||
if (!eglQuerySurface(ob->egl_disp, ob->egl_surface[0],
|
||||
if (!eglQuerySurface(ob->egl_disp, ob->egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &age))
|
||||
age = 0;
|
||||
|
||||
|
@ -469,7 +469,7 @@ eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage)
|
|||
_convert_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h);
|
||||
rect += 4;
|
||||
}
|
||||
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, count);
|
||||
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface, rects, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,12 +539,12 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_
|
|||
_convert_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
|
||||
i += 4;
|
||||
}
|
||||
glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface[0],
|
||||
glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface,
|
||||
result, num);
|
||||
}
|
||||
}
|
||||
else
|
||||
eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
|
||||
eglSwapBuffers(ob->egl_disp, ob->egl_surface);
|
||||
|
||||
ob->frame_cnt++;
|
||||
|
||||
|
@ -579,7 +579,7 @@ eng_gl_context_new(Outbuf *ob)
|
|||
if (!(ctx = calloc(1, sizeof(Context_3D)))) return NULL;
|
||||
|
||||
ctx->context =
|
||||
eglCreateContext(ob->egl_disp, ob->egl_config, ob->egl_context[0], attrs);
|
||||
eglCreateContext(ob->egl_disp, ob->egl_config, ob->egl_context, attrs);
|
||||
if (!ctx->context)
|
||||
{
|
||||
ERR("Could not create egl context %#x", eglGetError());
|
||||
|
@ -587,7 +587,7 @@ eng_gl_context_new(Outbuf *ob)
|
|||
}
|
||||
|
||||
ctx->display = ob->egl_disp;
|
||||
ctx->surface = ob->egl_surface[0];
|
||||
ctx->surface = ob->egl_surface;
|
||||
|
||||
return ctx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue