EGLContext context = EGL_NO_CONTEXT;
int attrs[3];
- if (!(re = (Render_Engine *)data)) return NULL;
+ if (!(re = (Render_Engine *)data))
+ {
+ ERR("Invalid Render Engine Data!");
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
+ return NULL;
+ }
+
if (!(ob = eng_get_ob(re))) return NULL;
+ if ((version < EVAS_GL_GLES_1_X) || (version > EVAS_GL_GLES_3_X))
+ {
+ ERR("Invalid context version number %d", version);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_PARAMETER);
+ return NULL;
+ }
+
+ if ((version == EVAS_GL_GLES_3_X) &&
+ ((!ob->gl_context) || (ob->gl_context->gles_version != EVAS_GL_GLES_3_X)))
+ {
+ EGLint num_config=0;
+ EGLint version_config_attrs[3];
+ version_config_attrs[0] = EGL_RENDERABLE_TYPE;
+ version_config_attrs[1] = EGL_OPENGL_ES3_BIT;
+ version_config_attrs[2] = EGL_NONE;
+
+ if ((!eglChooseConfig(ob->egl_disp, version_config_attrs, NULL, 0, &num_config))
+ || (num_config < 1))
+ {
+ ERR("GLES 3 version not supported!");
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_ATTRIBUTE);
+ return NULL;
+ }
+ else if (ob->gl_context)
+ {
+ ob->gl_context->gles_version = EVAS_GL_GLES_3_X;
+ }
+ else
+ {
+ ERR("Evas GL Context not initialised!");
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
+ return NULL;
+ }
+ }
+
attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
attrs[1] = version;
attrs[2] = EGL_NONE;
if (!context)
{
- ERR("Failed to create egl context: %#x", eglGetError());
+ int err = eglGetError();
+ ERR("Failed to create egl context: %#x", err);
+ glsym_evas_gl_common_error_set(data, err - EGL_SUCCESS);
return NULL;
}