|
|
@@ -163,6 +163,26 @@ typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display *dpy,
|
|
|
|
|
|
static void X11_GL_InitExtensions(SDL_VideoDevice *_this);
|
|
|
|
|
|
+static bool X11_GL_LoadLibrary_EGLFallback(SDL_VideoDevice *_this, const char *path)
|
|
|
+{
|
|
|
+#ifdef SDL_VIDEO_OPENGL_EGL
|
|
|
+ X11_GL_UnloadLibrary(_this);
|
|
|
+ _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_DestroyContext = X11_GLES_DestroyContext;
|
|
|
+ _this->GL_GetEGLSurface = X11_GLES_GetEGLSurface;
|
|
|
+ return X11_GLES_LoadLibrary(_this, path);
|
|
|
+#else
|
|
|
+ return SDL_SetError("SDL not configured with EGL support");
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
bool X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
|
|
{
|
|
|
Display *display;
|
|
|
@@ -172,6 +192,11 @@ bool X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
|
|
return SDL_SetError("OpenGL context already created");
|
|
|
}
|
|
|
|
|
|
+ if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) &&
|
|
|
+ SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, false)) {
|
|
|
+ return X11_GL_LoadLibrary_EGLFallback(_this, path);
|
|
|
+ }
|
|
|
+
|
|
|
// Load the OpenGL library
|
|
|
if (path == NULL) {
|
|
|
path = SDL_GetHint(SDL_HINT_OPENGL_LIBRARY);
|
|
|
@@ -254,21 +279,7 @@ bool X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
|
|
if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
|
|
|
SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, false)) &&
|
|
|
X11_GL_UseEGL(_this)) {
|
|
|
-#ifdef SDL_VIDEO_OPENGL_EGL
|
|
|
- X11_GL_UnloadLibrary(_this);
|
|
|
- _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_DestroyContext = X11_GLES_DestroyContext;
|
|
|
- return X11_GLES_LoadLibrary(_this, NULL);
|
|
|
-#else
|
|
|
- return SDL_SetError("SDL not configured with EGL support");
|
|
|
-#endif
|
|
|
+ return X11_GL_LoadLibrary_EGLFallback(_this, NULL);
|
|
|
}
|
|
|
|
|
|
return true;
|