forked from enlightenment/efl
Evas GL: Save EGL error codes in gl_x11 engine
This commit is contained in:
parent
8d6f873354
commit
6e4d7151b8
|
@ -217,6 +217,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -231,7 +232,9 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|||
ret = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!ret)
|
||||
{
|
||||
ERR("eglMakeCurrent() failed! Error Code=%#x", eglGetError());
|
||||
int err = eglGetError();
|
||||
_evgl_error_set(err - EGL_SUCCESS);
|
||||
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -251,7 +254,9 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|||
|
||||
if (!ret)
|
||||
{
|
||||
ERR("eglMakeCurrent() failed! Error Code=%#x", eglGetError());
|
||||
int err = eglGetError();
|
||||
_evgl_error_set(err - EGL_SUCCESS);
|
||||
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -267,6 +272,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|||
if (!ret)
|
||||
{
|
||||
ERR("glXMakeCurrent() failed!");
|
||||
_evgl_error_set(EVAS_GL_BAD_DISPLAY);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -285,6 +291,7 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
|
|||
if (!ret)
|
||||
{
|
||||
ERR("glXMakeCurrent() failed. Ret: %d! Context: %p Surface: %p", ret, (void*)ctx, (void*)sfc);
|
||||
_evgl_error_set(EVAS_GL_BAD_DISPLAY);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -303,6 +310,7 @@ evgl_eng_native_window_create(void *data)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -331,6 +339,7 @@ evgl_eng_native_window_create(void *data)
|
|||
if (!win)
|
||||
{
|
||||
ERR("Creating native X window failed.");
|
||||
_evgl_error_set(EVAS_GL_BAD_DISPLAY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -346,12 +355,14 @@ evgl_eng_native_window_destroy(void *data, void *native_window)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!native_window)
|
||||
{
|
||||
ERR("Inavlid native surface.");
|
||||
_evgl_error_set(EVAS_GL_BAD_NATIVE_WINDOW);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -374,6 +385,7 @@ evgl_eng_window_surface_create(void *data, void *native_window EINA_UNUSED)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -414,6 +426,7 @@ evgl_eng_window_surface_destroy(void *data, void *surface)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -421,6 +434,7 @@ evgl_eng_window_surface_destroy(void *data, void *surface)
|
|||
if (!surface)
|
||||
{
|
||||
ERR("Invalid surface.");
|
||||
_evgl_error_set(EVAS_GL_BAD_SURFACE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -440,6 +454,7 @@ evgl_eng_context_create(void *data, void *share_ctx)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -469,7 +484,9 @@ evgl_eng_context_create(void *data, void *share_ctx)
|
|||
|
||||
if (!context)
|
||||
{
|
||||
ERR("Engine Context Creations Failed. Error: %#x.", eglGetError());
|
||||
int err = eglGetError();
|
||||
ERR("Engine Context Creations Failed. Error: %#x.", err);
|
||||
_evgl_error_set(err - EGL_SUCCESS);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -496,6 +513,8 @@ evgl_eng_context_create(void *data, void *share_ctx)
|
|||
if (!context)
|
||||
{
|
||||
ERR("Internal Resource Context Creations Failed.");
|
||||
if(!(eng_get_ob(re)->info->info.display)) _evgl_error_set(EVAS_GL_BAD_DISPLAY);
|
||||
if(!(eng_get_ob(re)->win)) _evgl_error_set(EVAS_GL_BAD_NATIVE_WINDOW);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -513,6 +532,8 @@ evgl_eng_context_destroy(void *data, void *context)
|
|||
if ((!re) || (!context))
|
||||
{
|
||||
ERR("Invalid Render Input Data. Engine: %p, Context: %p", data, context);
|
||||
if (!re) _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
if (!context) _evgl_error_set(EVAS_GL_BAD_CONTEXT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -534,6 +555,7 @@ evgl_eng_string_get(void *data)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -566,6 +588,7 @@ evgl_eng_rotation_angle_get(void *data)
|
|||
if (!re)
|
||||
{
|
||||
ERR("Invalid Render Engine Data!");
|
||||
_evgl_error_set(EVAS_GL_NOT_INITIALIZED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -574,6 +597,7 @@ evgl_eng_rotation_angle_get(void *data)
|
|||
else
|
||||
{
|
||||
ERR("Unable to retrieve rotation angle.");
|
||||
_evgl_error_set(EVAS_GL_BAD_CONTEXT);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1240,6 +1264,30 @@ eng_output_dump(void *data)
|
|||
_re_winfree(re);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gl_error_get(void *data EINA_UNUSED)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = _evgl_error_get()) != EVAS_GL_SUCCESS)
|
||||
goto end;
|
||||
|
||||
#ifdef GL_GLES
|
||||
err = eglGetError() - EGL_SUCCESS;
|
||||
#else
|
||||
Render_Engine *re = data;
|
||||
|
||||
if (!eng_get_ob(re)->win)
|
||||
err = EVAS_GL_BAD_DISPLAY;
|
||||
else if (!eng_get_ob(re)->info)
|
||||
err = EVAS_GL_BAD_SURFACE;
|
||||
#endif
|
||||
|
||||
end:
|
||||
_evgl_error_set(EVAS_GL_SUCCESS);
|
||||
return err;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -1357,15 +1405,19 @@ _native_free_cb(void *data, void *image)
|
|||
#ifdef GL_GLES
|
||||
if (n->egl_surface)
|
||||
{
|
||||
if (glsym_eglDestroyImage)
|
||||
{
|
||||
glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
|
||||
n->egl_surface);
|
||||
if (eglGetError() != EGL_SUCCESS)
|
||||
ERR("eglDestroyImage() failed.");
|
||||
}
|
||||
else
|
||||
ERR("Try eglDestroyImage on EGL with no support");
|
||||
int err;
|
||||
if (glsym_eglDestroyImage)
|
||||
{
|
||||
glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
|
||||
n->egl_surface);
|
||||
if ((err = eglGetError()) != EGL_SUCCESS)
|
||||
{
|
||||
ERR("eglDestroyImage() failed.");
|
||||
_evgl_error_set(err - EGL_SUCCESS);
|
||||
}
|
||||
}
|
||||
else
|
||||
ERR("Try eglDestroyImage on EGL with no support");
|
||||
}
|
||||
#else
|
||||
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
||||
|
@ -1549,7 +1601,12 @@ eng_image_native_set(void *data, void *image, void *native)
|
|||
|
||||
if (!eglChooseConfig(eng_get_ob(re)->egl_disp, config_attrs,
|
||||
&egl_config, 1, &num_config))
|
||||
ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config);
|
||||
{
|
||||
int err = eglGetError();
|
||||
ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i with error %d",
|
||||
(unsigned int)pm, num_config, err);
|
||||
_evgl_error_set(err - EGL_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
int val;
|
||||
|
@ -1875,6 +1932,10 @@ module_open(Evas_Module *em)
|
|||
|
||||
ORD(image_native_set);
|
||||
|
||||
ORD(gl_error_get);
|
||||
// gl_current_surface_get is in gl generic
|
||||
ORD(gl_current_context_get);
|
||||
|
||||
gl_symbols();
|
||||
|
||||
/* now advertise out own api */
|
||||
|
|
Loading…
Reference in New Issue