|
@@ -25,6 +25,7 @@
|
|
|
#include "SDL.h"
|
|
|
#include "SDL_video.h"
|
|
|
#include "SDL_sysvideo.h"
|
|
|
+#include "SDL_egl_c.h"
|
|
|
#include "SDL_blit.h"
|
|
|
#include "SDL_pixels_c.h"
|
|
|
#include "SDL_rect_c.h"
|
|
@@ -1902,16 +1903,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
|
|
window->surface_valid = SDL_FALSE;
|
|
|
}
|
|
|
|
|
|
- if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
|
|
- if (_this->DestroyWindowFramebuffer) {
|
|
|
- _this->DestroyWindowFramebuffer(_this, window);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
|
|
- _this->DestroyWindow(_this, window);
|
|
|
- }
|
|
|
-
|
|
|
if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
|
|
|
if (flags & SDL_WINDOW_OPENGL) {
|
|
|
need_gl_load = SDL_TRUE;
|
|
@@ -1942,6 +1933,16 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
|
|
SDL_Vulkan_UnloadLibrary();
|
|
|
}
|
|
|
|
|
|
+ if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
|
|
+ if (_this->DestroyWindowFramebuffer) {
|
|
|
+ _this->DestroyWindowFramebuffer(_this, window);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
|
|
+ _this->DestroyWindow(_this, window);
|
|
|
+ }
|
|
|
+
|
|
|
if (need_gl_load) {
|
|
|
if (SDL_GL_LoadLibrary(NULL) < 0) {
|
|
|
return -1;
|
|
@@ -3283,6 +3284,12 @@ SDL_DestroyWindow(SDL_Window * window)
|
|
|
window->surface = NULL;
|
|
|
window->surface_valid = SDL_FALSE;
|
|
|
}
|
|
|
+ if (window->flags & SDL_WINDOW_OPENGL) {
|
|
|
+ SDL_GL_UnloadLibrary();
|
|
|
+ }
|
|
|
+ if (window->flags & SDL_WINDOW_VULKAN) {
|
|
|
+ SDL_Vulkan_UnloadLibrary();
|
|
|
+ }
|
|
|
if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
|
|
if (_this->DestroyWindowFramebuffer) {
|
|
|
_this->DestroyWindowFramebuffer(_this, window);
|
|
@@ -3291,12 +3298,6 @@ SDL_DestroyWindow(SDL_Window * window)
|
|
|
if (_this->DestroyWindow) {
|
|
|
_this->DestroyWindow(_this, window);
|
|
|
}
|
|
|
- if (window->flags & SDL_WINDOW_OPENGL) {
|
|
|
- SDL_GL_UnloadLibrary();
|
|
|
- }
|
|
|
- if (window->flags & SDL_WINDOW_VULKAN) {
|
|
|
- SDL_Vulkan_UnloadLibrary();
|
|
|
- }
|
|
|
|
|
|
display = SDL_GetDisplayForWindow(window);
|
|
|
if (display->fullscreen_window == window) {
|
|
@@ -3466,6 +3467,31 @@ SDL_GL_GetProcAddress(const char *proc)
|
|
|
return func;
|
|
|
}
|
|
|
|
|
|
+void *
|
|
|
+SDL_EGL_GetProcAddress(const char *proc)
|
|
|
+{
|
|
|
+#if SDL_VIDEO_OPENGL_EGL
|
|
|
+ void *func;
|
|
|
+
|
|
|
+ if (!_this) {
|
|
|
+ SDL_UninitializedVideo();
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ func = NULL;
|
|
|
+
|
|
|
+ if (_this->egl_data) {
|
|
|
+ func = SDL_EGL_GetProcAddressInternal(_this, proc);
|
|
|
+ } else {
|
|
|
+ SDL_SetError("No EGL library has been loaded");
|
|
|
+ }
|
|
|
+
|
|
|
+ return func;
|
|
|
+#else
|
|
|
+ SDL_SetError("SDL was not built with EGL support");
|
|
|
+ return NULL;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
SDL_GL_UnloadLibrary(void)
|
|
|
{
|
|
@@ -3606,6 +3632,18 @@ SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+void SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback,
|
|
|
+ SDL_EGLIntArrayCallback surfaceAttribCallback,
|
|
|
+ SDL_EGLIntArrayCallback contextAttribCallback)
|
|
|
+{
|
|
|
+ if (!_this) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _this->egl_platformattrib_callback = platformAttribCallback;
|
|
|
+ _this->egl_surfaceattrib_callback = surfaceAttribCallback;
|
|
|
+ _this->egl_contextattrib_callback = contextAttribCallback;
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
SDL_GL_ResetAttributes()
|
|
|
{
|
|
@@ -3613,6 +3651,10 @@ SDL_GL_ResetAttributes()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ _this->egl_platformattrib_callback = NULL;
|
|
|
+ _this->egl_surfaceattrib_callback = NULL;
|
|
|
+ _this->egl_contextattrib_callback = NULL;
|
|
|
+
|
|
|
_this->gl_config.red_size = 3;
|
|
|
_this->gl_config.green_size = 3;
|
|
|
_this->gl_config.blue_size = 2;
|
|
@@ -3659,6 +3701,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
|
|
@@ -3775,6 +3819,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;
|
|
@@ -3984,6 +4031,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");
|
|
|
}
|
|
@@ -4129,6 +4182,66 @@ SDL_GL_GetCurrentContext(void)
|
|
|
return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
|
|
|
}
|
|
|
|
|
|
+SDL_EGLDisplay
|
|
|
+SDL_EGL_GetCurrentEGLDisplay(void)
|
|
|
+{
|
|
|
+#if SDL_VIDEO_OPENGL_EGL
|
|
|
+ if (!_this) {
|
|
|
+ SDL_UninitializedVideo();
|
|
|
+ return EGL_NO_DISPLAY;
|
|
|
+ }
|
|
|
+ if (!_this->egl_data) {
|
|
|
+ SDL_SetError("There is no current EGL display");
|
|
|
+ return EGL_NO_DISPLAY;
|
|
|
+ }
|
|
|
+ return _this->egl_data->egl_display;
|
|
|
+#else
|
|
|
+ SDL_SetError("SDL was not built with EGL support");
|
|
|
+ return NULL;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+SDL_EGLConfig
|
|
|
+SDL_EGL_GetCurrentEGLConfig(void)
|
|
|
+{
|
|
|
+#if SDL_VIDEO_OPENGL_EGL
|
|
|
+ if (!_this) {
|
|
|
+ SDL_UninitializedVideo();
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ if (!_this->egl_data) {
|
|
|
+ SDL_SetError("There is no current EGL display");
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ return _this->egl_data->egl_config;
|
|
|
+#else
|
|
|
+ SDL_SetError("SDL was not built with EGL support");
|
|
|
+ return NULL;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+SDL_EGLConfig
|
|
|
+SDL_EGL_GetWindowEGLSurface(SDL_Window * window)
|
|
|
+{
|
|
|
+#if SDL_VIDEO_OPENGL_EGL
|
|
|
+ if (!_this) {
|
|
|
+ SDL_UninitializedVideo();
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ if (!_this->egl_data) {
|
|
|
+ SDL_SetError("There is no current EGL display");
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ if (_this->GL_GetEGLSurface) {
|
|
|
+ return _this->GL_GetEGLSurface(_this, window);
|
|
|
+ }
|
|
|
+ return NULL;
|
|
|
+#else
|
|
|
+ SDL_SetError("SDL was not built with EGL support");
|
|
|
+ return NULL;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h)
|
|
|
{
|
|
|
CHECK_WINDOW_MAGIC(window,);
|