From: yangchen Date: Mon, 19 Sep 2016 15:45:14 +0000 (+0800) Subject: [SDL_Tizen]add EGL_KHR_surfaceless_context extension support. X-Git-Tag: submit/tizen_3.0_ivi/20161010.000000^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F88955%2F4;p=platform%2Fupstream%2FSDL.git [SDL_Tizen]add EGL_KHR_surfaceless_context extension support. Change-Id: If83cf97acf48da3922f5173805e4ff06bc0e9977 --- diff --git a/include/SDL_video.h b/include/SDL_video.h old mode 100644 new mode 100755 diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h old mode 100644 new mode 100755 diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c old mode 100644 new mode 100755 diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c old mode 100644 new mode 100755 diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c old mode 100644 new mode 100755 index bfd4aff..c34ff11 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -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; } diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h old mode 100644 new mode 100755 diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c old mode 100644 new mode 100755 index bb2819d..aeef2c0 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -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 {