EvasGL: Add error handling for GL_OES_EGL_image/EGL_Image_KHR

Summary:
Add code for exception case for GL_OES_EGL_image/EGL_Image_KHR
These EvasGL's extension functions does not have the code for exception case.
e.g. EvasGLImage is NULL.

Test Plan: Native Pixmap surface's example is created and changed EvasGLImage's value(e.g. valid data or NULL)

Reviewers: raster, spacegrapher, jpeg

Subscribers: scholb.kim, JoogabYun, dkdk, cedric

Differential Revision: https://phab.enlightenment.org/D3284
This commit is contained in:
Wonsik Jung 2015-11-11 11:38:29 +09:00 committed by Jean-Philippe Andre
parent 5ccd783069
commit 64890d260f
1 changed files with 63 additions and 0 deletions

View File

@ -249,6 +249,13 @@ _evgl_evasglDestroyImage(EvasGLImage image)
{
EvasGLImage_EGL *img = image;
if (!img)
{
ERR("EvasGLImage is NULL.");
evas_gl_common_error_set(NULL, EVAS_GL_BAD_PARAMETER);
return;
}
EXT_FUNC_EGL(eglDestroyImage)(img->dpy, img->img);
free(img);
}
@ -257,6 +264,34 @@ static void
_evgl_glEvasGLImageTargetTexture2D(GLenum target, EvasGLImage image)
{
EvasGLImage_EGL *img = image;
EVGL_Resource *rsc;
EVGL_Context *ctx;
if (!(rsc=_evgl_tls_resource_get()))
{
ERR("Unable to execute GL command. Error retrieving tls");
return;
}
if (!rsc->current_eng)
{
ERR("Unable to retrive Current Engine");
return;
}
ctx = rsc->current_ctx;
if (!ctx)
{
ERR("Unable to retrive Current Context");
return;
}
if (!img)
{
ERR("EvasGLImage is NULL");
EXT_FUNC(glEGLImageTargetTexture2DOES)(target, NULL);
return;
}
EXT_FUNC(glEGLImageTargetTexture2DOES)(target, img->img);
}
@ -265,6 +300,34 @@ static void
_evgl_glEvasGLImageTargetRenderbufferStorage(GLenum target, EvasGLImage image)
{
EvasGLImage_EGL *img = image;
EVGL_Resource *rsc;
EVGL_Context *ctx;
if (!(rsc=_evgl_tls_resource_get()))
{
ERR("Unable to execute GL command. Error retrieving tls");
return;
}
if (!rsc->current_eng)
{
ERR("Unable to retrive Current Engine");
return;
}
ctx = rsc->current_ctx;
if (!ctx)
{
ERR("Unable to retrive Current Context");
return;
}
if (!img)
{
ERR("EvasGLImage is NULL");
EXT_FUNC(glEGLImageTargetRenderbufferStorageOES)(target, NULL);
return;
}
EXT_FUNC(glEGLImageTargetRenderbufferStorageOES)(target, img->img);
}