[SDL_Tizen]add EGL_KHR_surfaceless_context extension support. 55/88955/4
authoryangchen <chen2.yang@samsung.com>
Mon, 19 Sep 2016 15:45:14 +0000 (23:45 +0800)
committerWonsik, Jung <sidein@samsung.com>
Wed, 5 Oct 2016 04:25:51 +0000 (13:25 +0900)
Change-Id: If83cf97acf48da3922f5173805e4ff06bc0e9977

include/SDL_video.h [changed mode: 0644->0755]
src/dynapi/SDL_dynapi_procs.h [changed mode: 0644->0755]
src/render/opengles/SDL_render_gles.c [changed mode: 0644->0755]
src/render/opengles2/SDL_render_gles2.c [changed mode: 0644->0755]
src/video/SDL_egl.c [changed mode: 0644->0755]
src/video/SDL_sysvideo.h [changed mode: 0644->0755]
src/video/SDL_video.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index bfd4aff..c34ff11
@@ -520,19 +520,28 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
     if (!_this->egl_data) {
         return SDL_SetError("OpenGL not initialized");
     }
-    
-    /* The android emulator crashes badly if you try to eglMakeCurrent 
-     * with a valid context and invalid surface, so we have to check for both here.
-     */
-    if (!egl_context || !egl_surface) {
-         _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-    } else {
+#ifdef __TIZEN__
+    if ((SDL_EGL_HasExtension(_this, "EGL_KHR_surfaceless_context")) && (!egl_surface)) {
         if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
-            egl_surface, egl_surface, egl_context)) {
-            return SDL_SetError("Unable to make EGL context current");
+                EGL_NO_SURFACE , EGL_NO_SURFACE , egl_context)) {
+                return SDL_SetError("Unable to make EGL context current");
+            }
+    }
+    else
+#endif
+    {
+        /* The android emulator crashes badly if you try to eglMakeCurrent
+        * with a valid context and invalid surface, so we have to check for both here.
+        */
+        if (!egl_context || !egl_surface) {
+            _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+        } else {
+            if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
+                egl_surface, egl_surface, egl_context)) {
+                return SDL_SetError("Unable to make EGL context current");
+            }
         }
     }
-      
     return 0;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index bb2819d..aeef2c0
@@ -3233,6 +3233,27 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
         return 0;
     }
 
+#ifdef __TIZEN__
+    if ((SDL_GL_ExtensionSupported("EGL_KHR_surfaceless_context")) && (!window)) {
+        /* current window checking */
+        SDL_Window* cur_win = SDL_GL_GetCurrentWindow();
+        if (!ctx) cur_win = NULL;
+        CHECK_WINDOW_MAGIC(cur_win, -1);
+
+        if (!(cur_win->flags & SDL_WINDOW_OPENGL)) {
+            return SDL_SetError("The specified window isn't an OpenGL window");
+        }
+        retval = _this->GL_MakeCurrent(_this, NULL, ctx);
+        if (retval == 0) {
+            _this->current_glwin = cur_win;
+            _this->current_glctx = ctx;
+            SDL_TLSSet(_this->current_glwin_tls, cur_win, NULL);
+            SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
+        }
+        return retval;
+    }
+#endif
+
     if (!ctx) {
         window = NULL;
     } else {