Rename variables in SDL_egl.c to be more intuitive

This commit is contained in:
Cameron Cawley 2022-06-11 17:11:55 +01:00 committed by Sam Lantinga
parent e09551bc80
commit fd8cafc72e
3 changed files with 37 additions and 37 deletions

View File

@ -114,7 +114,7 @@
_this->egl_data->NAME = (void *)NAME;
#else
#define LOAD_FUNC(NAME) \
_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->egl_dll_handle, #NAME); \
if (!_this->egl_data->NAME) \
{ \
return SDL_SetError("Could not retrieve EGL function " #NAME); \
@ -250,12 +250,12 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc)
/* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */
if (!retval) {
static char procname[64];
retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, proc);
retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc);
/* just in case you need an underscore prepended... */
if (!retval && (SDL_strlen(proc) < (sizeof (procname) - 1))) {
procname[0] = '_';
SDL_strlcpy(procname + 1, proc, sizeof (procname) - 1);
retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname);
retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, procname);
}
}
#endif
@ -280,14 +280,14 @@ SDL_EGL_UnloadLibrary(_THIS)
_this->egl_data->egl_display = NULL;
}
if (_this->egl_data->dll_handle) {
SDL_UnloadObject(_this->egl_data->dll_handle);
_this->egl_data->dll_handle = NULL;
}
if (_this->egl_data->egl_dll_handle) {
SDL_UnloadObject(_this->egl_data->egl_dll_handle);
_this->egl_data->egl_dll_handle = NULL;
}
if (_this->egl_data->opengl_dll_handle) {
SDL_UnloadObject(_this->egl_data->opengl_dll_handle);
_this->egl_data->opengl_dll_handle = NULL;
}
SDL_free(_this->egl_data);
_this->egl_data = NULL;
@ -297,7 +297,7 @@ SDL_EGL_UnloadLibrary(_THIS)
int
SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
{
void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */
void *egl_dll_handle = NULL, *opengl_dll_handle = NULL;
const char *path = NULL;
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
const char *d3dcompiler;
@ -349,32 +349,32 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
/* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */
path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
if (path != NULL) {
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
}
if (egl_dll_handle == NULL) {
if (opengl_dll_handle == NULL) {
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
if (_this->gl_config.major_version > 1) {
path = DEFAULT_OGL_ES2;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
#ifdef ALT_OGL_ES2
if (egl_dll_handle == NULL && !vc4) {
if (opengl_dll_handle == NULL && !vc4) {
path = ALT_OGL_ES2;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
}
#endif
} else {
path = DEFAULT_OGL_ES;
egl_dll_handle = SDL_LoadObject(path);
if (egl_dll_handle == NULL) {
opengl_dll_handle = SDL_LoadObject(path);
if (opengl_dll_handle == NULL) {
path = DEFAULT_OGL_ES_PVR;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
}
#ifdef ALT_OGL_ES2
if (egl_dll_handle == NULL && !vc4) {
if (opengl_dll_handle == NULL && !vc4) {
path = ALT_OGL_ES2;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
}
#endif
}
@ -382,47 +382,47 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
#ifdef DEFAULT_OGL
else {
path = DEFAULT_OGL;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
#ifdef ALT_OGL
if (egl_dll_handle == NULL) {
if (opengl_dll_handle == NULL) {
path = ALT_OGL;
egl_dll_handle = SDL_LoadObject(path);
opengl_dll_handle = SDL_LoadObject(path);
}
#endif
}
#endif
}
_this->egl_data->egl_dll_handle = egl_dll_handle;
_this->egl_data->opengl_dll_handle = opengl_dll_handle;
if (egl_dll_handle == NULL) {
if (opengl_dll_handle == NULL) {
return SDL_SetError("Could not initialize OpenGL / GLES library");
}
/* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */
if (egl_path != NULL) {
dll_handle = SDL_LoadObject(egl_path);
egl_dll_handle = SDL_LoadObject(egl_path);
}
/* Try loading a EGL symbol, if it does not work try the default library paths */
if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
if (dll_handle != NULL) {
SDL_UnloadObject(dll_handle);
if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) {
if (egl_dll_handle != NULL) {
SDL_UnloadObject(egl_dll_handle);
}
path = SDL_getenv("SDL_VIDEO_EGL_DRIVER");
if (path == NULL) {
path = DEFAULT_EGL;
}
dll_handle = SDL_LoadObject(path);
egl_dll_handle = SDL_LoadObject(path);
#ifdef ALT_EGL
if (dll_handle == NULL && !vc4) {
if (egl_dll_handle == NULL && !vc4) {
path = ALT_EGL;
dll_handle = SDL_LoadObject(path);
egl_dll_handle = SDL_LoadObject(path);
}
#endif
if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
if (dll_handle != NULL) {
SDL_UnloadObject(dll_handle);
if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) {
if (egl_dll_handle != NULL) {
SDL_UnloadObject(egl_dll_handle);
}
return SDL_SetError("Could not load EGL library");
}
@ -430,9 +430,9 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
}
#endif
_this->egl_data->dll_handle = dll_handle;
#if SDL_VIDEO_DRIVER_VITA
_this->egl_data->egl_dll_handle = egl_dll_handle;
#if SDL_VIDEO_DRIVER_VITA
_this->egl_data->opengl_dll_handle = opengl_dll_handle;
#endif
/* Load new function pointers */

View File

@ -33,7 +33,7 @@
typedef struct SDL_EGL_VideoData
{
void *egl_dll_handle, *dll_handle;
void *opengl_dll_handle, *egl_dll_handle;
EGLDisplay egl_display;
EGLConfig egl_config;
int egl_swapinterval;

View File

@ -63,7 +63,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path)
}
/* Load ANGLE/WinRT-specific functions */
CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->opengl_dll_handle, "CreateWinrtEglWindow");
if (CreateWinrtEglWindow) {
/* 'CreateWinrtEglWindow' was found, which means that an an older
* version of ANGLE/WinRT is being used. Continue setting up EGL,