diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 67fa06af3d..8d2eea587d 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -3501,3 +3501,8 @@ typedef SDL_PixelFormat, SDL_PackedPixelDetails; @@ - SDL_SIMD_ALIGNED + SDL_SURFACE_SIMD_ALIGNED +@@ +@@ +- SDL_GL_DeleteContext ++ SDL_GL_DestroyContext + (...) diff --git a/docs/README-migration.md b/docs/README-migration.md index 526b4e15b4..9c9501a266 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1977,6 +1977,8 @@ SDL_GL_GetProcAddress() and SDL_EGL_GetProcAddress() now return `SDL_FunctionPoi SDL_GL_SwapWindow() returns 0 if the function succeeds or a negative error code if there was an error. +SDL_GL_DeleteContext() has been renamed to SDL_GL_DestroyContext to match SDL naming conventions (and glX!). It also now returns 0 if the function succeeds or a negative error code if there was an error (it returned void in SDL2). + SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error. SDL_GL_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place. @@ -1987,6 +1989,7 @@ The SDL_WINDOW_TOOLTIP and SDL_WINDOW_POPUP_MENU window flags are now supported SDL_WindowFlags is used instead of Uint32 for API functions that refer to window flags, and has been extended to 64 bits. The following functions have been renamed: +* SDL_GL_DeleteContext() => SDL_GL_DestroyContext() * SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode() * SDL_GetDisplayOrientation() => SDL_GetCurrentDisplayOrientation() * SDL_GetPointDisplayIndex() => SDL_GetDisplayForPoint() diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index c9abf81476..84add35ea3 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -618,6 +618,7 @@ #define SDL_PATCHLEVEL SDL_MICRO_VERSION /* ##SDL_video.h */ +#define SDL_GL_DeleteContext SDL_GL_DestroyContext #define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode #define SDL_GetDisplayOrientation SDL_GetCurrentDisplayOrientation #define SDL_GetPointDisplayIndex SDL_GetDisplayForPoint @@ -1215,6 +1216,7 @@ #define SDL_PATCHLEVEL SDL_PATCHLEVEL_renamed_SDL_MICRO_VERSION /* ##SDL_video.h */ +#define SDL_GL_DeleteContext SDL_GL_DeleteContext_renamed_SDL_GL_DestroyContext #define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode #define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_renamed_SDL_GetCurrentDisplayOrientation #define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayForPoint diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 5dcee6694d..db54c9f99f 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -2592,7 +2592,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value) * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GL_DeleteContext + * \sa SDL_GL_DestroyContext * \sa SDL_GL_MakeCurrent */ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window); @@ -2769,7 +2769,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window *window); * * \sa SDL_GL_CreateContext */ -extern SDL_DECLSPEC int SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); +extern SDL_DECLSPEC int SDLCALL SDL_GL_DestroyContext(SDL_GLContext context); /* @} *//* OpenGL support functions */ diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 79aec801d9..9e665952b8 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -140,7 +140,7 @@ SDL3_0.0.0 { SDL_GDKGetTaskQueue; SDL_GDKSuspendComplete; SDL_GL_CreateContext; - SDL_GL_DeleteContext; + SDL_GL_DestroyContext; SDL_GL_ExtensionSupported; SDL_GL_GetAttribute; SDL_GL_GetCurrentContext; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 6b1a00ae28..e1107a0e7e 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -164,7 +164,7 @@ #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_REAL #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL #define SDL_GL_CreateContext SDL_GL_CreateContext_REAL -#define SDL_GL_DeleteContext SDL_GL_DeleteContext_REAL +#define SDL_GL_DestroyContext SDL_GL_DestroyContext_REAL #define SDL_GL_ExtensionSupported SDL_GL_ExtensionSupported_REAL #define SDL_GL_GetAttribute SDL_GL_GetAttribute_REAL #define SDL_GL_GetCurrentContext SDL_GL_GetCurrentContext_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 51be63cac9..2399bfc4ff 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -183,7 +183,7 @@ SDL_DYNAPI_PROC(int,SDL_GDKGetDefaultUser,(XUserHandle *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(int,SDL_GL_DeleteContext,(SDL_GLContext a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GL_DestroyContext,(SDL_GLContext a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 6c6399ddcf..a4f7cd061a 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1578,7 +1578,7 @@ static void GL_DestroyRenderer(SDL_Renderer *renderer) SDL_free(data->framebuffers); data->framebuffers = nextnode; } - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); } SDL_free(data); } @@ -1686,12 +1686,12 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro goto error; } if (SDL_GL_MakeCurrent(window, data->context) < 0) { - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } if (GL_LoadFunctions(data) < 0) { - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } @@ -1807,7 +1807,7 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT"); } else { SDL_SetError("Can't create render targets, GL_EXT_framebuffer_object not available"); - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index cdfa9faed7..b87626dc7a 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1440,7 +1440,7 @@ static void GLES2_DestroyRenderer(SDL_Renderer *renderer) GL_CheckError("", renderer); #endif - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); } SDL_free(data); @@ -2107,17 +2107,17 @@ static int GLES2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_ goto error; } if (SDL_GL_MakeCurrent(window, data->context) < 0) { - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } if (GLES2_LoadFunctions(data) < 0) { - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } if (GLES2_CacheShaders(data) < 0) { - SDL_GL_DeleteContext(data->context); + SDL_GL_DestroyContext(data->context); goto error; } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 82de50bd8d..516ac5369c 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4920,7 +4920,7 @@ int SDL_GL_SwapWindow(SDL_Window *window) return _this->GL_SwapWindow(_this, window); } -int SDL_GL_DeleteContext(SDL_GLContext context) +int SDL_GL_DestroyContext(SDL_GLContext context) { if (!_this) { return SDL_UninitializedVideo(); \ diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 022d0786ff..8b067aa421 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -386,7 +386,7 @@ SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window) [context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; if (Cocoa_GL_MakeCurrent(_this, window, sdlcontext) < 0) { - SDL_GL_DeleteContext(sdlcontext); + SDL_GL_DestroyContext(sdlcontext); SDL_SetError("Failed making OpenGL context current"); return NULL; } @@ -400,27 +400,27 @@ SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window) glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum))SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - SDL_GL_DeleteContext(sdlcontext); + SDL_GL_DestroyContext(sdlcontext); SDL_SetError("Failed getting OpenGL glGetString entry point"); return NULL; } glversion = (const char *)glGetStringFunc(GL_VERSION); if (glversion == NULL) { - SDL_GL_DeleteContext(sdlcontext); + SDL_GL_DestroyContext(sdlcontext); SDL_SetError("Failed getting OpenGL context version"); return NULL; } if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { - SDL_GL_DeleteContext(sdlcontext); + SDL_GL_DestroyContext(sdlcontext); SDL_SetError("Failed parsing OpenGL context version"); return NULL; } if ((glversion_major < _this->gl_config.major_version) || ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { - SDL_GL_DeleteContext(sdlcontext); + SDL_GL_DestroyContext(sdlcontext); SDL_SetError("Failed creating OpenGL context at version requested"); return NULL; } diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index afcd900463..1890a33e29 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -60,7 +60,7 @@ SDL_FunctionPointer UIKit_GL_GetProcAddress(SDL_VideoDevice *_this, const char * } /* - note that SDL_GL_DeleteContext makes it current without passing the window + note that SDL_GL_DestroyContext makes it current without passing the window */ int UIKit_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context) { diff --git a/test/testgl.c b/test/testgl.c index abbaa0743a..cbf44ae02a 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -63,7 +63,7 @@ static void quit(int rc) { if (context) { /* SDL_GL_MakeCurrent(0, NULL); */ /* doesn't do anything */ - SDL_GL_DeleteContext(context); + SDL_GL_DestroyContext(context); } SDLTest_CommonQuit(state); /* Let 'main()' return normally */ diff --git a/test/testgles.c b/test/testgles.c index 25829391da..d32015f3a0 100644 --- a/test/testgles.c +++ b/test/testgles.c @@ -35,7 +35,7 @@ quit(int rc) if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { - SDL_GL_DeleteContext(context[i]); + SDL_GL_DestroyContext(context[i]); } } diff --git a/test/testgles2.c b/test/testgles2.c index c75ea84ab9..89546ca13d 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -103,7 +103,7 @@ quit(int rc) if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { - SDL_GL_DeleteContext(context[i]); + SDL_GL_DestroyContext(context[i]); } } diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index 23c11238ea..da8935b591 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -95,7 +95,7 @@ quit(int rc) if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { - SDL_GL_DeleteContext(context[i]); + SDL_GL_DestroyContext(context[i]); } }