mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-14 13:56:00 +00:00
video: Improve the EGL attribute callbacks.
Now it has access to information it needs and it's clear who is reponsible for memory management. Fixes #11039.
This commit is contained in:

committed by
Sam Lantinga

parent
d4143e02d1
commit
9a5d5a2839
@@ -537,6 +537,7 @@ bool SDL_EGL_LoadLibrary(SDL_VideoDevice *_this, const char *egl_path, NativeDis
|
||||
}
|
||||
}
|
||||
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(uintptr_t)native_display, attribs);
|
||||
SDL_free(attribs);
|
||||
} else {
|
||||
if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
|
||||
_this->egl_data->eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)SDL_EGL_GetProcAddressInternal(_this, "eglGetPlatformDisplayEXT");
|
||||
@@ -1038,7 +1039,7 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
|
||||
if (_this->egl_contextattrib_callback) {
|
||||
const int maxAttribs = sizeof(attribs) / sizeof(attribs[0]);
|
||||
EGLint *userAttribs, *userAttribP;
|
||||
userAttribs = _this->egl_contextattrib_callback(_this->egl_attrib_callback_userdata);
|
||||
userAttribs = _this->egl_contextattrib_callback(_this->egl_attrib_callback_userdata, _this->egl_data->egl_display, _this->egl_data->egl_config);
|
||||
if (!userAttribs) {
|
||||
_this->gl_config.driver_loaded = 0;
|
||||
*_this->gl_config.driver_path = '\0';
|
||||
@@ -1056,6 +1057,7 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
|
||||
attribs[attr++] = *userAttribP++;
|
||||
attribs[attr++] = *userAttribP++;
|
||||
}
|
||||
SDL_free(userAttribs);
|
||||
}
|
||||
|
||||
attribs[attr++] = EGL_NONE;
|
||||
@@ -1264,7 +1266,7 @@ EGLSurface SDL_EGL_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, Nat
|
||||
if (_this->egl_surfaceattrib_callback) {
|
||||
const int maxAttribs = sizeof(attribs) / sizeof(attribs[0]);
|
||||
EGLint *userAttribs, *userAttribP;
|
||||
userAttribs = _this->egl_surfaceattrib_callback(_this->egl_attrib_callback_userdata);
|
||||
userAttribs = _this->egl_surfaceattrib_callback(_this->egl_attrib_callback_userdata, _this->egl_data->egl_display, _this->egl_data->egl_config);
|
||||
if (!userAttribs) {
|
||||
_this->gl_config.driver_loaded = 0;
|
||||
*_this->gl_config.driver_path = '\0';
|
||||
@@ -1282,6 +1284,7 @@ EGLSurface SDL_EGL_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, Nat
|
||||
attribs[attr++] = *userAttribP++;
|
||||
attribs[attr++] = *userAttribP++;
|
||||
}
|
||||
SDL_free(userAttribs);
|
||||
}
|
||||
|
||||
attribs[attr++] = EGL_NONE;
|
||||
|
Reference in New Issue
Block a user