jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3e39bf36389fdbc8a3f84521410f6c996a64a22d
commit 3e39bf36389fdbc8a3f84521410f6c996a64a22d Author: Dongyeon Kim <dy5....@samsung.com> Date: Tue May 19 15:18:37 2015 +0900 Evas GL: support surfaceless make current Summary: Evas GL now supports surfaceless make current, where evas_gl_make_current can be called with sfc parameter NULL. This closely resembles EGL_KHR_surfaceless_context extension, where applications that only want to render to client API targets can make current to NULL surface instead of creating a dummy egl surface. @feature --- src/lib/evas/canvas/evas_gl.c | 2 ++ src/modules/evas/engines/gl_common/evas_gl_core.c | 15 +++++++++++---- src/modules/evas/engines/gl_generic/evas_engine.c | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/evas/canvas/evas_gl.c b/src/lib/evas/canvas/evas_gl.c index d7ec99e..1552e59 100644 --- a/src/lib/evas/canvas/evas_gl.c +++ b/src/lib/evas/canvas/evas_gl.c @@ -424,6 +424,8 @@ evas_gl_make_current(Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *c ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data); else if ((!surf) && (!ctx)) ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, NULL); + else if ((!surf) && (ctx)) // surfaceless make current + ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, ctx->data); else { ERR("Bad match between surface: %p and context: %p", surf, ctx); diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index e9f9bb1..f374301 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -2222,7 +2222,6 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) // Check the input validity. If either sfc or ctx is NULL, it's also error. if ( (!evgl_engine) || - ((!sfc) && ctx) || (sfc && (!ctx)) ) { ERR("Invalid Inputs. Engine: %p Surface: %p Context: %p!", evgl_engine, sfc, ctx); @@ -2295,7 +2294,6 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT); return 0; } - sfc->current_ctx = ctx; rsc->current_ctx = ctx; rsc->current_eng = eng_data; @@ -2318,6 +2316,16 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) } } + if (sfc) sfc->current_ctx = ctx; + else + { + DBG("Performing surfaceless make current"); + glViewport(0, 0, 0, 0); + glScissor(0, 0, 0, 0); + rsc->direct.rendered = 0; + goto finish; + } + if (!sfc->buffers_skip_allocate) { if (!sfc->color_buf && !_surface_buffers_create(sfc)) @@ -2539,9 +2547,8 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) } } +finish: ctx->current_sfc = sfc; - rsc->current_ctx = ctx; - rsc->current_eng = eng_data; _surface_context_list_print(); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 9012ba1..4b181a8 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -1434,7 +1434,7 @@ eng_gl_make_current(void *data, void *surface, void *context) // TODO: Add check for main thread before flush EVGLINIT(data, 0); - if ((sfc) && (ctx)) + if (ctx) { Evas_Engine_GL_Context *gl_context; --