Context sharing for EGL
authorGabriel Jacobo <gabomdq@gmail.com>
Fri, 13 Dec 2013 09:48:12 -0300
changeset 8061 a5f8137ccf01
parent 8060 d1948d163145
child 8062 4fc5f66d63cc
Context sharing for EGL
src/video/SDL_egl.c
--- a/src/video/SDL_egl.c	Thu Dec 12 14:55:33 2013 -0300
+++ b/src/video/SDL_egl.c	Fri Dec 13 09:48:12 2013 -0300
@@ -340,7 +340,7 @@
         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 @@
     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");