Fixes bug #2037, common EGL code for Android and X11
This commit is contained in:
parent
29ea6509bc
commit
ef4a588d99
25 changed files with 927 additions and 878 deletions
|
@ -140,25 +140,6 @@ X11_GL_LoadLibrary(_THIS, const char *path)
|
|||
return SDL_SetError("OpenGL context already created");
|
||||
}
|
||||
|
||||
/* If SDL_GL_CONTEXT_EGL has been changed to 1, switch over to X11_GLES functions */
|
||||
if (_this->gl_config.use_egl == 1) {
|
||||
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||
_this->GL_LoadLibrary = X11_GLES_LoadLibrary;
|
||||
_this->GL_GetProcAddress = X11_GLES_GetProcAddress;
|
||||
_this->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
|
||||
_this->GL_CreateContext = X11_GLES_CreateContext;
|
||||
_this->GL_MakeCurrent = X11_GLES_MakeCurrent;
|
||||
_this->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
|
||||
_this->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
|
||||
_this->GL_SwapWindow = X11_GLES_SwapWindow;
|
||||
_this->GL_DeleteContext = X11_GLES_DeleteContext;
|
||||
return X11_GLES_LoadLibrary(_this, path);
|
||||
#else
|
||||
return SDL_SetError("SDL not configured with OpenGL ES/EGL support");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Load the OpenGL library */
|
||||
if (path == NULL) {
|
||||
path = SDL_getenv("SDL_OPENGL_LIBRARY");
|
||||
|
@ -228,6 +209,38 @@ X11_GL_LoadLibrary(_THIS, const char *path)
|
|||
|
||||
/* Initialize extensions */
|
||||
X11_GL_InitExtensions(_this);
|
||||
|
||||
/* If SDL_GL_CONTEXT_EGL has been changed to 1, and there's
|
||||
* no GLX_EXT_create_context_es2_profile extension switch over to X11_GLES functions */
|
||||
if (_this->gl_config.use_egl == 1) {
|
||||
if (_this->gl_data->HAS_GLX_EXT_create_context_es2_profile) {
|
||||
/* We cheat a little bit here by using GLX instead of EGL
|
||||
* to improve our chances of getting hardware acceleration */
|
||||
_this->gl_config.use_egl = 0;
|
||||
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
||||
} else {
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
X11_GL_UnloadLibrary(_this);
|
||||
/* Better avoid conflicts! */
|
||||
if (_this->gl_config.dll_handle != NULL ) {
|
||||
GL_UnloadObject(_this->gl_config.dll_handle);
|
||||
_this->gl_config.dll_handle = NULL;
|
||||
}
|
||||
_this->GL_LoadLibrary = X11_GLES_LoadLibrary;
|
||||
_this->GL_GetProcAddress = X11_GLES_GetProcAddress;
|
||||
_this->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
|
||||
_this->GL_CreateContext = X11_GLES_CreateContext;
|
||||
_this->GL_MakeCurrent = X11_GLES_MakeCurrent;
|
||||
_this->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
|
||||
_this->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
|
||||
_this->GL_SwapWindow = X11_GLES_SwapWindow;
|
||||
_this->GL_DeleteContext = X11_GLES_DeleteContext;
|
||||
return X11_GLES_LoadLibrary(_this, NULL);
|
||||
#else
|
||||
return SDL_SetError("SDL not configured with EGL support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -369,6 +382,11 @@ X11_GL_InitExtensions(_THIS)
|
|||
if (HasExtension("GLX_EXT_visual_info", extensions)) {
|
||||
_this->gl_data->HAS_GLX_EXT_visual_info = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* Check for GLX_EXT_create_context_es2_profile */
|
||||
if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) {
|
||||
_this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE;
|
||||
}
|
||||
|
||||
if (context) {
|
||||
_this->gl_data->glXMakeCurrent(display, None, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue