diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-09-19 17:32:26 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-10-20 12:16:08 +0900 |
commit | a0712e25e188d16744df8e66de72d67ab7518cda (patch) | |
tree | c5622f705711c70903c96c9f1937a8348a6ec2f0 /src/lib/evas/canvas/evas_gl.c | |
parent | 6cd0aa17dae73dd242ce95bc23dbb13657875baa (diff) | |
download | efl-a0712e25e188d16744df8e66de72d67ab7518cda.tar.gz |
Evas GL: Add support for pbuffer surfaces
Supports only EGL for now :(
These pbuffer surfaces can be used to create dummy surfaces for
make_current and render threads.
@feature
Diffstat (limited to 'src/lib/evas/canvas/evas_gl.c')
-rw-r--r-- | src/lib/evas/canvas/evas_gl.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_gl.c b/src/lib/evas/canvas/evas_gl.c index 3b7286c9ef..456d1beb40 100644 --- a/src/lib/evas/canvas/evas_gl.c +++ b/src/lib/evas/canvas/evas_gl.c @@ -241,6 +241,62 @@ evas_gl_surface_create(Evas_GL *evas_gl, Evas_GL_Config *config, int width, int return surf; } +EAPI Evas_GL_Surface * +evas_gl_pbuffer_surface_create(Evas_GL *evas_gl, Evas_GL_Config *cfg, + int w, int h, const int *attrib_list) +{ + Evas_GL_Surface *surf; + + // Magic + MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL); + return NULL; + MAGIC_CHECK_END(); + + if (!cfg) + { + ERR("Invalid Config Pointer!"); + _evas_gl_internal_error_set(evas_gl, EVAS_GL_BAD_CONFIG); + return NULL; + } + + if ((w <= 0) || (h <= 0)) + { + ERR("Invalid surface dimensions: %d, %d", w, h); + _evas_gl_internal_error_set(evas_gl, EVAS_GL_BAD_PARAMETER); + return NULL; + } + + if (!evas_gl->evas->engine.func->gl_pbuffer_surface_create) + { + ERR("Engine does not support PBuffer!"); + _evas_gl_internal_error_set(evas_gl, EVAS_GL_NOT_INITIALIZED); + return NULL; + } + + surf = calloc(1, sizeof(Evas_GL_Surface)); + if (!surf) + { + _evas_gl_internal_error_set(evas_gl, EVAS_GL_BAD_ALLOC); + return NULL; + } + + surf->data = evas_gl->evas->engine.func->gl_pbuffer_surface_create + (evas_gl->evas->engine.data.output, cfg, w, h, attrib_list); + if (!surf->data) + { + ERR("Engine failed to create a PBuffer!"); + free(surf); + return NULL; + } + + // Keep track of the surface creations + LKL(evas_gl->lck); + evas_gl->surfaces = eina_list_prepend(evas_gl->surfaces, surf); + LKU(evas_gl->lck); + + return surf; +} + EAPI void evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf) { |