opengl: Be more robust in failing cases. Load all possible symbols, not just until one fails, in case they get used during shutdown, etc. Fixes Bugzilla #4093.
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 6c09e16..c32f2dc 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -178,7 +178,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
data->errors = 0;
data->error_messages = NULL;
}
- } else {
+ } else if (data->glGetError != NULL) {
while (data->glGetError() != GL_NO_ERROR) {
continue;
}
@@ -234,18 +234,19 @@ GL_LoadFunctions(GL_RenderData * data)
#ifdef __SDL_NOGETPROCADDR__
#define SDL_PROC(ret,func,params) data->func=func;
#else
+ int retval = 0;
#define SDL_PROC(ret,func,params) \
do { \
data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
- return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
+ retval = SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
} \
} while ( 0 );
#endif /* __SDL_NOGETPROCADDR__ */
#include "SDL_glfuncs.h"
#undef SDL_PROC
- return 0;
+ return retval;
}
static int