Better fix to support EGL_KHR_create_context and not fail to build on Android

...or Raspberry Pi (EGL < 1.4 systems)
This commit is contained in:
Gabriel Jacobo 2014-06-28 13:05:16 -03:00
parent 9dc2614e7d
commit 765894e3cd
1 changed files with 4 additions and 5 deletions

View File

@ -416,9 +416,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
} }
/* Bind the API */ /* Bind the API */
#if !__ANDROID__ /* No support for desktop OpenGL on Android */
if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
#endif /* !__ANDROID__ */
_this->egl_data->eglBindAPI(EGL_OPENGL_ES_API); _this->egl_data->eglBindAPI(EGL_OPENGL_ES_API);
if (_this->gl_config.major_version) { if (_this->gl_config.major_version) {
context_attrib_list[1] = _this->gl_config.major_version; context_attrib_list[1] = _this->gl_config.major_version;
@ -427,11 +425,10 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display, egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
_this->egl_data->egl_config, _this->egl_data->egl_config,
share_context, context_attrib_list); share_context, context_attrib_list);
#if !__ANDROID__
} }
else { else {
_this->egl_data->eglBindAPI(EGL_OPENGL_API); _this->egl_data->eglBindAPI(EGL_OPENGL_API);
#ifdef EGL_KHR_create_context
if(SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { if(SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) {
context_attrib_list[0] = EGL_CONTEXT_MAJOR_VERSION_KHR; context_attrib_list[0] = EGL_CONTEXT_MAJOR_VERSION_KHR;
context_attrib_list[1] = _this->gl_config.major_version; context_attrib_list[1] = _this->gl_config.major_version;
@ -452,11 +449,13 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
else { else {
context_attrib_list[0] = EGL_NONE; context_attrib_list[0] = EGL_NONE;
} }
#else /* EGL_KHR_create_context*/
context_attrib_list[0] = EGL_NONE;
#endif /* EGL_KHR_create_context */
egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display, egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
_this->egl_data->egl_config, _this->egl_data->egl_config,
share_context, context_attrib_list); share_context, context_attrib_list);
} }
#endif /* !__ANDROID__ */
if (egl_context == EGL_NO_CONTEXT) { if (egl_context == EGL_NO_CONTEXT) {
SDL_SetError("Could not create EGL context"); SDL_SetError("Could not create EGL context");