summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-05-19 15:18:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:22 +0900
commit3e39bf36389fdbc8a3f84521410f6c996a64a22d (patch)
tree28a73b2cff3e191e2cabeee91bdb789c13c53923
parenta4c05cc68c9f5d0cd8d758881cf06e1b7aa88f89 (diff)
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.c2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c15
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c2
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
424 ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data); 424 ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data);
425 else if ((!surf) && (!ctx)) 425 else if ((!surf) && (!ctx))
426 ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, NULL); 426 ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, NULL);
427 else if ((!surf) && (ctx)) // surfaceless make current
428 ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, ctx->data);
427 else 429 else
428 { 430 {
429 ERR("Bad match between surface: %p and context: %p", surf, ctx); 431 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)
2222 2222
2223 // Check the input validity. If either sfc or ctx is NULL, it's also error. 2223 // Check the input validity. If either sfc or ctx is NULL, it's also error.
2224 if ( (!evgl_engine) || 2224 if ( (!evgl_engine) ||
2225 ((!sfc) && ctx) ||
2226 (sfc && (!ctx)) ) 2225 (sfc && (!ctx)) )
2227 { 2226 {
2228 ERR("Invalid Inputs. Engine: %p Surface: %p Context: %p!", evgl_engine, sfc, ctx); 2227 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)
2295 evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT); 2294 evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
2296 return 0; 2295 return 0;
2297 } 2296 }
2298 sfc->current_ctx = ctx;
2299 rsc->current_ctx = ctx; 2297 rsc->current_ctx = ctx;
2300 rsc->current_eng = eng_data; 2298 rsc->current_eng = eng_data;
2301 2299
@@ -2318,6 +2316,16 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2318 } 2316 }
2319 } 2317 }
2320 2318
2319 if (sfc) sfc->current_ctx = ctx;
2320 else
2321 {
2322 DBG("Performing surfaceless make current");
2323 glViewport(0, 0, 0, 0);
2324 glScissor(0, 0, 0, 0);
2325 rsc->direct.rendered = 0;
2326 goto finish;
2327 }
2328
2321 if (!sfc->buffers_skip_allocate) 2329 if (!sfc->buffers_skip_allocate)
2322 { 2330 {
2323 if (!sfc->color_buf && !_surface_buffers_create(sfc)) 2331 if (!sfc->color_buf && !_surface_buffers_create(sfc))
@@ -2539,9 +2547,8 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2539 } 2547 }
2540 } 2548 }
2541 2549
2550finish:
2542 ctx->current_sfc = sfc; 2551 ctx->current_sfc = sfc;
2543 rsc->current_ctx = ctx;
2544 rsc->current_eng = eng_data;
2545 2552
2546 _surface_context_list_print(); 2553 _surface_context_list_print();
2547 2554
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)
1434 // TODO: Add check for main thread before flush 1434 // TODO: Add check for main thread before flush
1435 1435
1436 EVGLINIT(data, 0); 1436 EVGLINIT(data, 0);
1437 if ((sfc) && (ctx)) 1437 if (ctx)
1438 { 1438 {
1439 Evas_Engine_GL_Context *gl_context; 1439 Evas_Engine_GL_Context *gl_context;
1440 1440