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
This commit is contained in:
Dongyeon Kim 2015-05-19 15:18:37 +09:00 committed by Jean-Philippe Andre
parent a4c05cc68c
commit 3e39bf3638
3 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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;