video: Rename SDL_GL_DeleteContext to SDL_GL_DestroyContext.

Turns out that there isn't a strong OpenGL naming convention for "Delete" ...
WGL offers "wglDeleteContext" but the GLX equivalent is "glxDestroyContext"
and then EGL sealed the deal by going with Destroy as well! Since it matches
SDL3 naming conventions (Create/Destroy), we're renaming it.

Fixes #10197.
This commit is contained in:
Ryan C. Gordon 2024-07-10 14:50:57 -04:00
parent 29b0076659
commit af2dbf3ff3
16 changed files with 34 additions and 24 deletions

View File

@ -3501,3 +3501,8 @@ typedef SDL_PixelFormat, SDL_PackedPixelDetails;
@@
- SDL_SIMD_ALIGNED
+ SDL_SURFACE_SIMD_ALIGNED
@@
@@
- SDL_GL_DeleteContext
+ SDL_GL_DestroyContext
(...)

View File

@ -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()

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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(); \

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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 */

View File

@ -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]);
}
}

View File

@ -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]);
}
}

View File

@ -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]);
}
}