Browse Source

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.
Ryan C. Gordon 6 years ago
parent
commit
7162649f78
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/render/opengl/SDL_render_gl.c

+ 4 - 3
src/render/opengl/SDL_render_gl.c

@@ -178,7 +178,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
             data->errors = 0;
             data->errors = 0;
             data->error_messages = NULL;
             data->error_messages = NULL;
         }
         }
-    } else {
+    } else if (data->glGetError != NULL) {
         while (data->glGetError() != GL_NO_ERROR) {
         while (data->glGetError() != GL_NO_ERROR) {
             continue;
             continue;
         }
         }
@@ -234,18 +234,19 @@ GL_LoadFunctions(GL_RenderData * data)
 #ifdef __SDL_NOGETPROCADDR__
 #ifdef __SDL_NOGETPROCADDR__
 #define SDL_PROC(ret,func,params) data->func=func;
 #define SDL_PROC(ret,func,params) data->func=func;
 #else
 #else
+    int retval = 0;
 #define SDL_PROC(ret,func,params) \
 #define SDL_PROC(ret,func,params) \
     do { \
     do { \
         data->func = SDL_GL_GetProcAddress(#func); \
         data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->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 );
     } while ( 0 );
 #endif /* __SDL_NOGETPROCADDR__ */
 #endif /* __SDL_NOGETPROCADDR__ */
 
 
 #include "SDL_glfuncs.h"
 #include "SDL_glfuncs.h"
 #undef SDL_PROC
 #undef SDL_PROC
-    return 0;
+    return retval;
 }
 }
 
 
 static int
 static int