struct yagl_egl_context
*yagl_egl_context_create(struct yagl_egl_display *dpy,
struct yagl_egl_config *cfg,
- struct yagl_eglb_context *backend_share_ctx)
+ struct yagl_eglb_context *backend_share_ctx,
+ int version)
{
struct yagl_eglb_context *backend_ctx;
struct yagl_egl_context *ctx;
backend_ctx = dpy->backend_dpy->create_context(dpy->backend_dpy,
&cfg->native,
- backend_share_ctx);
+ backend_share_ctx,
+ version);
if (!backend_ctx) {
return NULL;
struct yagl_egl_context
*yagl_egl_context_create(struct yagl_egl_display *dpy,
struct yagl_egl_config *cfg,
- struct yagl_eglb_context *backend_share_ctx);
+ struct yagl_eglb_context *backend_share_ctx,
+ int version);
void yagl_egl_context_update_surfaces(struct yagl_egl_context *ctx,
struct yagl_egl_surface *draw,
const EGLint *attrib_list, int32_t attrib_list_count,
EGLint *error)
{
+ int i = 0, version = 1;
yagl_host_handle res = 0;
struct yagl_egl_display *dpy = NULL;
struct yagl_egl_config *config = NULL;
goto out;
}
+ if (egl_api_ts->api == EGL_OPENGL_ES_API) {
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_CONTEXT_CLIENT_VERSION:
+ version = attrib_list[i + 1];
+ break;
+ default:
+ break;
+ }
+
+ i += 2;
+ }
+ }
+ }
+
if (share_context_) {
if (!yagl_validate_context(dpy, share_context_, &share_context, error)) {
goto out;
ctx = yagl_egl_context_create(dpy,
config,
(share_context ? share_context->backend_ctx
- : NULL));
+ : NULL),
+ version);
if (!ctx) {
YAGL_SET_ERR(EGL_BAD_MATCH);
goto fail;
}
- ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], NULL);
+ ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], NULL, 0);
if (ctx == EGL_NO_CONTEXT) {
goto fail;
}
- global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx);
+ global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx, 0);
if (global_ctx == EGL_NO_CONTEXT) {
goto fail;
struct yagl_egl_offscreen_context
*yagl_egl_offscreen_context_create(struct yagl_egl_offscreen_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_egl_offscreen_context *share_context)
+ struct yagl_egl_offscreen_context *share_context,
+ int version)
{
struct yagl_egl_offscreen *egl_offscreen =
(struct yagl_egl_offscreen*)dpy->base.backend;
EGLContext native_ctx;
YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_create,
- "dpy = %p, cfg = %d",
+ "dpy = %p, cfg = %d, version = %d",
dpy,
- cfg->config_id);
+ cfg->config_id,
+ version);
native_ctx = egl_offscreen->egl_driver->context_create(
egl_offscreen->egl_driver,
dpy->native_dpy,
cfg,
- egl_offscreen->global_ctx);
+ egl_offscreen->global_ctx,
+ version);
if (!native_ctx) {
YAGL_LOG_FUNC_EXIT(NULL);
struct yagl_egl_offscreen_context
*yagl_egl_offscreen_context_create(struct yagl_egl_offscreen_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_egl_offscreen_context *share_context);
+ struct yagl_egl_offscreen_context *share_context,
+ int version);
bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *ctx,
uint32_t width,
static struct yagl_eglb_context
*yagl_egl_offscreen_display_create_context(struct yagl_eglb_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_eglb_context *share_context)
+ struct yagl_eglb_context *share_context,
+ int version)
{
struct yagl_egl_offscreen_display *egl_offscreen_dpy =
(struct yagl_egl_offscreen_display*)dpy;
struct yagl_egl_offscreen_context *ctx =
yagl_egl_offscreen_context_create(egl_offscreen_dpy,
cfg,
- (struct yagl_egl_offscreen_context*)share_context);
+ (struct yagl_egl_offscreen_context*)share_context,
+ version);
return ctx ? &ctx->base : NULL;
}
}
ctx = egl_driver->context_create(egl_driver, dpy, &configs[0],
- (EGLContext)ws_info->context);
+ (EGLContext)ws_info->context, 0);
if (ctx == EGL_NO_CONTEXT) {
goto fail;
}
- global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx);
+ global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx, 0);
if (global_ctx == EGL_NO_CONTEXT) {
goto fail;
struct yagl_egl_onscreen_context
*yagl_egl_onscreen_context_create(struct yagl_egl_onscreen_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_egl_onscreen_context *share_context)
+ struct yagl_egl_onscreen_context *share_context,
+ int version)
{
struct yagl_egl_onscreen *egl_onscreen =
(struct yagl_egl_onscreen*)dpy->base.backend;
EGLContext native_ctx;
YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_context_create,
- "dpy = %p, cfg = %d",
+ "dpy = %p, cfg = %d, version = %d",
dpy,
- cfg->config_id);
+ cfg->config_id,
+ version);
native_ctx = egl_onscreen->egl_driver->context_create(
egl_onscreen->egl_driver,
dpy->native_dpy,
cfg,
- egl_onscreen->global_ctx);
+ egl_onscreen->global_ctx,
+ version);
if (!native_ctx) {
YAGL_LOG_FUNC_EXIT(NULL);
struct yagl_egl_onscreen_context
*yagl_egl_onscreen_context_create(struct yagl_egl_onscreen_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_egl_onscreen_context *share_context);
+ struct yagl_egl_onscreen_context *share_context,
+ int version);
void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx);
static struct yagl_eglb_context
*yagl_egl_onscreen_display_create_context(struct yagl_eglb_display *dpy,
const struct yagl_egl_native_config *cfg,
- struct yagl_eglb_context *share_context)
+ struct yagl_eglb_context *share_context,
+ int version)
{
struct yagl_egl_onscreen_display *egl_onscreen_dpy =
(struct yagl_egl_onscreen_display*)dpy;
struct yagl_egl_onscreen_context *ctx =
yagl_egl_onscreen_context_create(egl_onscreen_dpy,
cfg,
- (struct yagl_egl_onscreen_context*)share_context);
+ (struct yagl_egl_onscreen_context*)share_context,
+ version);
return ctx ? &ctx->base : NULL;
}
static EGLContext yagl_egl_agl_context_create(struct yagl_egl_driver *driver,
EGLNativeDisplayType egl_dpy,
const struct yagl_egl_native_config *cfg,
- EGLContext share_context)
+ EGLContext share_context,
+ int version)
{
YaglEglAglContext *egl_glc;
AGLContext agl_share_glc;
static EGLContext yagl_egl_glx_context_create(struct yagl_egl_driver *driver,
EGLNativeDisplayType dpy,
const struct yagl_egl_native_config *cfg,
- EGLContext share_context)
+ EGLContext share_context,
+ int version)
{
struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
GLXContext ctx;
};
YAGL_EGL_GLX_ENTER(yagl_egl_glx_context_create,
- "dpy = %p, share_context = %p",
+ "dpy = %p, share_context = %p, version = %d",
dpy,
- share_context);
+ share_context,
+ version);
- if (egl_glx->base.gl_version > yagl_gl_2) {
+ if ((egl_glx->base.gl_version > yagl_gl_2) && (version != 1)) {
ctx = egl_glx->glXCreateContextAttribsARB(dpy,
(GLXFBConfig)cfg->driver_data,
((share_context == EGL_NO_CONTEXT) ?
static EGLContext yagl_egl_wgl_context_create(struct yagl_egl_driver *driver,
EGLNativeDisplayType egl_dpy,
const struct yagl_egl_native_config *cfg,
- EGLContext share_context)
+ EGLContext share_context,
+ int version)
{
YaglEglWglDriver *egl_wgl = (YaglEglWglDriver *)(driver);
YaglEglWglDpy *dpy = (YaglEglWglDpy *)egl_dpy;
EGLContext (*context_create)(struct yagl_egl_driver */*driver*/,
EGLNativeDisplayType /*dpy*/,
const struct yagl_egl_native_config */*cfg*/,
- EGLContext /*share_context*/);
+ EGLContext /*share_context*/,
+ int /*version*/);
void (*context_destroy)(struct yagl_egl_driver */*driver*/,
EGLNativeDisplayType /*dpy*/,
struct yagl_eglb_context *(*create_context)(struct yagl_eglb_display */*dpy*/,
const struct yagl_egl_native_config */*cfg*/,
- struct yagl_eglb_context */*share_context*/);
+ struct yagl_eglb_context */*share_context*/,
+ int /*version*/);
/*
* 'pixels' are locked in target's memory, no page fault possible.