From 4a8c2967126cf18b8cd721c9ded71856268c62b5 Mon Sep 17 00:00:00 2001 From: Gabriel Jacobo Date: Fri, 13 Dec 2013 09:48:12 -0300 Subject: [PATCH] Context sharing for EGL --- src/video/SDL_egl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 1e66fb7d9a12f..c081a5da22874 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -340,7 +340,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) EGL_NONE }; - EGLContext egl_context; + EGLContext egl_context, share_context = EGL_NO_CONTEXT; if (!_this->egl_data) { /* The EGL library wasn't loaded, SDL_GetError() should have info */ @@ -350,11 +350,15 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) if (_this->gl_config.major_version) { context_attrib_list[1] = _this->gl_config.major_version; } + + if (_this->gl_config.share_with_current_context) { + share_context = (EGLContext)SDL_GL_GetCurrentContext(); + } egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display, _this->egl_data->egl_config, - EGL_NO_CONTEXT, context_attrib_list); + share_context, context_attrib_list); if (egl_context == EGL_NO_CONTEXT) { SDL_SetError("Could not create EGL context");