return EVAS_GL_NOT_INITIALIZED;
MAGIC_CHECK_END();
- if ((err = _evas_gl_internal_error_get(evas_gl)) != EVAS_GL_SUCCESS) goto end;
+ if ((err = _evas_gl_internal_error_get(evas_gl)) != EVAS_GL_SUCCESS)
+ goto end;
if (!evas_gl->evas->engine.func->gl_error_get)
err = EVAS_GL_NOT_INITIALIZED;
{
EVGL_Context *ctx = NULL;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (!ctx)
{
{
EVGL_Context *ctx = NULL;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (!ctx)
{
ERR("Current Context Not Set");
EVGL_Resource *rsc;
rsc = _evgl_tls_resource_get();
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (!ctx)
{
{
EVGL_Context *ctx;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (cap == GL_SCISSOR_TEST)
if (ctx) ctx->scissor_enabled = 1;
{
EVGL_Context *ctx;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (cap == GL_SCISSOR_TEST)
if (ctx) ctx->scissor_enabled = 0;
EAPI void evas_gl_preload_render_relax(evas_gl_make_current_cb make_current, void *engine_data);
EAPI void evas_gl_symbols(void *(*GetProcAddress)(const char *name));
+EAPI void evas_gl_common_error_set(void *data, int error_enum);
+EAPI int evas_gl_common_error_get(void *data);
+EAPI void *evas_gl_common_current_context_get(void);
+
typedef int (*Evas_GL_Preload)(void);
typedef void (*Evas_GL_Common_Image_Call)(Evas_GL_Image *im);
typedef void (*Evas_GL_Common_Context_Call)(Evas_Engine_GL_Context *gc);
evgl_engine->resource_key = 0;
}
-EVGL_Context *
-_evgl_current_context_get()
+EAPI void * /* EVGL_Context */
+evas_gl_common_current_context_get(void)
{
EVGL_Resource *rsc;
return NULL;
}
else
- return rsc->current_ctx;
+ return rsc->current_ctx;
}
int
return _evgl_direct_renderable(rsc, sfc);
}
-void
-_evgl_error_set(int error_enum)
+EAPI void
+evas_gl_common_error_set(void *data EINA_UNUSED, int error_enum)
{
EVGL_Resource *rsc;
rsc->error_state = error_enum;
}
-int
-_evgl_error_get()
+EAPI int
+evas_gl_common_error_get(void *data EINA_UNUSED)
{
EVGL_Resource *rsc;
if (!evgl_engine)
{
ERR("Invalid EVGL Engine!");
- _evgl_error_set(EVAS_GL_BAD_ACCESS);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ACCESS);
return NULL;
}
if (!cfg)
{
ERR("Invalid Config!");
- _evgl_error_set(EVAS_GL_BAD_CONFIG);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONFIG);
return NULL;
}
{
ERR("Requested surface size [%d, %d] is greater than max supported size [%d, %d]",
w, h, evgl_engine->caps.max_w, evgl_engine->caps.max_h);
- _evgl_error_set(EVAS_GL_BAD_PARAMETER);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_PARAMETER);
return NULL;
}
if (!sfc)
{
ERR("Surface allocation failed.");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
goto error;
}
if (!_internal_config_set(sfc, cfg))
{
ERR("Unsupported Format!");
- _evgl_error_set(EVAS_GL_BAD_CONFIG);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONFIG);
goto error;
}
if (!_internal_resource_make_current(eng_data, NULL))
{
ERR("Error doing an internal resource make current");
- _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
goto error;
}
if (!_surface_buffers_create(sfc))
{
ERR("Unable Create Specificed Surfaces.");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
goto error;
};
if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
{
ERR("Unable Create Allocate Memory for Surface.");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
goto error;
}
}
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
- _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
goto error;
}
if (!evgl_engine)
{
ERR("Invalid EVGL Engine!");
- _evgl_error_set(EVAS_GL_BAD_ACCESS);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ACCESS);
return NULL;
}
if (!ctx)
{
ERR("Error allocating context object.");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
return NULL;
}
(sfc && (!ctx)) )
{
ERR("Invalid Inputs. Engine: %p Surface: %p Context: %p!", evgl_engine, sfc, ctx);
- if(!sfc) _evgl_error_set(EVAS_GL_BAD_SURFACE);
- if(!ctx) _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ if(!sfc) evas_gl_common_error_set(eng_data, EVAS_GL_BAD_SURFACE);
+ if(!ctx) evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
return 0;
}
if (!_surface_buffers_allocate(eng_data, sfc, 0, 0, 1))
{
ERR("Unable to destroy surface buffers!");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
return 0;
}
sfc->buffers_allocated = 0;
if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 1))
{
ERR("Unable Create Specificed Surfaces. Unsupported format!");
- _evgl_error_set(EVAS_GL_BAD_ALLOC);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
return 0;
};
sfc->buffers_allocated = 1;
if (!_internal_resource_make_current(eng_data, ctx))
{
ERR("Error doing a make current with internal surface. Context: %p", ctx);
- _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
return 0;
}
if (!_surface_buffers_fbo_set(sfc, ctx->surface_fbo))
{
ERR("Attaching buffers to context fbo failed. Engine: %p Surface: %p Context FBO: %u", evgl_engine, sfc, ctx->surface_fbo);
- _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_CONTEXT);
return 0;
}
}
evgl_direct_partial_render_end()
{
EVGL_Context *ctx;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (!ctx) return;
extern EVGL_Resource *_evgl_tls_resource_get();
extern EVGL_Resource *_evgl_tls_resource_create(void *data);
extern void _evgl_tls_resource_destroy(void *data);
-extern EVGL_Context *_evgl_current_context_get();
extern int _evgl_not_in_pixel_get();
extern int _evgl_direct_enabled();
-extern void _evgl_error_set(int error_enum);
-extern int _evgl_error_get();
#endif //_EVAS_GL_CORE_PRIVATE_H
{
EVGL_Context *ctx;
- ctx = _evgl_current_context_get();
+ ctx = evas_gl_common_current_context_get();
if (!ctx)
return NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock = NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = NULL;
+glsym_func_void glsym_evas_gl_common_error_set = NULL;
+glsym_func_int glsym_evas_gl_common_error_get = NULL;
+glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
+
#ifdef GL_GLES
#ifndef EGL_NATIVE_PIXMAP_KHR
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return 0;
}
if (!ret)
{
int err = eglGetError();
- _evgl_error_set(err - EGL_SUCCESS);
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
return 0;
}
return 1;
}
+ // FIXME: Check (eglGetCurrentDisplay() != dpy) ?
if ((eglGetCurrentContext() != ctx) ||
(eglGetCurrentSurface(EGL_READ) != sfc) ||
(eglGetCurrentSurface(EGL_DRAW) != sfc) )
if (!ret)
{
int err = eglGetError();
- _evgl_error_set(err - EGL_SUCCESS);
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
return 0;
}
if (!ret)
{
ERR("glXMakeCurrent() failed!");
- _evgl_error_set(EVAS_GL_BAD_DISPLAY);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_DISPLAY);
return 0;
}
return 1;
if (!ret)
{
ERR("glXMakeCurrent() failed. Ret: %d! Context: %p Surface: %p", ret, (void*)ctx, (void*)sfc);
- _evgl_error_set(EVAS_GL_BAD_DISPLAY);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_DISPLAY);
return 0;
}
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return NULL;
}
if (!win)
{
ERR("Creating native X window failed.");
- _evgl_error_set(EVAS_GL_BAD_DISPLAY);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_DISPLAY);
return NULL;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return 0;
}
if (!native_window)
{
ERR("Inavlid native surface.");
- _evgl_error_set(EVAS_GL_BAD_NATIVE_WINDOW);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_NATIVE_WINDOW);
return 0;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return NULL;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return 0;
}
if (!surface)
{
ERR("Invalid surface.");
- _evgl_error_set(EVAS_GL_BAD_SURFACE);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_SURFACE);
return 0;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return NULL;
}
{
int err = eglGetError();
ERR("Engine Context Creations Failed. Error: %#x.", err);
- _evgl_error_set(err - EGL_SUCCESS);
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
return NULL;
}
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);
+ if(!(eng_get_ob(re)->info->info.display)) glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_DISPLAY);
+ if(!(eng_get_ob(re)->win)) glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_NATIVE_WINDOW);
return NULL;
}
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);
+ if (!re) glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
+ if (!context) glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_CONTEXT);
return 0;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return NULL;
}
if (!re)
{
ERR("Invalid Render Engine Data!");
- _evgl_error_set(EVAS_GL_NOT_INITIALIZED);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_NOT_INITIALIZED);
return 0;
}
else
{
ERR("Unable to retrieve rotation angle.");
- _evgl_error_set(EVAS_GL_BAD_CONTEXT);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_CONTEXT);
return 0;
}
}
LINK2GENERIC(evas_gl_preload_shutdown);
LINK2GENERIC(evgl_engine_shutdown);
LINK2GENERIC(evas_gl_symbols);
+ LINK2GENERIC(evas_gl_common_error_get);
+ LINK2GENERIC(evas_gl_common_error_set);
+ LINK2GENERIC(evas_gl_common_current_context_get);
#ifdef GL_GLES
#define FINDSYM(dst, sym, typ) \
{
EVGL_Context *ctx;
- ctx = _evgl_current_context_get();
+ ctx = glsym_evas_gl_common_current_context_get();
if (!ctx)
return NULL;
}
static int
-eng_gl_error_get(void *data EINA_UNUSED)
+eng_gl_error_get(void *data)
{
int err;
- if ((err = _evgl_error_get()) != EVAS_GL_SUCCESS)
+ if ((err = glsym_evas_gl_common_error_get(data)) != EVAS_GL_SUCCESS)
goto end;
#ifdef GL_GLES
#endif
end:
- _evgl_error_set(EVAS_GL_SUCCESS);
+ glsym_evas_gl_common_error_set(data, EVAS_GL_SUCCESS);
return err;
}
if ((err = eglGetError()) != EGL_SUCCESS)
{
ERR("eglDestroyImage() failed.");
- _evgl_error_set(err - EGL_SUCCESS);
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
}
}
else
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);
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
}
else
{
ORD(gl_proc_address_get); // FIXME: Need to implement
ORD(gl_native_surface_get);
ORD(gl_api_get);
+ //ORD(gl_error_get);
+ //ORD(gl_current_context_get);
+ //ORD(gl_current_surface_get);
#undef ORD
}
}