diff options
author | Dongyeon Kim <dy5.kim@samsung.com> | 2015-05-19 15:18:37 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-06-03 11:30:22 +0900 |
commit | 3e39bf36389fdbc8a3f84521410f6c996a64a22d (patch) | |
tree | 28a73b2cff3e191e2cabeee91bdb789c13c53923 | |
parent | a4c05cc68c9f5d0cd8d758881cf06e1b7aa88f89 (diff) | |
download | efl-3e39bf36389fdbc8a3f84521410f6c996a64a22d.tar.gz |
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
-rw-r--r-- | src/lib/evas/canvas/evas_gl.c | 2 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core.c | 15 | ||||
-rw-r--r-- | 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 d7ec99e530..1552e5919e 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 e9f9bb194f..f3743019f9 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 9012ba18e2..4b181a80be 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; |