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

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