egl: implement SDL_GL_EGL_PLATFORM attribute
This implements a new SDL_GL_EGL_PLATFORM attribute to set the "platform" argument for SDL_EGL_LoadLibrary on Windows, macOS, and Linux. I've limited it to those three operating systems because that's what I've been able to test against.main
parent
aed980526c
commit
c608cf6222
|
@ -249,7 +249,8 @@ typedef enum
|
|||
SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
|
||||
SDL_GL_CONTEXT_RESET_NOTIFICATION,
|
||||
SDL_GL_CONTEXT_NO_ERROR,
|
||||
SDL_GL_FLOATBUFFERS
|
||||
SDL_GL_FLOATBUFFERS,
|
||||
SDL_GL_EGL_PLATFORM
|
||||
} SDL_GLattr;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -391,6 +391,7 @@ struct SDL_VideoDevice
|
|||
int framebuffer_srgb_capable;
|
||||
int no_error;
|
||||
int retained_backing;
|
||||
int egl_platform;
|
||||
int driver_loaded;
|
||||
char driver_path[256];
|
||||
void *dll_handle;
|
||||
|
|
|
@ -3673,6 +3673,8 @@ SDL_GL_ResetAttributes()
|
|||
_this->gl_config.reset_notification = SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
|
||||
|
||||
_this->gl_config.share_with_current_context = 0;
|
||||
|
||||
_this->gl_config.egl_platform = 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -3789,6 +3791,9 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
|||
case SDL_GL_CONTEXT_NO_ERROR:
|
||||
_this->gl_config.no_error = value;
|
||||
break;
|
||||
case SDL_GL_EGL_PLATFORM:
|
||||
_this->gl_config.egl_platform = value;
|
||||
break;
|
||||
default:
|
||||
retval = SDL_SetError("Unknown OpenGL attribute");
|
||||
break;
|
||||
|
@ -3998,6 +4003,12 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
|||
*value = _this->gl_config.no_error;
|
||||
return 0;
|
||||
}
|
||||
case SDL_GL_EGL_PLATFORM:
|
||||
{
|
||||
*value = _this->gl_config.egl_platform;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unknown OpenGL attribute");
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ Cocoa_GLES_LoadLibrary(_THIS, const char *path)
|
|||
}
|
||||
|
||||
if (_this->egl_data == NULL) {
|
||||
return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0);
|
||||
return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, _this->gl_config.egl_platform);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -127,7 +127,7 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|||
#if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 1, while the below lines function. */
|
||||
SDL_assert(!_this->gl_config.driver_loaded);
|
||||
#endif
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, _this->gl_config.egl_platform) < 0) {
|
||||
SDL_EGL_UnloadLibrary(_this);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) {
|
|||
}
|
||||
|
||||
if (_this->egl_data == NULL) {
|
||||
return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0);
|
||||
return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, _this->gl_config.egl_platform);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -113,7 +113,7 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|||
#if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 1, while the below lines function. */
|
||||
SDL_assert(!_this->gl_config.driver_loaded);
|
||||
#endif
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, _this->gl_config.egl_platform) < 0) {
|
||||
SDL_EGL_UnloadLibrary(_this);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path)
|
|||
#endif
|
||||
}
|
||||
|
||||
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0);
|
||||
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, _this->gl_config.egl_platform);
|
||||
}
|
||||
|
||||
XVisualInfo *
|
||||
|
|
Loading…
Reference in New Issue